From: Andrey Pavlenko Date: Wed, 4 Apr 2012 15:00:35 +0000 (+0000) Subject: Java API: fixing Highgui and Video tests X-Git-Tag: accepted/tizen/6.0/unified/20201030.111113~1314^2~2261 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5fefac7fe3b1b2583b76f0a965290a427d765680;p=platform%2Fupstream%2Fopencv.git Java API: fixing Highgui and Video tests --- diff --git a/modules/java/android_test/src/org/opencv/test/highgui/HighguiTest.java b/modules/java/android_test/src/org/opencv/test/highgui/HighguiTest.java index ed55bac..d22745b 100644 --- a/modules/java/android_test/src/org/opencv/test/highgui/HighguiTest.java +++ b/modules/java/android_test/src/org/opencv/test/highgui/HighguiTest.java @@ -1,8 +1,6 @@ package org.opencv.test.highgui; -import java.util.ArrayList; -import java.util.List; - +import org.opencv.core.CvVectorByte; import org.opencv.highgui.Highgui; import org.opencv.test.OpenCVTestCase; import org.opencv.test.OpenCVTestRunner; @@ -14,10 +12,10 @@ public class HighguiTest extends OpenCVTestCase { } public void testImencodeStringMatListOfByte() { - List buf = new ArrayList(); - assertEquals(0, buf.size()); - assertTrue( Highgui.imencode(".jpg", gray127, buf) ); - assertFalse(0 == buf.size()); + CvVectorByte buff = new CvVectorByte(); + assertEquals(0, buff.size()); + assertTrue( Highgui.imencode(".jpg", gray127, buff) ); + assertFalse(0 == buff.total()); } public void testImencodeStringMatListOfByteListOfInteger() { diff --git a/modules/java/android_test/src/org/opencv/test/video/VideoTest.java b/modules/java/android_test/src/org/opencv/test/video/VideoTest.java index 8e1cc80..f994504 100644 --- a/modules/java/android_test/src/org/opencv/test/video/VideoTest.java +++ b/modules/java/android_test/src/org/opencv/test/video/VideoTest.java @@ -1,27 +1,26 @@ package org.opencv.test.video; import org.opencv.core.Core; +import org.opencv.core.CvVectorByte; +import org.opencv.core.CvVectorFloat; +import org.opencv.core.CvVectorPoint2f; import org.opencv.core.Mat; import org.opencv.core.Point; import org.opencv.core.Size; import org.opencv.test.OpenCVTestCase; -import org.opencv.utils.Converters; import org.opencv.video.Video; -import java.util.ArrayList; -import java.util.List; - public class VideoTest extends OpenCVTestCase { - private List err = null; + private CvVectorFloat err = null; private int h; - private List nextPts = null; - List prevPts = null; + private CvVectorPoint2f nextPts = null; + private CvVectorPoint2f prevPts = null; private int shift1; private int shift2; - private List status = null; + private CvVectorByte status = null; private Mat subLena1 = null; private Mat subLena2 = null; private int w; @@ -38,14 +37,11 @@ public class VideoTest extends OpenCVTestCase { subLena1 = rgbLena.submat(shift1, h + shift1, shift1, w + shift1); subLena2 = rgbLena.submat(shift2, h + shift2, shift2, w + shift2); - prevPts = new ArrayList(); - prevPts.add(new Point(11.0, 8.0)); - prevPts.add(new Point(5.0, 5.0)); - prevPts.add(new Point(10.0, 10.0)); + prevPts = new CvVectorPoint2f(new Point(11d, 8d), new Point(5d, 5d), new Point(10d, 10d)); - nextPts = new ArrayList(); - status = new ArrayList(); - err = new ArrayList(); + nextPts = new CvVectorPoint2f(); + status = new CvVectorByte(); + err = new CvVectorFloat(); } public void testCalcGlobalOrientation() { @@ -66,13 +62,13 @@ public class VideoTest extends OpenCVTestCase { public void testCalcOpticalFlowPyrLKMatMatListOfPointListOfPointListOfByteListOfFloat() { Video.calcOpticalFlowPyrLK(subLena1, subLena2, prevPts, nextPts, status, err); - assertEquals(3, Core.countNonZero(Converters.vector_uchar_to_Mat(status))); + 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(Converters.vector_uchar_to_Mat(status))); + assertEquals(0, Core.countNonZero(status)); }