Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

OpenCV Error: Assertion failed (std::abs(dsize.width*2 - ssize.width) <= 2

Please help me with this. I am working on Opencv as beginner.I am using Dev C++ please help me with this error Message" OpenCV Error: Assertion failed (std::abs(dsize.width*2 - ssize.width) <= 2

&& st d::abs(dsize.height*2 - ssize.height) <= 2) in pyrDown_, file C:\User\VP

\ocv\ope ncv\src\cv\cvpyramids.cpp, line 206

This application has requested the Runtime to terminate it in an unusual

way. Please contact the application's support team for more information.


Process exited with return value 3 Press any key to continue . . ." ....

My written code is here :

include <cv.h>

include<highgui.h>

//..........Rosenfeld80.................

IplImage* doPyrDown(IplImage *in,int filter= IPL_GAUSSIAN_5x5){ //make sure that input image is divisible by two using assert(((int)in->width) % 2==0 && ((int)in->height) % 2==0); IplImage *out=cvCreateImage(cvSize(in->depth/2,in->height/2),in->depth,in->nChannels); cvPyrDown(in,out); return (out); }

//..........Canny edge detector [Canny86]............

IplImage * doCanny(IplImage* in, double lowThresh, double highThresh, double aperture){ if(in->nChannels !=1)// Canny works only with gray scale images return 0;
IplImage *out=cvCreateImage(cvGetSize(in),IPL_DEPTH_8U,1); cvCanny( in, out, lowThresh, highThresh, aperture ); return (out);
}

int main(int argc,char *argv){ IplImage out; IplImage* in=cvLoadImage("E:/Arshad/OpenCv/OpenCv Work/Penguins.jpg"); cvNamedWindow("Input",CV_WINDOW_AUTOSIZE); cvShowImage("Input",in); out =doPyrDown( in, IPL_GAUSSIAN_5x5 ); cvNamedWindow("doPyramidDown",CV_WINDOW_AUTOSIZE); cvShowImage("doPyramidDown",out); out = doPyrDown( out, IPL_GAUSSIAN_5x5 ); out = doCanny( out, 10, 100, 3 ); cvNamedWindow("doCanny",CV_WINDOW_AUTOSIZE); cvShowImage("doCanny",out); cvWaitKey(0); cvReleaseImage(&out); cvDestroyWindow("Input"); cvDestroyWindow("doPyramidDown"); cvDestroyWindow("doCanny");

}

click to hide/show revision 2
No.2 Revision

updated 2015-03-22 03:34:05 -0600

berak gravatar image

OpenCV Error: Assertion failed (std::abs(dsize.width*2 - ssize.width) <= 2

Please help me with this. I am working on Opencv as beginner.I am using Dev C++ please help me with this error Message" OpenCV Error: Assertion failed (std::abs(dsize.width*2 - ssize.width) <= 2

&& st d::abs(dsize.height*2 - ssize.height) <= 2) in pyrDown_, file C:\User\VP

\ocv\ope ncv\src\cv\cvpyramids.cpp, line 206

This application has requested the Runtime to terminate it in an unusual

way. Please contact the application's support team for more information.


Process exited with return value 3 Press any key to continue . . ." ....

My written code is here :

include <cv.h>

include<highgui.h>

//..........Rosenfeld80.................

#include <cv.h>
#include<highgui.h>


//..........Rosenfeld80.................


IplImage* doPyrDown(IplImage *in,int filter= IPL_GAUSSIAN_5x5){
    //make sure that input image is divisible by two using
    assert(((int)in->width) % 2==0 && ((int)in->height) % 2==0);
    IplImage *out=cvCreateImage(cvSize(in->depth/2,in->height/2),in->depth,in->nChannels);
    cvPyrDown(in,out);
    return (out);
}

} //..........Canny edge detector [Canny86]............

[Canny86]............ IplImage * doCanny(IplImage* in, double lowThresh, double highThresh, double aperture){ if(in->nChannels !=1)// Canny works only with gray scale images return 0;
IplImage *out=cvCreateImage(cvGetSize(in),IPL_DEPTH_8U,1); cvCanny( in, out, lowThresh, highThresh, aperture ); return (out);
}

} int main(int argc,char *argv){ IplImage **argv){ IplImage* out; IplImage* in=cvLoadImage("E:/Arshad/OpenCv/OpenCv Work/Penguins.jpg"); cvNamedWindow("Input",CV_WINDOW_AUTOSIZE); cvShowImage("Input",in); out =doPyrDown( in, IPL_GAUSSIAN_5x5 ); cvNamedWindow("doPyramidDown",CV_WINDOW_AUTOSIZE); cvShowImage("doPyramidDown",out); out = doPyrDown( out, IPL_GAUSSIAN_5x5 ); out = doCanny( out, 10, 100, 3 ); cvNamedWindow("doCanny",CV_WINDOW_AUTOSIZE); cvShowImage("doCanny",out); cvWaitKey(0); cvReleaseImage(&out); cvDestroyWindow("Input"); cvDestroyWindow("doPyramidDown"); cvDestroyWindow("doCanny");

}

cvDestroyWindow("doCanny"); }