C++ 生成二维数数组 三维数组
参考链接: http://blog.163.com/wujiaxing009@126/blog/static/7198839920117252550574/
typedef struct _ImageData
{
int nWidth;//图像宽(像素)
int nHeigth;//图像高(像素)
int Depth;//图像位数(R、G、B三层)
BYTE ***imageDataScr;//存储1或3通道图片数据指针(jpg,png,bmp等),存储了1或3个矩阵
}ImageData;
//生成depth个指向二维数组的指针
BYTE ***imgDataScr = new BYTE **[IamgeDepth];
BYTE **pMatrix = NULL;
if (!imgDataScr)
MessageBox(NULL,L"calloc Bad!",L"Erro",0);
for (int i = 0;i < IamgeDepth;i++)
{
//生成一个二维数组
pMatrix = new BYTE *[ImageHeight];
for (int nHeigth = 0;nHeigth < ImageHeight;nHeigth++)
pMatrix[nHeigth] = new BYTE[ImageWidth];
//保存每一个二维指针数组地址
imgDataScr[i] = pMatrix;
}
m_ImageData.imageDataScr = imgDataScr;声明:该文观点仅代表作者本人,入门客AI创业平台信息发布平台仅提供信息存储空间服务,如有疑问请联系rumenke@qq.com。
- 上一篇:没有了
- 下一篇:没有了
