开发者

Camera input as Mouse(Motion Tracking)

I have been developing a project which use web cam as source of input to imitate as mouse event on mac. I'm always handle with opencv for image processing and Qt framework for GUI framework.

My problem is, I want to write a program which imitates mouse. I don't know how to control a mouse out of the window form and sent开发者_Python百科 the interrupt to the operating system. Is there any simple code? or could any one give me some hint?


One option is to use X11's XTEST extension and other Xlib functions.

To enable this on a mac read the answer from this question: Does Mac X11 have the XTEST extension?

defaults write org.x.X11 enable_test_extensions -boolean true

Here is a tool already built using this technology called xdotool.

UPDATE: Another option could be to use the built-in Automator tool.


For modern Operating Systems, a mouse is a fundamental input device. As such it's handled by a driver in the OS. There the mouse is tied closely to the pointer. For programmers like you, it's important to get the distinction between mouse and pointer right. It sounds like you actually want to control the pointer, not the mouse.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜