opencv imread not found或imread not return value [imread(argv [1],CV_LOAD_IMAGE_COLOR); ]

时间:2013-11-12 07:39:04

标签: opencv

opencv imread not found或imread not return value。 imread不返回值或在Opencv中提供错误imread NOT FOUND(visual Studio 2010)

Mat image;
image = imread(argv[1], CV_LOAD_IMAGE_COLOR);   // Read the file

if(! image.data )                              // Check for invalid input
{
    cout <<  "Could not open or find the image" << std::endl ;
    return -1;
}

namedWindow( "Display window", CV_WINDOW_AUTOSIZE );// Create a window for display.
imshow( "Display window", image );                   // Show our image inside it.

waitKey(0);                                          // Wait for a keystroke in the window
return 0;

}

1 个答案:

答案 0 :(得分:2)

确保图像文件格式是受支持的类型之一(http://docs.opencv.org/modules/highgui/doc/reading_and_writing_images_and_video.html#imread)。还要确保作为参数给出的文件路径是正确的。你也可以用drag&amp;将图像放在可执行文件上。