用vs2013运行一个图象拼接程序为什么运行时出来这个错误。
0x00007FF8B7D0A388 处(位于 ConsoleApplication1.exe 中)有未经处理的异常: Microsoft C++ 异常: cv::Exception,位于内存位置 0x000000E63396EBA0 处。
下面为主函数代码。
- int main()
- {
- //CvCapture* capture[4];//定义视频捕获变量
- IplImage* frame[4];//定义每帧图像的存储变量
- IplImage* frameT[4];//定义每帧图像转置后的存储变量
- //int a = frame[1]->height;
- //int b = frame[2]->height;
- //int c = frame[3]->depth;
- //int d = frame[4]->nChannels;
- Mat fra_image[4];
- fra_image[0] = imread("out1cam1.JPG");
- fra_image[1] = imread("out1cam2.JPG");
- fra_image[2] = imread("out1cam3.JPG");
- fra_image[3] = imread("out1cam4.JPG");
- for (int i = 0; i < 4; i++)
- {
- frame[i] = &IplImage(fra_image[i]);
- }
- for (int i = 0; i < 4; i++)//变量初始化
- {
- //capture[i]=cvCreateCameraCapture(i);
- //frame[i] = cvQueryFrame(capture[i]);
- frameT[i] = cvCreateImage(cvSize(frame[i]->width, frame[i]->height), frame[i]->depth, frame[i]->nChannels); // cvSize(frame[i]->width, frame[i]->height), frame[i]->depth, frame[i]->nChannels
-
- }
- cvNamedWindow("Panoramas",CV_WINDOW_NORMAL);//创建显示窗口
- for (int i,f = 1;;f++)
- {
- /**************读取4张图像,转置后显示**************/
- for(i=0;i<4;i++)
- {
- //frame[i] = cvQueryFrame(capture[i]);
- frame[i] = &IplImage(fra_image[i]);
- if (!frame[i]) {
- cout << "No frame!" << endl;
- break;
- }
- cvTranspose(frame[i], frameT[i]);
- cvFlip(frameT[i], NULL, 1); // cvFlip(frameT[i], frameT[i], 1);
- cvSetImageROI(window, cvRect(400 * i, 0, 360, 640));
- cvResize(frameT[i], window);
- cvResetImageROI(window);
- }
- /**********如果按下Esc键或图像为空,那么退出程序***********/
- char c = cvWaitKey(1);
- if (i != 4 || c == 27)
- {
- cvReleaseVideoWriter(¶_writer);
- cvReleaseVideoWriter(&win_writer);
- break;
- }
- /**************进行图像拼接,并显示全景图**************/
- Mat imgs[4] = { frameT[0], frameT[1], frameT[2], frameT[3] };
- if (f == 1)
- {
- int r=InitPara(imgs);//拼接第一帧全景图并显示
- if (r==0)
- cout <<"Panorama " << f << " Stitching Success!" << endl << endl;
- else
- cout << "Stitching error!!!" << endl << endl;
- }
- else
- {
- int r=OtherParas(imgs);//拼接非第一帧全景图并显示
- if (r==0)
- cout <<"Panorama " << f << " Stitching Success!" << endl << endl;
- else
- cout << "Stitching error!!!" << endl << endl;
- }
- }
- return 0;
- }
复制代码 在cvFlip(frameT, NULL, 1); 这条语句中断
|