From: nah on
I have never done any image processing before. I would like to take a
grayscale bitmap image and convert it to a 2D array where each element
represents one of the image's pixel intensities. Would anyone be able to
steer me in the right direction? Thank you very much.
Nikolai.
From: Igor Tandetnik on
"nah" <nah(a)discussions.microsoft.com> wrote in message
news:EAF87A19-9030-4998-97D2-800293B070CA(a)microsoft.com
> I have never done any image processing before. I would like to take a
> grayscale bitmap image and convert it to a 2D array where each element
> represents one of the image's pixel intensities.

GetDIBits
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925


From: RodgeFu on
just open the bmp file and read it to a memory block m_lpBMP and then

m_lpBMPFileHeader=(BITMAPFILEHEADER*)m_lpBMP;
m_lpBMPInfoHeader=(BITMAPINFOHEADER*)(&m_lpBMPFileHeader[1]);
m_lpColorTable=(RGBQUAD*)(&m_lpBMPInfoHeader[1]);
m_lpDib=((char*)m_lpBMP+m_lpBMPFileHeader->bfOffBits);

the m_lpDib is what you want. Be careful that the width of Dib is always
n*32bit.
for example: if the bmp's depth is 1 and bmp's width is 21, the size of a
line of bmp is 1*21 = 21, but in memory it will still use 32bit to store a
line.

you can use

widthInDW=(m_lpBMPInfoHeader->biBitCount*m_lpBMPInfoHeader->biWidth +31) /32;

to get the size of a line in memory in dword

--
Hello World


"nah" wrote:

> I have never done any image processing before. I would like to take a
> grayscale bitmap image and convert it to a 2D array where each element
> represents one of the image's pixel intensities. Would anyone be able to
> steer me in the right direction? Thank you very much.
> Nikolai.
 | 
Pages: 1
Prev: xp error
Next: Socket Sink Notification