Java API: fixing Objdetect tests
This commit is contained in:
parent
5fefac7fe3
commit
5c0c81076b
@ -1,6 +1,6 @@
|
|||||||
package org.opencv.test.imgproc;
|
package org.opencv.test.imgproc;
|
||||||
|
|
||||||
import org.opencv.core.Mat;
|
import org.opencv.core.CvVectorFloat6;
|
||||||
import org.opencv.core.Point;
|
import org.opencv.core.Point;
|
||||||
import org.opencv.core.Rect;
|
import org.opencv.core.Rect;
|
||||||
import org.opencv.imgproc.Subdiv2D;
|
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, 10) );
|
||||||
s2d.insert( new Point(20, 20) );
|
s2d.insert( new Point(20, 20) );
|
||||||
s2d.insert( new Point(10, 20) );
|
s2d.insert( new Point(10, 20) );
|
||||||
Mat triangles = new Mat();
|
CvVectorFloat6 triangles = new CvVectorFloat6();
|
||||||
s2d.getTriangleList(triangles);
|
s2d.getTriangleList(triangles);
|
||||||
assertEquals(10, triangles.rows());
|
assertEquals(10, triangles.rows());
|
||||||
/*
|
/*
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
package org.opencv.test.objdetect;
|
package org.opencv.test.objdetect;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import org.opencv.core.CvVectorRect;
|
||||||
|
|
||||||
import org.opencv.core.Mat;
|
import org.opencv.core.Mat;
|
||||||
import org.opencv.core.Rect;
|
|
||||||
import org.opencv.core.Size;
|
import org.opencv.core.Size;
|
||||||
import org.opencv.imgproc.Imgproc;
|
import org.opencv.imgproc.Imgproc;
|
||||||
import org.opencv.objdetect.CascadeClassifier;
|
import org.opencv.objdetect.CascadeClassifier;
|
||||||
@ -34,14 +32,14 @@ public class CascadeClassifierTest extends OpenCVTestCase {
|
|||||||
|
|
||||||
public void testDetectMultiScaleMatListOfRect() {
|
public void testDetectMultiScaleMatListOfRect() {
|
||||||
CascadeClassifier cc = new CascadeClassifier(OpenCVTestRunner.LBPCASCADE_FRONTALFACE_PATH);
|
CascadeClassifier cc = new CascadeClassifier(OpenCVTestRunner.LBPCASCADE_FRONTALFACE_PATH);
|
||||||
ArrayList<Rect> faces = new ArrayList<Rect>();
|
CvVectorRect faces = new CvVectorRect();
|
||||||
|
|
||||||
Mat greyLena = new Mat();
|
Mat greyLena = new Mat();
|
||||||
Imgproc.cvtColor(rgbLena, greyLena, Imgproc.COLOR_RGB2GRAY);
|
Imgproc.cvtColor(rgbLena, greyLena, Imgproc.COLOR_RGB2GRAY);
|
||||||
|
|
||||||
// TODO: doesn't detect with 1.1 scale
|
// 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());
|
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() {
|
public void testDetectMultiScaleMatListOfRectDouble() {
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
package org.opencv.test.objdetect;
|
package org.opencv.test.objdetect;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import org.opencv.core.CvVectorRect;
|
||||||
|
|
||||||
import org.opencv.core.Rect;
|
|
||||||
import org.opencv.objdetect.Objdetect;
|
import org.opencv.objdetect.Objdetect;
|
||||||
import org.opencv.test.OpenCVTestCase;
|
import org.opencv.test.OpenCVTestCase;
|
||||||
|
|
||||||
@ -10,27 +8,27 @@ public class ObjdetectTest extends OpenCVTestCase {
|
|||||||
|
|
||||||
public void testGroupRectanglesListOfRectListOfIntegerInt() {
|
public void testGroupRectanglesListOfRectListOfIntegerInt() {
|
||||||
fail("Not yet implemented");
|
fail("Not yet implemented");
|
||||||
Rect r = new Rect(10, 10, 20, 20);
|
final int NUM = 10;
|
||||||
ArrayList<Rect> rects = new ArrayList<Rect>();
|
CvVectorRect rects = new CvVectorRect(NUM);
|
||||||
|
|
||||||
for (int i = 0; i < 10; i++)
|
for (int i = 0; i < NUM; i++)
|
||||||
rects.add(r);
|
rects.put(i, 0, 10, 10, 20, 20);
|
||||||
|
|
||||||
int groupThreshold = 1;
|
int groupThreshold = 1;
|
||||||
Objdetect.groupRectangles(rects, null, groupThreshold);//TODO: second parameter should not be null
|
Objdetect.groupRectangles(rects, null, groupThreshold);//TODO: second parameter should not be null
|
||||||
assertEquals(1, rects.size());
|
assertEquals(1, rects.total());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGroupRectanglesListOfRectListOfIntegerIntDouble() {
|
public void testGroupRectanglesListOfRectListOfIntegerIntDouble() {
|
||||||
fail("Not yet implemented");
|
fail("Not yet implemented");
|
||||||
Rect r1 = new Rect(10, 10, 20, 20);
|
final int NUM = 10;
|
||||||
Rect r2 = new Rect(10, 10, 25, 25);
|
CvVectorRect rects = new CvVectorRect(NUM);
|
||||||
ArrayList<Rect> rects = new ArrayList<Rect>();
|
|
||||||
|
|
||||||
for (int i = 0; i < 10; i++)
|
for (int i = 0; i < NUM; i++)
|
||||||
rects.add(r1);
|
rects.put(i, 0, 10, 10, 20, 20);
|
||||||
for (int i = 0; i < 10; i++)
|
|
||||||
rects.add(r2);
|
for (int i = 0; i < NUM; i++)
|
||||||
|
rects.put(i, 0, 10, 10, 25, 25);
|
||||||
|
|
||||||
int groupThreshold = 1;
|
int groupThreshold = 1;
|
||||||
double eps = 0.2;
|
double eps = 0.2;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user