从网上搜索了一大推关于如何提取CXIMAGE库的像素的资料,结果没有找到令人满意的方法。没办法,只好老老实实从CXIMAGE类的接口里去寻找解决的办法。经过一番搜寻,终于找到了一根救命稻草:GetBits;于是,就有了接下来的一连串实现步骤:
1. /* 为矩阵申请内存空间*/
int width = m_pImage->GetWidth();
int height = m_pImage->GetHeight();
int BytesPerLine = (width + 3) / 4 * 4; // 只对8位图像
if (m_pImage->GetBpp() != 8)
{
return false;
}
m_pPixelMatrix = new BYTE*[height];
if (m_pPixelMatrix == NULL)
{
delete m_pPixelMatrix;
return false;
}
for (int i = 0; i<height; i++)
{
m_pPixelMatrix = new BYTE[width];
if (m_pPixelMatrix
Cximage 提取像素数据
最新推荐文章于 2025-05-31 11:53:08 发布