Problems with cvSobel and cvLaplace functions under visual studio 2010
-
Hi, I have downloaded OpenCV 2.2.0 distribution for visual studio 2010 and as i started programming with the opencv APIs under VS 2010 I faced a terrible problem. cvSobel and cvLaplace functions always throw cv::Exceptions and also their exceptions could have not been handled with try ... catch blocks. the provided error is: Unhandled exception at 0x7463b727 in App.exe: Microsoft C++ exception: cv::Exception at memory location 0x003bfb9c. and here is my code:
IplImage* pImage = cvLoadImage("..\\Tulips.jpg");
IplImage\* pImage1 = cvCreateImage( cvSize(pImage->width, pImage->height), pImage->depth, pImage->nChannels ); IplImage\* pImage2 = cvCreateImage( cvSize(pImage->width, pImage->height), pImage->depth, pImage->nChannels ); cvSobel(pImage, pImage1, 0, 1, 2); cvLaplace( pImage, pImage2); cvNamedWindow("Image", CV\_WINDOW\_AUTOSIZE); cvShowImage("Image", pImage); cvNamedWindow("Image1", CV\_WINDOW\_AUTOSIZE); cvShowImage("Image1", pImage1); cvNamedWindow("Image2", CV\_WINDOW\_AUTOSIZE); cvShowImage("Image2", pImage2); cvWaitKey(0);
please, help me if I am forgetting sth.
-
Hi, I have downloaded OpenCV 2.2.0 distribution for visual studio 2010 and as i started programming with the opencv APIs under VS 2010 I faced a terrible problem. cvSobel and cvLaplace functions always throw cv::Exceptions and also their exceptions could have not been handled with try ... catch blocks. the provided error is: Unhandled exception at 0x7463b727 in App.exe: Microsoft C++ exception: cv::Exception at memory location 0x003bfb9c. and here is my code:
IplImage* pImage = cvLoadImage("..\\Tulips.jpg");
IplImage\* pImage1 = cvCreateImage( cvSize(pImage->width, pImage->height), pImage->depth, pImage->nChannels ); IplImage\* pImage2 = cvCreateImage( cvSize(pImage->width, pImage->height), pImage->depth, pImage->nChannels ); cvSobel(pImage, pImage1, 0, 1, 2); cvLaplace( pImage, pImage2); cvNamedWindow("Image", CV\_WINDOW\_AUTOSIZE); cvShowImage("Image", pImage); cvNamedWindow("Image1", CV\_WINDOW\_AUTOSIZE); cvShowImage("Image1", pImage1); cvNamedWindow("Image2", CV\_WINDOW\_AUTOSIZE); cvShowImage("Image2", pImage2); cvWaitKey(0);
please, help me if I am forgetting sth.
You cannot use any type of images with a sobel operator. If you use a 8U image as the source then the destination image needs to be 16S (not even 16U) because of some overflow issue then you can transform if back to 8U at will.