Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tracking problem #10

Open
TheMasterRoot opened this issue Jun 5, 2019 · 2 comments
Open

Tracking problem #10

TheMasterRoot opened this issue Jun 5, 2019 · 2 comments

Comments

@TheMasterRoot
Copy link

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?

@adithya6aj
Copy link

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. "[email protected]" this is my email id. Anyone who knows please help me.

@sandeepy0
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants