I am beginner in image processing. I am showing image in many color space the below code show the image in the 3 channels R G B however the image displayed in the gray layout. i need to display three images one with red channel as red image, another as blue, and the last one as green. thanks in advance.
# cspace.py
import cv2
import numpy as np
image = cv2.imread('download.jpg')
# Convert BGR to HSV
hsv = cv2.cvtColor(image, cv2.COLOR_BGR2HSV)
hsl = cv2.cvtColor(image, cv2.COLOR_BGR2HLS) # equal to HSL
luv = cv2.cvtColor(image, cv2.COLOR_BGR2LUV)
#RGB - Blue
cv2.imshow('B-RGB.jpg',image[:, :, 0])
cv2.imwrite('B-RGB.jpg',image[:, :, 0])
# RGB - Green
cv2.imshow('G-RGB',image[:, :, 1])
cv2.imwrite('G-RGB.jpg',image[:, :, 1])
# RGB Red
cv2.imshow('R-RGB',image[:, :, 2])
cv2.imwrite('R-RGB.jpg',image[:, :, 2])
cv2.waitKey(0)