I am trying to convert a color image to greyscale and then apply Red color on a specific region. I have tried:
Color Conversion
cv::Mat facadeColor = cv::imread("color.jpg");
cv::Mat facade;
cv::cvtColor(facadeColor, facade, cv::COLOR_BGR2GRAY);
Region Selection and Apply Solid Color
cv::Size s = facade.size();
int h = s.height;
int w = s.width;
cv::Point rook_points[1][4];
rook_points[0][0] = cv::Point( 0, h/2 );
rook_points[0][1] = cv::Point( 0, h );
rook_points[0][2] = cv::Point( w, h );
rook_points[0][3] = cv::Point( w, h/2 );
const cv::Point* ppt[1] = { rook_points[0] };
int npt[] = { 4 };
cv::fillPoly( facade, ppt, npt, 1, cv::Scalar( 0, 0, 255 ), 8 );
The problem I'm facing is that when the greyscale conversion is not performed, the fillPoly is filling correctly as red. But when the greyscale conversion is performed, the fillPoly output also comes as greyscale wheres it is expected to fill a specific region as RED.
I am so confused with it. Please help.