2011-07-07 22:35:12 +08:00
|
|
|
package org.opencv.test.video;
|
|
|
|
|
2011-08-03 21:12:39 +08:00
|
|
|
import org.opencv.core.Core;
|
2011-07-20 00:08:26 +08:00
|
|
|
import org.opencv.core.Mat;
|
2012-04-14 05:50:59 +08:00
|
|
|
import org.opencv.core.MatOfByte;
|
|
|
|
import org.opencv.core.MatOfFloat;
|
|
|
|
import org.opencv.core.MatOfPoint2f;
|
2011-08-03 21:31:51 +08:00
|
|
|
import org.opencv.core.Point;
|
2011-07-20 00:08:26 +08:00
|
|
|
import org.opencv.core.Size;
|
2011-07-07 22:35:12 +08:00
|
|
|
import org.opencv.test.OpenCVTestCase;
|
2011-08-03 21:12:39 +08:00
|
|
|
import org.opencv.video.Video;
|
2011-06-30 20:07:31 +08:00
|
|
|
|
2011-08-05 16:39:28 +08:00
|
|
|
public class VideoTest extends OpenCVTestCase {
|
|
|
|
|
2012-04-14 05:50:59 +08:00
|
|
|
private MatOfFloat err = null;
|
2011-08-05 16:39:28 +08:00
|
|
|
private int h;
|
2012-04-14 05:50:59 +08:00
|
|
|
private MatOfPoint2f nextPts = null;
|
|
|
|
private MatOfPoint2f prevPts = null;
|
2011-08-02 21:47:40 +08:00
|
|
|
|
|
|
|
private int shift1;
|
|
|
|
private int shift2;
|
|
|
|
|
2012-04-14 05:50:59 +08:00
|
|
|
private MatOfByte status = null;
|
2011-08-02 21:47:40 +08:00
|
|
|
private Mat subLena1 = null;
|
|
|
|
private Mat subLena2 = null;
|
2011-08-05 16:39:28 +08:00
|
|
|
private int w;
|
2011-08-02 21:47:40 +08:00
|
|
|
|
2011-07-18 21:50:36 +08:00
|
|
|
@Override
|
|
|
|
protected void setUp() throws Exception {
|
|
|
|
super.setUp();
|
2011-08-02 21:47:40 +08:00
|
|
|
|
|
|
|
shift1 = 10;
|
|
|
|
shift2 = 17;
|
2011-08-06 18:03:24 +08:00
|
|
|
w = (int)(rgbLena.cols() / 2);
|
|
|
|
h = (int)(rgbLena.rows() / 2);
|
2011-08-02 21:47:40 +08:00
|
|
|
|
|
|
|
subLena1 = rgbLena.submat(shift1, h + shift1, shift1, w + shift1);
|
|
|
|
subLena2 = rgbLena.submat(shift2, h + shift2, shift2, w + shift2);
|
|
|
|
|
2012-04-14 05:50:59 +08:00
|
|
|
prevPts = new MatOfPoint2f(new Point(11d, 8d), new Point(5d, 5d), new Point(10d, 10d));
|
2011-08-03 21:31:51 +08:00
|
|
|
|
2012-04-14 05:50:59 +08:00
|
|
|
nextPts = new MatOfPoint2f();
|
|
|
|
status = new MatOfByte();
|
|
|
|
err = new MatOfFloat();
|
2011-08-02 21:47:40 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
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");
|
|
|
|
}
|
|
|
|
|
2011-08-05 16:39:28 +08:00
|
|
|
public void testCalcOpticalFlowPyrLKMatMatListOfPointListOfPointListOfByteListOfFloat() {
|
|
|
|
Video.calcOpticalFlowPyrLK(subLena1, subLena2, prevPts, nextPts, status, err);
|
2012-04-14 05:50:59 +08:00
|
|
|
assertEquals(3, Core.countNonZero(status));
|
2011-08-05 16:39:28 +08:00
|
|
|
}
|
2011-08-02 21:47:40 +08:00
|
|
|
|
2011-08-05 16:39:28 +08:00
|
|
|
public void testCalcOpticalFlowPyrLKMatMatListOfPointListOfPointListOfByteListOfFloatSize() {
|
|
|
|
Size sz = new Size(3, 3);
|
2012-03-21 23:07:54 +08:00
|
|
|
Video.calcOpticalFlowPyrLK(subLena1, subLena2, prevPts, nextPts, status, err, sz, 3);
|
2012-04-14 05:50:59 +08:00
|
|
|
assertEquals(0, Core.countNonZero(status));
|
2011-08-05 16:39:28 +08:00
|
|
|
}
|
|
|
|
|
2011-08-02 21:47:40 +08:00
|
|
|
|
2011-08-05 16:39:28 +08:00
|
|
|
public void testCalcOpticalFlowPyrLKMatMatListOfPointListOfPointListOfByteListOfFloatSizeIntTermCriteriaDoubleIntDouble() {
|
|
|
|
fail("Not yet implemented");
|
|
|
|
}
|
2011-08-02 21:47:40 +08:00
|
|
|
|
|
|
|
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");
|
|
|
|
}
|
2011-06-30 20:07:31 +08:00
|
|
|
|
|
|
|
}
|