My program is tasked of tracking the motion of any single object moving into the cameras's vision using the subtraction method. From subtracted image, I use the threshold block to make the image binary. Only movement will cause the color red to appear on the black background. The centroid calculates the center of energy of the red shape created from the movement. Then I use the coordinates of the centroid to overlay a rectangle and track the movement. However, I became stuck when I try to track two objects simultaneously. The centroid will think that the centre of energy is between the two moving objects. I would like to ask some questions first before changing my code, because my code is overly messy and a pain in the ass to overhaul.
My questions are:
1. Will adding a second centroid block enable 2nd object tracking?
2. How do I make the centroid able to differentiate between 2 moving objects or 1 large moving object?
3. If my current way of tracking is not suitable for 2 objects, how do I rectify this? Any better ways?
I will add my program here so maybe you can understand my scenario better. Sorry if I seem dumb. I'm new to LabVIEW and my programming knowledge is average at best. The main VI is "FYPtracking.vi". The rest are sub VIs for it. Any advice is much appreciated. Thanks alot.
Note: I didn't include my "Time" SubVI because of limited upload numbers.