Opencv hough circle not working on video

asked 2022-11-09 23:59:42 -0500

Hi, I'm trying to detect a pin-pong ball on a video stream fro a camera mounted on a robotic arm. I tried to do it with the hough opencv circle detection. Basically what the code do is: 1. subscribe to the video topic 2. apply a threshold mask to the image to keep only the orange ball 3. convert it to gray scale 4. Apply hough circle detection 5. Draw each detected circle on the image 6. Publish back the image with the circles on another topic

I tried to make it work with a prerecorded video but I did not work. However it works really well on a screenshot of the video. At first I thought it was because of the refresh rate so I simulate a video by publishing the same image at 120Hz and it works.

So I dont know how to make it work on the video. Is it because this method involve too many calculation for a video ?

I planned to switch to a neural network approach bc it might be computationally cheaper but I want to have your advice before switching.

Here is a link to my code

Thanks

Mac M1 Max Ubuntu 20.04 Noetic

edit retag flag offensive close merge delete