What's the best method for tracking identical objects?
Hi all, I'm sorry that my question is so wide, but I will try to explain in detail what is my problem.
So, I just wrote a program, that checks whether two balls of different colors are on the collision track. I use RGB->HSV transform, have one yellow ball, one blue, I check their position on different frames, I calculate their speed, direction etc and after that, I predict if they may collide. So, after that I thought color-based detection is not the best solution, and I want to detect more than 2 objects, So I thought I should use edge filter, or MOG2 algorithm, or something like that I still think about that, but that's not what I wanted to ask (but if anyone could suggest me something, that's gonna be great :) )
So when I will have a binary image with, for example, 2 object-two balls of the same size, and I'm gonna check their position, ok, so in the first frame one object is located has coordinates X1 and Y1 , second one X2 and Y2. Next I'm gonna analyze second frame, so there are gonna be still two the same objects, first has X3 and Y3 coordinates, and second one X4 and Y4, but how my program gonna now that the first object from 1 and 2 frame is the same object, if those 2 objects gonna have the same shape and size, the program will have a problem to correctly assign a new position to the same object because it can assign it to another object. In HSV it was quite easy because when the computer detected for example yellow object, it knew that its the same yellow object as in the previous frame (because it was only one yellow object). I know I described it a bit chaotic, but I hope you understand what I mean
It seems to me that the only thing that will allow the assignment of detected objects from the previous frame is a slight change of their position, but when I started thinking about it, it's not so easy because, for example, checking the distance between newly found objects and those from the previous frame and link them on the basis of the smallest distance may turn out to be in many cases faulty.
So I wonder if such a solution is possible at all and if there is any ready-made algorithm that will allow me to analyze the position in the previous steps of the object.
Thanks for your time and have a nice day :)