Ask Your Question

Revision history [back]

The error you got was due to the fact that you worked with src image, which is a multi channels image. If you change the line:

src.copyTo( dst, detected_edges);

to:

src_gray.copyTo( dst, detected_edges);

the error gone. In case you wish to do the dft with a multi channels image, you have to proceed with each channel individually, and merge the results to get what you want. Plus, you should check if the image was opened before carrying out any operation on it:

if( !src.data )
{
     printf("Can not read input picture");
     return -1;
}
resize(src, src, Size(), 0.2, 0.2, INTER_LANCZOS4);