Opencv图像反转程序编译没错,运行时出现错误 0x7c812afb 处未处理的异常: Microsoft C++ 异常: 内存位置 0x0011f194 处的 cv::Exception。请各位大侠帮忙看看~~急,不胜感激
程序如下:
void CLoadImageDlg::OnReverse()
{
IplImage* pImg;
pImg = disp; int height,width,step,channels;
uchar *data;
data=(uchar *)pImg->imageData;
width =pImg->width;
height = pImg->height;
step = pImg->widthStep;
channels= pImg->nChannels;
int i,j,k; for(i=0;i<height;i++) for(j=0;j<width;j++) for(k=0;k<channels;k++) data[i*step+j*channels+k]=255-data[i*step+j*channels+k];
DrawPicToHDC(pImg,IDC_IMAGE);
Copy_result_to_disp(pImg);
cvReleaseImage( &pImg);

}