Trying to determine value of pixels found at certain coordinates [closed]
So I found coordinates of pixels based on blob detection, and I need to determine whether or not these pixels are within a certain hsv range. I have done this before with nested for loops successfully, but I can't figure out how to feed the pixels both coordinates instead of just going through every single pixel in the picture.
vector<Point2f> coor;
//populate vector
Vec3b* hsv = output.ptr<Vec3b>(img.rows, img.cols);
for(int I = 0; I < coor.size(); I++) {
Point2f j = coor[I];
uchar h = hsv[j][2];
uchar s = hsv[j][1];
uchar v = hsv[j][0];
//check ranges
}
My errors basically just say there's no match for these operands (related to the j). I have had no luck with google or my own ideas.
Update: I have fixed it. Proper context is:
int h = img.at<Vec3b>(j.y, j.x).val[2];
int s = img.at<Vec3b>(j.y, j.x).val[1];
int v = img.at<Vec3b>(j.y, j.x).val[0];
you cannot index a pointer value with a (2d) point (that's a plain c++ problem, not an opencv one)
again, not an opencv problem, but simply lack of proramming skill
use:
output.at<Vec3b>(j)
instead.Tried that, and I'm not getting any values.
also:
output.ptr<Vec3b>(img.rows, img.cols);
points outside your image.