Howdy, Stranger!

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

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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

ranjitneoranjitneo 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

Comments

  • locoloco 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
  • ranjitneoranjitneo 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
  • ranjitneoranjitneo Posts: 3Member
    hi....

    the bmp is of 24 bits sir


    Thanks
    Ranjit
  • locoloco 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.


Sign In or Register to comment.