Ask Your Question
0

Run time error: R6010 abort () called:

asked 2013-05-02 13:12:32 -0500

zits gravatar image

updated 2013-05-02 13:15:17 -0500

berak gravatar image

I am new to opencv.. I have this simple code:

//Header files
using namespace std;
using namespace cv;

int main()
{

    Mat image;  Mat templ;
    Mat result;
    int method = CV_TM_SQDIFF; 

    namedWindow( "result_window", CV_WINDOW_AUTOSIZE );

    image = imread ("Image.png", 1 );
    templ = imread ("template_m.png",1 ) ;

void matchTemplate (Mat image, Mat templ, Mat result, int method);

 imshow ( "result_window", result );
return 0;
}

But when i compile it it says abort() is called. Can anyone tell me what is the reason ??

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2013-05-02 13:21:00 -0500

berak gravatar image

instead of :

void matchTemplate (Mat image, Mat templ, Mat result, int method);

you probably wanted :

matchTemplate(image, templ, result, method);

the former is not doing anything, it's a (useless)declaration, not a function call.

so your result Mat is empty, and imshow does not like it.

also please throw in a waitKey(0) between imshow() and return, else you won't see anything

edit flag offensive delete link more

Comments

Thanks it worked :)

zits gravatar imagezits ( 2013-05-02 13:30:46 -0500 )edit

pleasure ;)

berak gravatar imageberak ( 2013-05-02 13:34:32 -0500 )edit

If it has worked, why isn't it this considered answered?

Prasanna gravatar imagePrasanna ( 2013-06-20 15:50:39 -0500 )edit

Question Tools

Stats

Asked: 2013-05-02 13:12:32 -0500

Seen: 3,611 times

Last updated: May 02 '13