I am working on a photo measurement project in Visual Studio 2010 (C++) with openCV 2.4. What I need to do is to be able to click ANYWHERE on the photo and save the x and y coordinates of my mouse event. Seems simple. However, let's say, for example, my photo is 1920 x 1080. If I try to click the bottom right corner of the image (even zoomed in with a magnifier clicking) I can only click the edge point (1916,1078). If I expand the image it seems to be able to click farther out which makes me think something isn't right. Here are the main parts of my code.
Part that creates the window and sets the callback function
// create a window
cvNamedWindow( "mainWin", CV_WINDOW_NORMAL );
// set mouse callback
cvSetMouseCallback("mainWin", onMouse);
// show the image
cvShowImage("mainWin", img );
// wait for a key
cvWaitKey(0);
// release the image
cvReleaseImage(&img );
onMouse event
void onMouse(int event, int x, int y, int flags, void *param){
switch(event){
case CV_EVENT_LBUTTONDOWN: //single click
char Char_Array[20];
sprintf(Char_Array,"Click: %d, %d", x,y);
MessageBoxA(NULL, Char_Array, "ERROR", MB_TASKMODAL | MB_OK);
}
Seems like it should be pretty straight forward. Any ideas as to why I can't access the 1920th column or the 1080th row?