How to keep an OpenCV window open after imshow?
Nov 12, 2019
asked by anonymous
Question / Issue:
Below is my C Code for OpenCV to show a window. How do I keep it open, so I can screen capture it?
cv::namedWindow( "img", cv::WINDOW_AUTOSIZE );
cv::imshow( "img", img );
cv::waitKey( 0 );
cv::destroyWindow( "img" );
Responses:
Date: Nov. 12, 2019
Author: Mind Chasers
Comment:
Try the solution below and then kill the app when you're ready to close the window (e.g., Ctrl+C)
cv::namedWindow( "img", cv::WINDOW_AUTOSIZE );
cv::imshow( "img", img );
cv::waitKey( 0 );
//cv::destroyWindow( "img" );
while(1) {
}