- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How can I display an image using cv2 in Python?
To read an image in Python cv2, we can take the following steps−
- Load an image from a file.
- Display the image in the specified window.
- Wait for a pressed key.
- Destroy all of the HighGUI windows.
Example
import cv2 img = cv2.imread("baseball.png", cv2.IMREAD_COLOR) cv2.imshow("baseball", img) cv2.waitKey(0) cv2.destroyAllWindows()
Output
Advertisements