Ask Your Question

How do I convert a single channel monochrome image to 3 channel gray scale?

asked 2018-12-28 12:20:31 -0500

mdresser gravatar image

I want to use color to annotate a monochrome image.

As I understand it, first I need to convert the single channel monochrome image to a 3 channel gray scale image with BGR channels all set the same. Then I can overlay color annotations on the gray scale image.

It is the first part that has me stumped: It seems like .clone, .copyTo, cvtColor all force the output to the same number of channels as the input?

How do I create a 3 channel copy of a single channel image?

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted

answered 2018-12-28 12:24:20 -0500

LBerger gravatar image

updated 2018-12-28 12:25:11 -0500

use COLOR_GRAY2BGR with cvtColor method

edit flag offensive delete link more


alternatively, have a look here and here

berak gravatar imageberak ( 2018-12-28 13:11:33 -0500 )edit

Thanks for the quick response. Using cvtColor did the trick. I was confused!

mdresser gravatar imagemdresser ( 2018-12-29 10:39:29 -0500 )edit

Question Tools

1 follower


Asked: 2018-12-28 12:20:31 -0500

Seen: 4,485 times

Last updated: Dec 28 '18