2013-04-08 1 views
0

다음 코드OpenCV의 이미지는 내가 표시된 이미지를 얻을하지 않습니다, 나는이 코드를 실행하면

#include <opencv2\core\core.hpp> 
#include <opencv2\highgui\highgui.hpp> 
#include <iostream> 

using namespace std; 
using namespace cv; 

int main() 
{ 
    Mat image; 

    try 
    { 
     image = imread("C:/Users/Public/Pictures/Sample Pictures/Chrysanthemum.jpg"); 

     if(!image.data) 
     { 
      throw 1; 
     } 

     cout << "Height: " << image.size().height << " Width: " << image.size().width << endl; 
    } 
    catch(int error) 
    { 
     cout << "This message does not exists" << endl; 
     exit(0); 
    } 

    namedWindow("Image 1"); 
    imshow("Image 1",image); 


    system("pause"); 
    return 0; 
} 

에서 참조하시기 바랍니다 표시지고 있지 않습니다. 대신 빈 이미지가 표시됩니다. 왜 그런가요? 도와주세요.

답변

2

창을 새로 고침해야합니다. 시스템 ("일시 중지")이 실행하지 않습니다. opencv 해당 항목은 입니다. waitKey (0);

+1

와우. 감사! –

관련 문제