我用下面的方法想实现Bitmap 与 IplImage之间的转换,结果出现了问题,如果有谁会的话,还请指教下。本来应该发贴的,但是不知道发到哪个上面好,就写到这里了,以后自己有时间也可以研究下,^_^:
IplImage* m_IplImage;
Bitmap temp(m_IplImage->width,m_IplImage->height,PixelFormart24ppRGB);
DWORD pixel;
BYTE r,g,b;
for(int i = 0;i < m_IplImage->height;++i)
{
for(int j = 0;j < m_IplImage->width;++j)
{
pixel = i * m_IplImage->width * 3 + j * 3;
r = (BYTE)(m_IplImage->imageData[pixel]);
g = (BYTE)(m_IplImage->imageData[pixel + 1]);
b = (BYTE)(m_IplImage->imageData[pixel + 2]);
temp.SetPixel(j,i,RGB(b,g,r));
}
}
结果转换后图片是变成了灰色的(原来是彩色的),而且图片变歪了。
也不知道是怎么回事.