Using OpenCV, I am detecting a face, detecting the left and right eyes of that face, and extracting the eye into a new Mat image. I am then converting the eye image colour from BGR to HSV.
I am checking to see if the eye colour is in a certain range using inRange(). This displays the area of the eye that is red (see below image).
My question is: I would like to change the eye colour (detected using inRange()) from red to black. I'm not too sure where to go from here.
Any help is appreciated! Thanks!
Current result:
You can do this with the following for loop if you want to make the eyes blue for instance
cv::Vec3b pixelColor(255,0,0);
for(int y=0;y<img.rows;y++){
for(int x=0;x<img.cols;x++){
cv::Point2f point(x, y);
if (mask.at<uchar>(point)) image.at<Vec3b>(cv::Point(x,y)) = pixelColor;
}
}