Ask Your Question

Revision history [back]

You should check your imread returned value:

if( sourceImage.empty() )
{
    cerr << "Unable to load image" << endl;
    return -1;
}

It's probably wrong, as you have to escape \ character under C/C++:

sourceImage = imread("C:\\2.jpg", 1 );