Some suggestions for pairing
- Try to define an average horizontal distance between back car lights for your setup over a range of cars.
- Increase these dimensions to a lower and upper border by reducing and increasing it with lets say 20% of size.
- Now loop over blobs, calculate their centers and store them somewhere.
- Start with center 1, now look if there is a center of which the y coordinate is somewhere on the same height as the one of the center you are processing. Then look at the x distance between both points. Look if it falls in between your borders set at step 2.
- If you find a pair, delete both blobs/centers from your search structure.
- Continue this iteration untill all blobs are matched or not, but at least all processed.
I am pretty sure that this will work.