Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the best way to track an object in a video?

Tags:

I'm trying to learn computer vision and more specifically open-cv in python.

I want to make a program that would track my barbell in a video and show me its path. (I know apps like this exists but I want to make it myself). I tried using the Canny edge detection and the HoughCircles functions but I seem to get everything but a good result.

I have been using this code to find the edges of my image:

gray = cv.cvtColor(src=img, code=cv.COLOR_BGR2GRAY)
blur = cv.blur(gray, (2,2))
canny = cv.Canny(blur, 60, 60)

And then this code to find the circle:

circles = cv.HoughCircles(canny, cv.HOUGH_GRADIENT, dp=2, minDist=1000, circles=None,maxRadius=50)

This is the result: Result

left = original image with detected circle // right = canny image

Is this the right way to go or should I use another method?

like image 281
FranckDi Avatar asked Dec 16 '20 12:12

FranckDi


1 Answers

Train the YOLO model for the barbell to detect barbel object is better than anything you tried with OpenCV. You need at least 500 images. Those images can be found on the internet easily. This tutorial is kick start tutorial on YOLO. Let's give a try.

like image 139
RCvaram Avatar answered Sep 30 '22 17:09

RCvaram