chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"missing_consts": {
|
||||
"Video" : {
|
||||
"private" : [
|
||||
["CV_LKFLOW_INITIAL_GUESSES", 4 ],
|
||||
["CV_LKFLOW_GET_MIN_EIGENVALS", 8 ]
|
||||
]
|
||||
}
|
||||
},
|
||||
"func_arg_fix" : {
|
||||
"calcOpticalFlowPyrLK" : { "prevPts" : {"ctype" : "vector_Point2f"},
|
||||
"nextPts" : {"ctype" : "vector_Point2f"},
|
||||
"status" : {"ctype" : "vector_uchar"},
|
||||
"err" : {"ctype" : "vector_float"} }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package org.opencv.test.video;
|
||||
|
||||
import org.opencv.test.OpenCVTestCase;
|
||||
|
||||
public class BackgroundSubtractorMOGTest extends OpenCVTestCase {
|
||||
|
||||
public void testApplyMatMat() {
|
||||
fail("Not yet implemented");
|
||||
/*
|
||||
BackgroundSubtractorMOG backGroundSubtract = new BackgroundSubtractorMOG();
|
||||
|
||||
Point bottomRight = new Point(rgbLena.cols() / 2, rgbLena.rows() / 2);
|
||||
Point topLeft = new Point(0, 0);
|
||||
Scalar color = new Scalar(128);
|
||||
Mat mask = new Mat(rgbLena.size(), CvType.CV_16UC3, new Scalar(1));
|
||||
|
||||
Imgproc.rectangle(rgbLena, bottomRight, topLeft, color, Imgproc.FILLED);
|
||||
|
||||
backGroundSubtract.apply(rgbLena, mask);
|
||||
|
||||
Mat truth = new Mat(rgbLena.size(), rgbLena.type(), new Scalar(0));
|
||||
Imgproc.rectangle(truth, bottomRight, topLeft, color, Imgproc.FILLED);
|
||||
assertMatEqual(truth, rgbLena);
|
||||
*/
|
||||
}
|
||||
|
||||
public void testApplyMatMatDouble() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
public void testBackgroundSubtractorMOG() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
public void testBackgroundSubtractorMOGIntIntDouble() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
public void testBackgroundSubtractorMOGIntIntDoubleDouble() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package org.opencv.test.video;
|
||||
|
||||
import org.opencv.test.OpenCVTestCase;
|
||||
import org.opencv.video.KalmanFilter;
|
||||
|
||||
public class KalmanFilterTest extends OpenCVTestCase {
|
||||
|
||||
public void testCorrect() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
public void testKalmanFilter() {
|
||||
KalmanFilter kf = new KalmanFilter();
|
||||
|
||||
assertNotNull(kf);
|
||||
}
|
||||
|
||||
public void testKalmanFilterIntInt() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
public void testKalmanFilterIntIntInt() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
public void testKalmanFilterIntIntIntInt() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
public void testPredict() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
public void testPredictMat() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package org.opencv.test.video;
|
||||
|
||||
import java.io.File;
|
||||
import org.opencv.core.Core;
|
||||
import org.opencv.core.CvType;
|
||||
import org.opencv.core.CvException;
|
||||
import org.opencv.core.Mat;
|
||||
import org.opencv.core.Rect;
|
||||
import org.opencv.dnn.Dnn;
|
||||
import org.opencv.dnn.Net;
|
||||
import org.opencv.test.OpenCVTestCase;
|
||||
|
||||
import org.opencv.video.Tracker;
|
||||
import org.opencv.video.TrackerGOTURN;
|
||||
import org.opencv.video.TrackerGOTURN_Params;
|
||||
import org.opencv.video.TrackerNano;
|
||||
import org.opencv.video.TrackerNano_Params;
|
||||
import org.opencv.video.TrackerVit;
|
||||
import org.opencv.video.TrackerVit_Params;
|
||||
import org.opencv.video.TrackerMIL;
|
||||
|
||||
public class TrackerCreateTest extends OpenCVTestCase {
|
||||
|
||||
private final static String ENV_OPENCV_DNN_TEST_DATA_PATH = "OPENCV_DNN_TEST_DATA_PATH";
|
||||
private final static String ENV_OPENCV_TEST_DATA_PATH = "OPENCV_TEST_DATA_PATH";
|
||||
private String testDataPath;
|
||||
private String modelsDataPath;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
|
||||
// relys on https://developer.android.com/reference/java/lang/System
|
||||
isTestCaseEnabled = System.getProperties().getProperty("java.vm.name") != "Dalvik";
|
||||
if (!isTestCaseEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
testDataPath = System.getenv(ENV_OPENCV_TEST_DATA_PATH);
|
||||
if (testDataPath == null) {
|
||||
throw new Exception(ENV_OPENCV_TEST_DATA_PATH + " has to be defined!");
|
||||
}
|
||||
|
||||
modelsDataPath = System.getenv(ENV_OPENCV_DNN_TEST_DATA_PATH);
|
||||
if (modelsDataPath == null) {
|
||||
modelsDataPath = testDataPath;
|
||||
}
|
||||
|
||||
if (isTestCaseEnabled) {
|
||||
testDataPath = System.getenv(ENV_OPENCV_DNN_TEST_DATA_PATH);
|
||||
if (testDataPath == null)
|
||||
testDataPath = System.getenv(ENV_OPENCV_TEST_DATA_PATH);
|
||||
if (testDataPath == null)
|
||||
throw new Exception(ENV_OPENCV_TEST_DATA_PATH + " has to be defined!");
|
||||
}
|
||||
}
|
||||
|
||||
public void testCreateTrackerGOTURN() {
|
||||
Net net;
|
||||
try {
|
||||
String protoFile = new File(testDataPath, "dnn/gsoc2016-goturn/goturn.prototxt").toString();
|
||||
String weightsFile = new File(modelsDataPath, "dnn/gsoc2016-goturn/goturn.caffemodel").toString();
|
||||
net = Dnn.readNetFromCaffe(protoFile, weightsFile);
|
||||
} catch (CvException e) {
|
||||
return;
|
||||
}
|
||||
Tracker tracker = TrackerGOTURN.create(net);
|
||||
assert(tracker != null);
|
||||
}
|
||||
|
||||
public void testCreateTrackerNano() {
|
||||
Net backbone;
|
||||
Net neckhead;
|
||||
try {
|
||||
String backboneFile = new File(modelsDataPath, "dnn/onnx/models/nanotrack_backbone_sim_v2.onnx").toString();
|
||||
String neckheadFile = new File(modelsDataPath, "dnn/onnx/models/nanotrack_head_sim_v2.onnx").toString();
|
||||
backbone = Dnn.readNet(backboneFile);
|
||||
neckhead = Dnn.readNet(neckheadFile);
|
||||
} catch (CvException e) {
|
||||
return;
|
||||
}
|
||||
Tracker tracker = TrackerNano.create(backbone, neckhead);
|
||||
assert(tracker != null);
|
||||
}
|
||||
|
||||
public void testCreateTrackerVit() {
|
||||
Net net;
|
||||
try {
|
||||
String backboneFile = new File(modelsDataPath, "dnn/onnx/models/vitTracker.onnx").toString();
|
||||
net = Dnn.readNet(backboneFile);
|
||||
} catch (CvException e) {
|
||||
return;
|
||||
}
|
||||
Tracker tracker = TrackerVit.create(net);
|
||||
assert(tracker != null);
|
||||
}
|
||||
|
||||
public void testCreateTrackerMIL() {
|
||||
Tracker tracker = TrackerMIL.create();
|
||||
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)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package org.opencv.test.video;
|
||||
|
||||
import org.opencv.core.Core;
|
||||
import org.opencv.core.Mat;
|
||||
import org.opencv.core.MatOfByte;
|
||||
import org.opencv.core.MatOfFloat;
|
||||
import org.opencv.core.MatOfPoint2f;
|
||||
import org.opencv.core.Point;
|
||||
import org.opencv.core.Size;
|
||||
import org.opencv.test.OpenCVTestCase;
|
||||
import org.opencv.video.Video;
|
||||
|
||||
public class VideoTest extends OpenCVTestCase {
|
||||
|
||||
private MatOfFloat err = null;
|
||||
private int h;
|
||||
private MatOfPoint2f nextPts = null;
|
||||
private MatOfPoint2f prevPts = null;
|
||||
|
||||
private int shift1;
|
||||
private int shift2;
|
||||
|
||||
private MatOfByte status = null;
|
||||
private Mat subLena1 = null;
|
||||
private Mat subLena2 = null;
|
||||
private int w;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
|
||||
shift1 = 10;
|
||||
shift2 = 17;
|
||||
w = (int)(rgbLena.cols() / 2);
|
||||
h = (int)(rgbLena.rows() / 2);
|
||||
|
||||
subLena1 = rgbLena.submat(shift1, h + shift1, shift1, w + shift1);
|
||||
subLena2 = rgbLena.submat(shift2, h + shift2, shift2, w + shift2);
|
||||
|
||||
prevPts = new MatOfPoint2f(new Point(11d, 8d), new Point(5d, 5d), new Point(10d, 10d));
|
||||
|
||||
nextPts = new MatOfPoint2f();
|
||||
status = new MatOfByte();
|
||||
err = new MatOfFloat();
|
||||
}
|
||||
|
||||
public void testCalcGlobalOrientation() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
public void testCalcMotionGradientMatMatMatDoubleDouble() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
public void testCalcMotionGradientMatMatMatDoubleDoubleInt() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
public void testCalcOpticalFlowFarneback() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
public void testCalcOpticalFlowPyrLKMatMatListOfPointListOfPointListOfByteListOfFloat() {
|
||||
Video.calcOpticalFlowPyrLK(subLena1, subLena2, prevPts, nextPts, status, err);
|
||||
assertEquals(3, Core.countNonZero(status));
|
||||
}
|
||||
|
||||
public void testCalcOpticalFlowPyrLKMatMatListOfPointListOfPointListOfByteListOfFloatSize() {
|
||||
Size sz = new Size(3, 3);
|
||||
Video.calcOpticalFlowPyrLK(subLena1, subLena2, prevPts, nextPts, status, err, sz, 3);
|
||||
assertEquals(0, Core.countNonZero(status));
|
||||
}
|
||||
|
||||
|
||||
public void testCalcOpticalFlowPyrLKMatMatListOfPointListOfPointListOfByteListOfFloatSizeIntTermCriteriaDoubleIntDouble() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
public void testCamShift() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
public void testEstimateRigidTransform() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
public void testMeanShift() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
public void testSegmentMotion() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
public void testUpdateMotionHistory() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user