Skip to content

Instantly share code, notes, and snippets.

@vsanse
Last active August 13, 2017 13:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vsanse/5e501a1a6baeafb51c9b2d0470dbe3a9 to your computer and use it in GitHub Desktop.
Save vsanse/5e501a1a6baeafb51c9b2d0470dbe3a9 to your computer and use it in GitHub Desktop.
import cv2
# loading as default colored image
img1 = cv2.imread("watch.jpg")
# loading image as grayscale image
img2 = cv2.imread('watch.jpg', cv2.IMREAD_GRAYSCALE)
#IMREAD_COLOR=1,IMREAD_UNCHANGED=-1,IMREAD_GRAYSCALE=0
#loading unchanged image
img3 = cv2.imread('watch.jpg', cv2.IMREAD_UNCHANGED)
# showing images
cv2.imshow('COLORED_IMAGE', img1)
cv2.imshow('GRAYSCALE_IMAGE', img2)
cv2.imshow('UNCHANGED_IMAGE', img3)
# output window wait infinitely for a key press
cv2.waitKey(0)
# closes all output windows on keypress
cv2.destroyAllWindows()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment