Learn Before
Displaying Images
Displaying images in OpenCV is very simple and straightforward, simply call the imshow method, pass in the first parameter which is the window name and the second parameter which is the cv object name.
cv2.imshow('Image', img)
It is also common practice to include the waitkey method after loading an image or video to specify how long the image will be available for before the window is closed.
cv2.waitkey(0)
The integer value specifies the amount of time until the window is closed. Time is measured in seconds and a value of 0 means unlimited time. This means that it will wait until the user inputs a command (press a button) before continuing. If a non zero value, is used i.e 5, then the method will wait 5 seconds before destroying all windows. A button press would just immediately move to the next step.
After creating windows, window objects should be destroyed if they are no longer needed.
cv2.destroyAllWindows()
This will destroy all windows created before this method was called.
0
1
Tags
Python Programming Language
Data Science