Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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. (We do have opencv.js compiled file and it has all these tracking algortihms)

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

https://www.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

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. (We do have opencv.js compiled file and it has all these tracking algortihms)

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

https://www.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);

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