Incorrect Y mouse coordinate in mouse callback?

asked 2015-02-18 11:17:49 -0600

Hi, I am experiencing some strange behavior with the mouse coordinates with the mouse callback using highgui to create the named window (created with CV_WINDOW_AUTOSIZE).

Indeed there seem to be a discrepancy between the Y value of the mouse pointer and the one I get from the mouse callback function (the Y mouse coordinate returned by the callback is smaller than the expected one).

Interestingly this discrepancy is different depending on the size of the displayed image in the named window and depending on the position of the mouse pointer. If the pointer Y coordinate is close to 0 the difference is much greater than when the mouse position is close to the "bottom" of the image, see images below. image description image description

Moreover there is an area near the window title bar (basically just above where the mouse is in the first image) where the mouse is still over the image but its position is not intercepted by the callback. Basically it is like the 0 0 of the image is several pixels lower than where it should be and that there is some kind of scaling applied to the Y coordinate of the mouse.

Any idea why this happens and how to solve it please?

Jim

edit retag flag offensive close merge delete