Pan/Tilt + Motorized zoom

General discussion about topics related to OpenMV.
doodah
Posts: 3
Joined: Wed Jan 30, 2019 10:15 pm

Pan/Tilt + Motorized zoom

Postby doodah » Thu Jan 31, 2019 11:43 am

Hi!

I am in the planning stages of a project that will track a ball that travels parallel to the field of view (as opposed to across it.) Imagine the camera is mounted to the top of a soccer/football goal and it is tracking a ball kicked by the goalkeeper. I'd like to use the OpenMV camera to track the ball as it flies using a Pan/Tilt mechanism and a motorized zoom lens like this:

https://computar.com/file?id=230

Is this feasible? The pan/tilt mechanism would try to keep the ball in the center of the FOV. The lens has three separate motors that control the iris, zoom and focus. In looking through the documentation, I'm thinking the zoom and iris control should be pretty straight forward. I'm wondering what I'd use to maintain focus on the ball through its flight. Do you have any suggestions for this, or comments on the overall approach and/or concept in general?

Thanks!
User avatar
kwagyeman
Posts: 2985
Joined: Sun May 24, 2015 2:10 pm

Re: Pan/Tilt + Motorized zoom

Postby kwagyeman » Fri Feb 01, 2019 1:22 pm

Hi, this is really easy. You just use find blobs and track the largest blob. Then you have a PID loop on the X/Y and pixels within the blob that control pan, tilt, and zoom.

As for the service control we sell a pan and tilt shield that you just have to add power to and a mounting system with the servos. The OpenMV Cam can control the service directly.
Nyamekye,
doodah
Posts: 3
Joined: Wed Jan 30, 2019 10:15 pm

Re: Pan/Tilt + Motorized zoom

Postby doodah » Fri Feb 01, 2019 5:58 pm

Thanks so much for the response. That's what I gathered. As for adjusting the focus as the zoom increases while the ball flies, is there any functionality that could detect the "blurriness" of the blob? Also, since the motors driving the lens motors are regular 8 VDC motors, I would have to control them with a separate interface, right? And, is there a minimum blob size to maintain? After the lens runs out of zoom, the bob will continue to get smaller. Increasing zoom increases lens cost, so I'd like to understand if the blob size has a lower limit.

Thanks again!
User avatar
kwagyeman
Posts: 2985
Joined: Sun May 24, 2015 2:10 pm

Re: Pan/Tilt + Motorized zoom

Postby kwagyeman » Fri Feb 01, 2019 6:08 pm

Um, actually, I plan to add back a method called get_fft_histogram() which can be used to detect the sharpness of an ROI. I wrote the code for someone on the forums before but it never made it into a release. I'm doing firmware updates right now so I'll make this something to fix. Please get a GitHub issue for me to remember to add this back.

Basically, you can calculate the image MTF which is a score for blurryness. Then, you just try to maintain a zoom that keeps the score at an optimal setpoint. That said, this is an unstable system. I.e. you can't tell how to change the zoom (+/- focal length increase) to make the image not blurry. You can only tell when it gets worse and better. So this is a slightly more complex PID loop based on the dervative of the MTF over time.
Nyamekye,
doodah
Posts: 3
Joined: Wed Jan 30, 2019 10:15 pm

Re: Pan/Tilt + Motorized zoom

Postby doodah » Sat Feb 02, 2019 10:35 am

Ok, cool. Thanks! So the MFT is one of the results of the FFT calculation? Good point re: the instability. This will require some tweaking, but hopefully since the zoom and focus are separately controlled it may make it easier to manage. Also, the fact that the ball will always be moving away from the camera should help as well.

Is there a minimum blob size for which this will stop working? After the camera can't zoom anymore, the ball will start to get smaller and smaller. I can buy a bigger lens but want to limit cost if I can.

Thanks for the detailed and quick responses!
bogflap
Posts: 44
Joined: Mon Apr 16, 2018 10:03 am

Re: Pan/Tilt + Motorized zoom

Postby bogflap » Sat Feb 02, 2019 11:54 am

Plus one from me for the blurriness functionality i.e. get_fft_histogram() over an ROI
User avatar
kwagyeman
Posts: 2985
Joined: Sun May 24, 2015 2:10 pm

Re: Pan/Tilt + Motorized zoom

Postby kwagyeman » Sat Feb 02, 2019 2:29 pm

Give me a bit then to add this.
Nyamekye,

Return to “General Topics”

Who is online

Users browsing this forum: No registered users and 4 guests