20 lines
590 B
Python
20 lines
590 B
Python
import cv2
|
|
import numpy as np
|
|
|
|
# Load the image
|
|
img = cv2.imread('Image.jpg')
|
|
|
|
# Split the image into its RGB channels
|
|
b, g, r = cv2.split(img)
|
|
# e = np.zeros((100, 100), dtype=np.uint8)
|
|
# red_merged = cv2.merge((e, e, r))
|
|
# Display the individual channels
|
|
cv2.imshow('Red channel', r)
|
|
# cv2.imshow('Red channel 2', red_merged)
|
|
cv2.imshow('Green channel', g)
|
|
cv2.imshow('Blue channel', b)
|
|
cv2.waitKey(0)
|
|
cv2.destroyAllWindows()
|
|
|
|
# Note that the individual channels are displayed in grayscale because they represent the intensity values of a single color (red, green, or blue) in the image.
|