0

I have a grayscale image in OpenCV represented by:

cv::Mat img_grayscale; 

It has one channel (0-255). I want to convert it into an RGB image where for each pixel, R=G=B=(0-255).

For the record: I am NOT trying to convert it to color; but, I want to be able to overlay it with colored text/images. So I need a grayscale image with RGB channels.

robeat
  • 61
  • 3
  • 1
    That seems like the easiest conversion ever; just create an RGB image of the same size and set R, G, and B to the gray value of each pixel. – Ed S. Feb 12 '15 at 06:12
  • Yeah, I know that's what I need to do. I just can't seem to figure out how to edit the cv::Mat per pixel. – robeat Feb 12 '15 at 06:16
  • have you tried to google it? `cvtColor` – tofi9 Feb 12 '15 at 06:17

0 Answers0