2020-11-18 19:04:15 +08:00
|
|
|
package org.opencv.test.video;
|
|
|
|
|
|
|
|
import org.opencv.core.Core;
|
2021-07-02 18:41:41 +08:00
|
|
|
import org.opencv.core.CvType;
|
2020-11-18 19:04:15 +08:00
|
|
|
import org.opencv.core.CvException;
|
2021-07-02 18:41:41 +08:00
|
|
|
import org.opencv.core.Mat;
|
|
|
|
import org.opencv.core.Rect;
|
2020-11-18 19:04:15 +08:00
|
|
|
import org.opencv.test.OpenCVTestCase;
|
|
|
|
|
|
|
|
import org.opencv.video.Tracker;
|
|
|
|
import org.opencv.video.TrackerGOTURN;
|
|
|
|
import org.opencv.video.TrackerMIL;
|
|
|
|
|
|
|
|
public class TrackerCreateTest extends OpenCVTestCase {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void setUp() throws Exception {
|
|
|
|
super.setUp();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void testCreateTrackerGOTURN() {
|
|
|
|
try {
|
|
|
|
Tracker tracker = TrackerGOTURN.create();
|
|
|
|
assert(tracker != null);
|
|
|
|
} catch (CvException e) {
|
|
|
|
// expected, model files may be missing
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void testCreateTrackerMIL() {
|
|
|
|
Tracker tracker = TrackerMIL.create();
|
2021-07-02 18:41:41 +08:00
|
|
|
assert(tracker != null);
|
|
|
|
Mat mat = new Mat(100, 100, CvType.CV_8UC1);
|
|
|
|
Rect rect = new Rect(10, 10, 30, 30);
|
|
|
|
tracker.init(mat, rect); // should not crash (https://github.com/opencv/opencv/issues/19915)
|
2020-11-18 19:04:15 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|