How to load any of this tracking algorithm in opencvjs(BOOSTING, MIL, KCF, TLD, MEDIANFLOW, GOTURN, MOSSE or CSRT)

Hello,

I wanted to load any of these tracking algorithms in javascript using opencvjs. please suggest me or giving some links to do the same.

I tried to refer this c++ and Python code link :

https://learnopencv.com/object-tracking-using-opencv-cpp-python/#opencv-tracking-api

But getting error when initialized with below code

code:

let video = document.getElementById('videoInput');
let cap = new cv.VideoCapture(video);

    // take first frame of the video
    let frame = new cv.Mat(video.height, video.width, cv.CV_8UC4);
    cap.read(frame);

    // hardcode the initial location of window
    let trackWindow = new cv.Rect(150, 60, 125, 125);

      let tracker_c = cv.TrackerKCF_create();

    // set up the ROI for tracking
    let roi = frame.roi(trackWindow);

Errror:

TypeError: cv.TrackerKCF_create is not a function

TrackerMIL seems to be the only option available in opencv.js

1 Like

Thanks, this will do for now, but do you know if there are any plans to implement the CSRT tracker into JS? I’m interested in that algorithm

Could you please share how can you used MIL in javascript ?