how to replace pygame mouse event with motion coordinates which we get from opencv video capture ?

asked 2019-01-27 23:35:11 -0500

AdigTiwari gravatar image

HI Team,

I have created a program which control the particle system based on the pygame event mouse. Its like, where ever the mouse pointer goes the particles starts running from that position. I want to change the mouse moment with the hand moment . For doing that I have detected the motion using opencv videocap and got the centroid of the blob. But I am unable to replace mouse position with the centroid position. Could you please guide me on this ?

edit retag flag offensive close merge delete


Did you install pyautogui? As I am attempting to work with picamera.

supra56 gravatar imagesupra56 ( 2019-01-28 08:09:47 -0500 )edit

pyautogui is used to control mouse from handgesture. I have used that but over here I need to control particles (like bubbles or balls) with handgesture.. I am able to do that with mouse control but not able to do with handgesture.

AdigTiwari gravatar imageAdigTiwari ( 2019-01-28 08:22:46 -0500 )edit

OIC. I have that on my files dating back to 2015-2017. Btw, I am using raspberry pi 3B+ using linux.

supra56 gravatar imagesupra56 ( 2019-01-28 09:07:18 -0500 )edit

Please share me the file or let me know how to find that file ?

AdigTiwari gravatar imageAdigTiwari ( 2019-01-28 10:57:32 -0500 )edit

Hi @supra56, I have found out a way for it and now it is working. But its very lagging. Do you have any idea how to increase the frame rate ?

AdigTiwari gravatar imageAdigTiwari ( 2019-01-28 12:30:03 -0500 )edit

@AdigTiwari. I have hand gesture. It is lastest one but more advanced than old one. here is code:

cap.set(cv2.CAP_PROP_FPS, 60)
supra56 gravatar imagesupra56 ( 2019-01-28 12:45:28 -0500 )edit

@supra56, This doesn't work for me.

AdigTiwari gravatar imageAdigTiwari ( 2019-01-29 07:14:57 -0500 )edit