Mouse movement in OpenCV

I am trying to move the mouse cursor using the finger coordinate in opencv. I can not scale it to the full screen size, which is 1366 * 768. The resolution of the webcam is 640 * 480. My mouse pointer moves only half the screen. I do not know why.

this is a function call:

Mouse_Move(((1366*mouse_pointer.x)/640),((768*mouse_pointer.y)/480));

and this is the implementation:

void Mouse_Move(DWORD dx,DWORD dy)
{

DWORD event=0;

event = MOUSEEVENTF_ABSOLUTE|MOUSEEVENTF_MOVE;

mouse_event(event, dx*65535/Get_ScreenWidth(), dy*65535/Get_ScreenHight(), 0, 0);

} 

this is my code segment. mouse_pointer.x and mouse_pointer.y are the coordinates of my finger.

+3
source share

All Articles