Good Day!
I can't seem to find the right terms for what I want done in OpenCV. Here's the situation:
I have a grayscale image and color (BGR).
I want to 'apply' the color to the grayscale image but keeping the luma and save it afterwards.
My original thought process was:
- Convert BGR color to Luv
- Replace L from grayscale image
- Convert final image to BGR and save
This is what I've done so far:
cv::Mat pixelColor(1, 1, CV_8UC3, cv::Scalar(0));
pixelColor.at<cv::Vec3b>(1, 1) = cv::Vec3b(128, 255, 0); // currently hard-coded but it actually comes from another source
cv::cvtColor(pixelColor, pixelColor, CV_BGR2Luv);
pixelColor.at<cv::Vec3b>(1, 1)[0] = image.at<unsigned char>(y, x);
cv::cvtColor(pixelColor, pixelColor, CV_Luv2BGR);
I iterate over all y and x of my grayscale image. The actual color comes elsewhere but it's guaranteed to be BGR.
My questions are: (1) what's the proper term for this process? (2) where am I going wrong?