Commit 5c0c8107 authored by Andrey Pavlenko's avatar Andrey Pavlenko

Java API: fixing Objdetect tests

parent 5fefac7f
package org.opencv.test.imgproc;
import org.opencv.core.Mat;
import org.opencv.core.CvVectorFloat6;
import org.opencv.core.Point;
import org.opencv.core.Rect;
import org.opencv.imgproc.Subdiv2D;
......@@ -50,7 +50,7 @@ public class Subdiv2DTest extends OpenCVTestCase {
s2d.insert( new Point(20, 10) );
s2d.insert( new Point(20, 20) );
s2d.insert( new Point(10, 20) );
Mat triangles = new Mat();
CvVectorFloat6 triangles = new CvVectorFloat6();
s2d.getTriangleList(triangles);
assertEquals(10, triangles.rows());
/*
......
package org.opencv.test.objdetect;
import java.util.ArrayList;
import org.opencv.core.CvVectorRect;
import org.opencv.core.Mat;
import org.opencv.core.Rect;
import org.opencv.core.Size;
import org.opencv.imgproc.Imgproc;
import org.opencv.objdetect.CascadeClassifier;
......@@ -34,14 +32,14 @@ public class CascadeClassifierTest extends OpenCVTestCase {
public void testDetectMultiScaleMatListOfRect() {
CascadeClassifier cc = new CascadeClassifier(OpenCVTestRunner.LBPCASCADE_FRONTALFACE_PATH);
ArrayList<Rect> faces = new ArrayList<Rect>();
CvVectorRect faces = new CvVectorRect();
Mat greyLena = new Mat();
Imgproc.cvtColor(rgbLena, greyLena, Imgproc.COLOR_RGB2GRAY);
// TODO: doesn't detect with 1.1 scale
cc.detectMultiScale(greyLena, faces, 1.09, 3, Objdetect.CASCADE_SCALE_IMAGE, new Size(30, 30), new Size());
assertEquals(1, faces.size());
assertEquals(1, faces.total());
}
public void testDetectMultiScaleMatListOfRectDouble() {
......
package org.opencv.test.objdetect;
import java.util.ArrayList;
import org.opencv.core.Rect;
import org.opencv.core.CvVectorRect;
import org.opencv.objdetect.Objdetect;
import org.opencv.test.OpenCVTestCase;
......@@ -10,27 +8,27 @@ public class ObjdetectTest extends OpenCVTestCase {
public void testGroupRectanglesListOfRectListOfIntegerInt() {
fail("Not yet implemented");
Rect r = new Rect(10, 10, 20, 20);
ArrayList<Rect> rects = new ArrayList<Rect>();
final int NUM = 10;
CvVectorRect rects = new CvVectorRect(NUM);
for (int i = 0; i < 10; i++)
rects.add(r);
for (int i = 0; i < NUM; i++)
rects.put(i, 0, 10, 10, 20, 20);
int groupThreshold = 1;
Objdetect.groupRectangles(rects, null, groupThreshold);//TODO: second parameter should not be null
assertEquals(1, rects.size());
assertEquals(1, rects.total());
}
public void testGroupRectanglesListOfRectListOfIntegerIntDouble() {
fail("Not yet implemented");
Rect r1 = new Rect(10, 10, 20, 20);
Rect r2 = new Rect(10, 10, 25, 25);
ArrayList<Rect> rects = new ArrayList<Rect>();
for (int i = 0; i < 10; i++)
rects.add(r1);
for (int i = 0; i < 10; i++)
rects.add(r2);
final int NUM = 10;
CvVectorRect rects = new CvVectorRect(NUM);
for (int i = 0; i < NUM; i++)
rects.put(i, 0, 10, 10, 20, 20);
for (int i = 0; i < NUM; i++)
rects.put(i, 0, 10, 10, 25, 25);
int groupThreshold = 1;
double eps = 0.2;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment