Smorodov / Multitarget-tracker

Multiple Object Tracker, Based on Hungarian algorithm + Kalman filter.
Apache License 2.0
2.19k stars 651 forks source link

Custom region objects for tracker #403

Open icklerly1 opened 1 year ago

icklerly1 commented 1 year ago

Hi, I have a question. My plan is to provide the mtracker.Update method with custom regions.

I am generating my regions with the following:

new_regions = []
for el in orig_regions:
          new_obj = mt.CRegion()
          new_obj.confidence = el.confidence
          new_obj.type = el.type
          new_obj.brect = el.brect
          new_obj.brect = mt.CvRect()
          new_obj.brect.x = el.brect.x
          new_obj.brect.y = el.brect.y
          new_obj.brect.width = el.brect.width
          new_obj.brect.height = el.brect.height
          new_regions.append(new_obj)

and then:
mtracker.Update(new_regions, img, fps)

Unfortunately my tracker gets stuck after the second iteration. Do you have a tip how to solve this? If I just use new_obj = el within the loop everything works fine.

It would be great if somebody could help me out! Or give me a direction.

Nuzhny007 commented 1 year ago

All mt types are C++ structures with Python bindings. So Tracker waits not python's list of regions but C++ array - std::vector. I'm not so good in python's bindings but try to search some way to transform from python into C++ types.