Visualizing the Different Color Channels of an RGB Image in Python using OpenCV¶
In [2]:
import cv2
img = cv2.imread('ocv2.png',1)
cv2.imshow('Machine Learning',img)
cv2.waitKey(0)
cv2.destroyAllWindows()
In [3]:
import cv2
img=cv2.imread("ocv2.png",1)
B, G, R = cv2.split(img)
print(B)
print(G)
print(R)
In [4]:
cv2.imshow("original", img)
cv2.waitKey(0)
cv2.destroyAllWindows()
In [5]:
cv2.imshow("blue", B)
cv2.waitKey(0)
cv2.destroyAllWindows()
In [6]:
cv2.imshow("Green", G)
cv2.waitKey(0)
cv2.destroyAllWindows()
In [7]:
cv2.imshow("red", R)
cv2.waitKey(0)
cv2.destroyAllWindows()