I've implemented the background subtraction method to detect moving blobs but the issue is that it doesn't detect the far objects and sometimes the moving cars are not accurately detected as a single blob (sometimes it splits into 2 or 3, sometimes it doesn't detect it). I've also implemented the code here: https://github.com/MicrocontrollersAndMore/OpenCV_3_Car_Counting_Cpp
Is there any sophisticated read solution to do the needful and it does the job perfectly (detecting car blob and tag it with ID)?