How can i access only the pixels of specific part of the image ? Is there any proper method of accessing those or i need to use hit and trial
method for it .
For example i want to access all the pixels within the circle ( this circle is just draw for understanding)
will not have it in real problem.
I want to access only these pixels for changing values , one way which just come to mind is
getting the four corners of image
vector<Point> corners(4);
corners[0] = Point(0, 0);
corners[1] = Point(my_img.width, 0);
corners[2] = Point(0, my_img.height);
corners[3] = Point(my_img.width, my_img.height);
then find its center
Point center = Point(my_img.size().width/2, my_img.size().height/2);
make radius
double radius = 2.0;
and then put new values inside of radius or circle
image.at<cv::Vec3b>(row,col)[0] = newval[0]; //B
image.at<cv::Vec3b>(row,col)[1] = newval[1]; //G
image.at<cv::Vec3b>(row,col)[2] = newval[2]; //R
but then how to access pixels inside it (need solution which work for all images not only for this specific) , or any other logic or idea is appriciated