Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

[answer to updated code]

tried your code, and the answer is simple: it just did not find one (or both) of your images.

(amazing, that it made it past the detection stage like this)

so, whenever you load external resources, check them, please !

image1 = imread("1.jpg",0);
if ( image1.empty() )
{ 
    cerr << "bad image : " << "1.jpg" << " !" <<  endl;
    return 1;
}
// same for image2, ofc.

if you use a path like "1.jpg", that assumes, the image is in the same folder, where your program starts (the debug folder ?)

using an absolute path like "c:/lala/lalalala/1.jpg" avoids that situation