|
|
|
@ -1,8 +1,6 @@ |
|
|
|
|
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; |
|
|
|
|