定义了一个图像数组,并分配了空间,可是调用时发现图像参数改变了,请问这是为什么啊? 10
I_CS=static_cast<IplImage***>(calloc(3,sizeof(IplImage**)));RG_CS=static_cast<IplImag...
I_CS=static_cast<IplImage***>(calloc(3,sizeof(IplImage**)));
RG_CS=static_cast<IplImage***>(calloc(3,sizeof(IplImage**)));
BY_CS=static_cast<IplImage***>(calloc(3,sizeof(IplImage**)));
for(int i=0;i<3;i++)
{
I_CS[i]=static_cast<IplImage**>(calloc(2,sizeof(IplImage*)));
RG_CS[i]=static_cast<IplImage**>(calloc(2,sizeof(IplImage*)));
BY_CS[i]=static_cast<IplImage**>(calloc(2,sizeof(IplImage*)));
}
for(int i=0;i<3;i++)
{
for(int j=0;j<2;j++)
{
I_CS[i][j]=cvCreateImage(cvSize(img->width,img->height),img->depth,1);
RG_CS[i][j]=cvCreateImage(cvSize(img->width,img->height),img->depth,1);
BY_CS[i][j]=cvCreateImage(cvSize(img->width,img->height),img->depth,1);
}
}
更奇怪的是I_CS和BY_CS都好用,没有问题,但是RG_CS在运行的时候就发生改变了,本来应该是:
+ RG_CS[i-2][j-3] 0x00a67920 {nSize=112 ID=0 nChannels=1 ...} _IplImage *
却变成了:
+ RG_CS[i-2][j-3] 0x00aeaf50 {nSize=22 ID=0 nChannels=89 ...} _IplImage * 展开
RG_CS=static_cast<IplImage***>(calloc(3,sizeof(IplImage**)));
BY_CS=static_cast<IplImage***>(calloc(3,sizeof(IplImage**)));
for(int i=0;i<3;i++)
{
I_CS[i]=static_cast<IplImage**>(calloc(2,sizeof(IplImage*)));
RG_CS[i]=static_cast<IplImage**>(calloc(2,sizeof(IplImage*)));
BY_CS[i]=static_cast<IplImage**>(calloc(2,sizeof(IplImage*)));
}
for(int i=0;i<3;i++)
{
for(int j=0;j<2;j++)
{
I_CS[i][j]=cvCreateImage(cvSize(img->width,img->height),img->depth,1);
RG_CS[i][j]=cvCreateImage(cvSize(img->width,img->height),img->depth,1);
BY_CS[i][j]=cvCreateImage(cvSize(img->width,img->height),img->depth,1);
}
}
更奇怪的是I_CS和BY_CS都好用,没有问题,但是RG_CS在运行的时候就发生改变了,本来应该是:
+ RG_CS[i-2][j-3] 0x00a67920 {nSize=112 ID=0 nChannels=1 ...} _IplImage *
却变成了:
+ RG_CS[i-2][j-3] 0x00aeaf50 {nSize=22 ID=0 nChannels=89 ...} _IplImage * 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询