1 | initial version |
Basically like Guanta just suggested, place
waitKey(20);
behind the imshow. It makes sure that the draw and update function of the window are properly called before closing down the window. Place a 0 if you want the window only to close when pressing a key.
2 | extra info |
Basically like Guanta just suggested, place
waitKey(20);
cv::Mat img = cv::imread("C:/test/R0010054.JPG"); //it is better to use absolute paths first
if(img.empty())
{
cout << "Image not loaded";
return -1; //i guess this isn't throwed, add a print statement none the less
}
cv::imshow("image", img);
waitKey(0); //time added here counts in milliseconds --> needed for processing
behind the imshow. It makes sure that the draw and update function of the window are properly called before closing down the window. Place a 0 if you want the window only to close when pressing a key.
Some more tips
3 | No.3 Revision |
Basically like Guanta just suggested, place a waitKey command
cv::Mat img = cv::imread("C:/test/R0010054.JPG"); //it is better to use absolute paths first
if(img.empty())
{
cout << "Image not loaded";
return -1; //i guess this isn't throwed, add a print statement none the less
}
cv::imshow("image", img);
waitKey(0); //time added here counts in milliseconds --> needed for processing
behind the imshow. It makes sure that the draw and update function of the window are properly called before closing down the window. Place a 0 if you want the window only to close when pressing a key.
Some more tips