how to get the pixel value by clicking on image?
Hi all, I am able to get the pixel coordinate by clicking on image with setmousecallback function. I want to return the pixel value of that coordinate. But I am getting some error. Please, check the below code. xyz matrix contain the depth information. Thank you.
setMouseCallback("cascade_image", onMouse, &rxyz);
static void onMouse(int event, int i, int j, int flags, void* param, Mat &xyz)
{
if (event == EVENT_LBUTTONDOWN)
{
short val = xyz.at< short >(i,j);
cout << "x= " << i << " y= " << j << "val= "<<val<< endl;
}
}