In the first frame, you can assign id in any way, 1 for the first one you find, 2 for the second ... or just give them an ID according to their position in the collection.
Then on the next frame you will need to use the best match. Find the drops, calculate all the distances between the current drops and all the drops of the previous image and assign each previous identifier to the nearest blob. Blobs that simply enter a field will receive new identifiers.
Now that you have two frames, you can make motion prediction for the next. Just calculate deltaX and deltaY between the previous and current blob position. You can use this information to guess the future position. Match against this future position.
This should work if you do not have a lot of overlapping drops, and if the movement is not too fast and unstable between frames.
It is possible to be more accurate using a scoring system across multiple images:
Get positions for the first 3 or 5 images. For any frame of frame one, find the closest one on frame 2, calculate the speed (deltaX deltaY), look for the closest to the predicted position for frame 3, 4, 5 ... Sum all the distances between the predicted positin and the nearest blob, this will be an estimate. Do the same using the second nearest on frame 2 (it will look in the other direction). The lower the score, the more likely it is a good drop.
If you have a lot of blobs, you should use the quadrant to speed up the process. Compare the square of the distance; this avoids a lot of sqrt calculations.
It is important to know how your blob typically moves in order to customize its algotritis.
bokan
source share