IplImage* img=cvLoadImage(imageName);
cout<
for(int y=0;y
{
unsigned char* p=(unsigned char*)(img->imageData+y*img->widthStep);
for(int x=0;x
{
printf("%d ",p[x]);
}
}
你为什么要改为int型呢,存储的是char,你使用int型导致寻址方式改变,访问了越界的内存。另外,你确定你的图像是单通道图像么?
用CV_IMAGE_ELEM(src,uchar,y,x)