I have written an openCV code and my code has following statement:
cv::imshow("Matches", matchesImg);
cv::waitKey(0);
When I run the code either in Debug or Release I am not able to see window which shows me the output.
And this is happening for every project I create.
Not able to figure out the reason, Can someone please guide me on this?
I am coding on Windows 7 and Visual studio 2010, with opencv version of 2.4.6
You can try the following: Download and install the latest version of python. Restart your terminal. Create a new virtualEnv and install dependencies, check the script below.
cv2. imshow() method is used to display an image in a window. The window automatically fits to the image size. Syntax: cv2.imshow(window_name, image)
4. cv2. waitKey() This function is very important, without this function cv2.
As I mentioned in the comments, you have to create a window first, using namedWindow
with the same window name as in imshow
See this tutorial for details.
EDIT
This strongly suggest that you have to create the window beforehand. Some may argue that it didn't work this way for previous versions of OpenCV. Then, let's say this solution apply at least to OpenCV 2.4.6, which is the version of concern here (and it solved the problem).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With