Last active
September 29, 2020 23:40
-
-
Save doron2402/fcb5ae1fd47023347da2908043b22cff to your computer and use it in GitHub Desktop.
OpenCV2 read image and show different colors
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import cv2 | |
img = cv2.imread('./<LINK TO YOUR IMAGE>') | |
# [x, y, color] | |
# colors are [blue, green, red] | |
blue = img[:,:,0] | |
green = img[:,:,1] | |
red = img[:,:,2] | |
# Show image | |
cv2.imshow('Image', img) | |
cv2.imshow('Blue Colors', blue) | |
cv2.imshow('Green Colors', green) | |
cv2.imshow('Red Colors', red) | |
cv2.waitKey(0) | |
cv2.destroyAllWindows() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment