Is there a way to plot colored points (or rectangles) on a black and white image using OpenCV?
My image was typically created using CV_8UC1
: it's a 8 bits unsigned char
image.
Asked
Active
Viewed 574 times
0

herohuyongtao
- 49,413
- 29
- 133
- 174

PhonoDots
- 149
- 1
- 12
1 Answers
3
You need to convert the image to colored image (e.g. 3 channels) first in order to draw and display colors.
Mat img_rgb(img_gray.size(), CV_8UC3);
cvtColor(img_gray, img_rgb, CV_GRAY2RGB);
See a similar question openCV - draw color contours on greyscale image.

Community
- 1
- 1

herohuyongtao
- 49,413
- 29
- 133
- 174