-1

opencv imread not found 或 imread 没有返回值。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;

}

4

1 回答 1

2

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

于 2013-11-12T08:35:50.947 回答