다음은 코드입니다. 나는 그 문제가 뭔지 모른다. 동일한 코드가 다른 컴퓨터에서 완벽하게 작동합니다. 데스크톱, 익스프레스 에디션, 여러 번 Visual Studio 2012를 다시 설치했으며 OpenCV 자체를 여러 번 다시 설치했습니다.OpenCV, C++ Visual Studio에서 이미지를 읽을 수 없습니다.
프로그램을 디버깅 할 때 img
은 항상 비어 있습니다.
현재 개발 환경 (WIZ : Windwos 8.1, OpenCV 2.4.9)에서이 코드를 작동 시키려면 어떻게해야할까요?
int main(int argc, const char** argv)
{
Mat img = imread("My_Image.jpg",1); //read the image data in the file "MyPic.JPG" and store it in 'img'
if (img.empty()) //check whether the image is loaded or not
{
cout << "Error : Image cannot be loaded..!!" << endl;
//system("pause"); //wait for a key press
return -1;
}
namedWindow("MyWindow", CV_WINDOW_AUTOSIZE); //create a window with the name "MyWindow"
imshow("MyWindow", img); //display the image which is stored in the 'img' in the "MyWindow" window
waitKey(0); //wait infinite time for a keypress
destroyWindow("MyWindow"); //destroy the window with the name, "MyWindow"
return 0;
}
내 자신의 OpenCV를 컴파일 한 다음 디버그 기호를 사용하여 원인을 알 수 있습니다.
현재 문제가있는 곳을 알아낼 수 없습니다 : VS 또는 OpenCV이지만 다른 코드는 VS에서 작동하는 것 같습니다.
문제를 해결 했습니까? 나는'highgui '가 파일 읽기를 처리하는 것이라고 생각한다. –