Thanks to visit codestin.com
Credit goes to www.tutorialspoint.com

Read Image in Python using OpenCV



To read an image in Python OpenCV, 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

Updated on: 2021-05-15T12:24:17+05:30

938 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements