srianant/kalman_filter_multi_object_tracking

Tracking problem

Opened this issue · 2 comments

Hello my name is Jasar. i tryed to implement your tracker into my facial detection code
i just did it:
i imported tracker in my main
from tracker import Tracker
and i started the object like it:
tracker = Tracker(cfg.trackerDistanceThreshold, cfg.trackerMaxFrameSkip, cfg.trackerTraceLenght, cfg.trackIdCount)
where cfg. variables are on a config file.

in fame read while im using haar face detection the it return to me x,y,w,h
i converted it to a np array centerpoint whit this function:

    def transformBoxesToCenters(self,boxes):
        centers=[]
        for box in boxes:
            center = []
            _x = _y = _w = _h = 0            
            _x = box[0]
            _y = box[1]
            _w = box[2]
            _h = box[3]
            center = np.array([int( _x + ( _w / 2 ) ), int( _y + ( _h / 2 ) )])
            centers.append(np.round(center))
        return centers

and in my main after detect faces i used the tracker object like it:
centers = func.transformBoxesToCenters(detectedFaces)

and used you function to print on screen the tracker central point

if (len(centers) > 0):
        tracker.Update(centers)
        for i in range(len(tracker.tracks)):
            if (len(tracker.tracks[i].trace) > 1):
                for j in range(len(tracker.tracks[i].trace)-1):
                    # Draw trace line
                    x1 = tracker.tracks[i].trace[j][0][0]
                    y1 = tracker.tracks[i].trace[j][1][0]
                    x2 = tracker.tracks[i].trace[j+1][0][0]
                    y2 = tracker.tracks[i].trace[j+1][1][0]
                    clr = tracker.tracks[i].track_id % 9
                    cv2.line(frame, (int(x1), int(y1)), (int(x2), int(y2)),track_colors[clr], 2)

my script runs and open the window but the tracker point only moves on a diagonal (45º) line

could you help me to fix it please?

I have implemented your tracker to trace the direction of people movement. It is working perfectly, but is there any way to keep the trajectory in the frame. Actually as per your when the object disappears from the frame the trajectory is also becoming invisible. "sendtoadithyaraj@gmail.com" this is my email id. Anyone who knows please help me.

Hey @adithya6aj , have you solved this problem? I am facing the same issue...