Himz
Himz

Reputation: 523

right click event in opencv

I am developing a computer vision program using OpenCV (IDE = devcpp). I am able to get the hand contour , move cursor position according to our our hand. i want to implement right click functionality .Please help me with it .

i am using event SetCursorPos(x,y) to set the cursor position on the screen. is there any simple function to implement rightclick the same way .??

Upvotes: 1

Views: 2096

Answers (1)

jhaip
jhaip

Reputation: 150

Maybe this will help: http://www.codeguru.com/forum/showthread.php?t=377394

void RightClick ( )
{  
  INPUT    Input={0};
  // right down 
  Input.type      = INPUT_MOUSE;
  Input.mi.dwFlags  = MOUSEEVENTF_RIGHTDOWN;
  ::SendInput(1,&Input,sizeof(INPUT));

  // right up
  ::ZeroMemory(&Input,sizeof(INPUT));
  Input.type      = INPUT_MOUSE;
  Input.mi.dwFlags  = MOUSEEVENTF_RIGHTUP;
  ::SendInput(1,&Input,sizeof(INPUT));
}

And to use:

RightClick();

The link shows examples for left clicking, mouse move, etc. too.

Upvotes: 1

Related Questions