"Determine the speed of a 2D object using a camera" - How to track the center of gravity of an object?

I am trying to create a project "Determine the speed of a 2D object using a camera." This is just two-dimensional speed. I want to use the Lucas Canada algorithm in OpenCV. But I can not distinguish that coner belongs to my object, and I can not find the centroid of my object for tracking (this is the place of a white object on a black background, this object has any shape, for example: square, elip, ..). How to track the center of gravity of an object to determine the distance from movement? Do I need a Lucas Kanade algorithm to create this project? Please help me.

+4
source share
1 answer

To get the speed of an object, you need to do two things: firstly, you need to detect the object in each image (and condense it to a centroid, as you suggested), and secondly, you need to link the detected objects to different images, Once you if you do, speed can be easily calculated with a simple equation of speed of movement = distance / time.

The association is simple if you only detect one object in each image (just assume that detection is an object), although this approach can disrupt the real world.

Finding your object is where I think you are having difficulty. If it is really as simple as a single white object on a solid black background, then the search for the centroid should be simple, just average the coordinates of all the white pixels. If you have a noisy image, you first need to do some cleaning, such as morphological closing and opening operations, to remove small noise spots.

+2
source

Source: https://habr.com/ru/post/1440271/


All Articles