to trace red color from a bmp file.... - Programmers Heaven

#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

# to trace red color from a bmp file....

Posts: 3Member
hi all....

there is a bmp file which has a black background and has a red blot(dot) in the middle.....how can i find the coordinates of the red dot....
any code ll be appreciated....

Thanks
Ranjit

• Posts: 173Member
: hi all....
:
: there is a bmp file which has a black background and has a red blot(dot) in the middle.....how can i find the coordinates of the red dot....
: any code ll be appreciated....
:
: Thanks
: Ranjit
:

Its very easy. Fistly you have to understand the format of a bitmap. You can follow to the link below posted by Lundin.

http://www.wotsit.org/

Read and try to understand the format of a bitmap.

How many colors is your bitmap?

Loco
• Posts: 3Member
hi...

i do understand the format but and i can check the color red by searching for 0xff 0x00 0x00....i dont know where the coordinates will be....thats where i need some example code to find the coordinates of that point....

Thanks
Ranjit
• Posts: 3Member
hi....

the bmp is of 24 bits sir

Thanks
Ranjit
• Posts: 173Member
: hi....
:
: the bmp is of 24 bits sir
:
:
: Thanks
: Ranjit
:

I would suggest you convert the image to 16 bit(Save as 16 color using Windows Paint program). It will be much easier to work with 16 bit.

In 16 bit Images a byte represents 2 pixels;

Click on this link and you will find a code written in C/C++ that draws the 16 bit image using Turbo C/C++ graphics.

http://writeka.com/emage/bmp16_format.html

The location of the red dot, you can determine from the image Height and Width. Once you find your Red dot, save its x position (Width position) and y position(Height). Then from there you will have the cordinate of the Red dot.

Loco.