Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

If I understand correctly, you have a 16 bit image, I, and want to "tint it" so that R= a*I/255, G=b*I/255, G=c*I/255. What you could do is to use:

   I.convertTo(R, CV_8UC1, a/255, 0);
   I.convertTo(G, CV_8UC1, b/255, 0);
   I.convertTo(B, CV_8UC1, c/255, 0);

and then merge R,G, B into a color image

std::vector<cv::Mat> array_to_merge;
array_to_merge.push_back(B);
array_to_merge.push_back(G);
array_to_merge.push_back(R);
cv::merge(array_to_merge, Dest);

Do not use pixel operations if you can avoid them.

guy