zinon
zinon

Reputation: 4664

OpenCV python: Show images in channel's color and not in grayscale

I read an rgb image

img = cv2.imread('image.jpg')

I split channels:

b,g,r = cv2.split(img)

When I'm trying to show red image I get a grayscale image. Can I see it in red?

cv2.imshow('Red image',r)

Upvotes: 3

Views: 4530

Answers (1)

Bull
Bull

Reputation: 11941

Make blue and green channels of all zeroes, and merge these with your red channel. Then you will see just the red channel displayed in red.

Or you could just set the b and g channels of the image to 0.

img[:,:,0] = 0
img[:,:,1] = 0

Upvotes: 5

Related Questions