Ok, I need to know some methods(links, articles, etc.) regarding how to parse & comprehend 32-bit grayscale bitmaps on the basis of their data.
Suppose I have a black background & a white primitive of medium resolution is there any way I can identify the primitive as a Circle, Box, Triangle?

Thanks

P.S. Can someone show me a implementation of the method. One such is on Wikipedia. & the 4-byte alignment technique.

Yes you can.

Just use the isCircle() isBox() isTriangle() methods found under the:- #include <ai.h> header file. You have to write the ai.h file first though.

You have to write the ai.h file first though.

Means include prior to function calls or that I have to create the functions and the file myself.
If former, then I know that. If latter, that's what I am trying to do.
Actually I want to be able to identify the primitives based on the data & not some functions as I may need to make the algorithm much more complex as it builds up.

Thanks

Good luck with that buddy.

First, you need to learn how to read in bitmap images. Find a tutorial with that.
Then when you know how to read in a bitmap image. You should have an array of int
values, which represents the color of the pixels in the images. For example :

black = 0x000000
white = 0xFFFFFF
Red = 0xFF0000
Green = 0x00FF00
Blue = 0x0000FF

Then you need an algorithm to detect from the array of pixels if the bitmap image
is a primitive shape. First learn how to read in the bitmap images. And get back
and we'll try to figure an algorithm out for this interesting problem.

First, you need to learn how to read in bitmap images.

black = 0x000000
white = 0xFFFFFF
Red = 0xFF0000
Green = 0x00FF00
Blue = 0x0000FF

I'm familiar with this & the 54-byte header. I open the image in binary mode ( a Black portion in Red background) & it is stored as
00 00 FF 00 00 FF 00 00 00 00 FF
I know Hex code for red is ff0000 but here the color information is rather being stored as BGR. As Blue is stored as FF 00 00. But why does it exclude a value when it stores black(See: The red part) It is stored as 00 00
Any ideas why?

You also might want to have a look at OpenCV

when it stores black(See: The red part) It is stored as 00 00

I know this much that this is related to the byte padding. But how it works is rather beyond me at this point.

@Nick: I did, but OpenCV is a complex image mapping while I just need to be contented with how to
b) Devise an algorithm
After that I may look into OpenCV & the method it uses as I will then have my own viewpoint, rather than just blindly using functions.

Thanks.

>>But why does it exclude a value when it stores black(See: The red part) It is stored as 00 00

First why does what exclude it?
Are you throwing just random numbers out there, or is there more of that red
numbers in between the RGB?

It's just a trial run. I created a 32x32 image with Red background & Black box & opened it with a Binary Reader/Hex Editor. The 00 00 is part of Padding but I can't figure out when & how is it put.

Padding is done with 4 bit alignment. Here is how I calculated padding for a bitmap
image :

int padding =  (m_bmpInfo.imgWidth % 4);

Padding is done with 4 bit alignment. Here is how I calculated padding for a bitmap
image :

int padding =  (m_bmpInfo.imgWidth % 4);

But after how many bytes is padding introduced? There are 3 RGB values so after how many multiples of 3 will padding be prevalent.

You know if you haven't seen it, wiki has a article on it.
Padding is introduced, when you are done reading one image witdh. For example :

for(unsigned n = 0; n < m_bmpInfo.imgHeight; ++n){
for(unsigned m = 0; m < m_bmpInfo.imgWidth; ++m){
imgFile.read( (char*) &rgb , sizeof(rgb) );
std::swap(rgb.blue,rgb.red);
m_pixels.push_back( rgb );
}
}

You know if you haven't seen it, wiki has a article on it.
Padding is introduced, when you are done reading one image witdh. For example :

for(unsigned n = 0; n < m_bmpInfo.imgHeight; ++n){
for(unsigned m = 0; m < m_bmpInfo.imgWidth; ++m){