1

I am implementing motion based object tracking program which is using background substraction, Kalman Filter and Hungarian algorithm. Everything is working fine except the occlusions. When two object are close enough to each other the background substraction recognizes it as one of these two objects. After they split the program recognizes these two objects correctly. I am looking for solution/algorithm which will detect occlusion like shown in point c) in the example below. enter image description here

I will appreciate any references or code examples reffering to occlusion detecion problem when using background substraction.

sadurator
  • 111
  • 1
  • 2
  • 6
  • 1
    Please share code - what have you tried so far. – Abhi25t Feb 09 '21 at 18:23
  • 1
    I assume you have these images as video. One method would be to track individual objects across multiple frames. If two objects suddenly merge together you can assume it's still two objects. This won't work if they walk into frame as one blob already. Another method could be to try and erode the mask you get. If after a few iterations of erosion the blobs separate then you know they're likely two objects close together. This will only work if they're only a little overlapped though. – Ian Chu Feb 09 '21 at 23:41

1 Answers1

1

Object detection using a machine learning algorithm should reliably distinguish between these objects, even with significant occlusion. You haven't shared anything about your environment so I don't know what kind of constraints you have, but using an ML approach, here is how I would tackle your problem.

import cv2
from sort import *

tracker = Sort() # Create instance of tracker (see link below for repo)

cap = cv2.VideoCapture(0)
while(True):
    ret, frame = cap.read()

    # Not sure what your environment is, 
    #but get your objects bounding boxes like this
    detected_objects = detector.detect(frame) #pseudo code
    
    # Get tracking IDs for objects and bounding boxes
    detected_objects_with_ids = tracker.update(detected_objects)
...

The above example uses this Kalman Filter and Hungarian algorithm, which can track multiple objects in real-time.

Again, not sure about your environment, but you could find pre-built object detection algorithms on the Tensorflow site.

j2abro
  • 733
  • 8
  • 17