1 package org.opencv.test.objdetect; 2 3 import org.opencv.core.Mat; 4 import org.opencv.core.MatOfRect; 5 import org.opencv.core.Size; 6 import org.opencv.imgproc.Imgproc; 7 import org.opencv.objdetect.CascadeClassifier; 8 import org.opencv.objdetect.Objdetect; 9 import org.opencv.test.OpenCVTestCase; 10 import org.opencv.test.OpenCVTestRunner; 11 12 public class CascadeClassifierTest extends OpenCVTestCase { 13 14 private CascadeClassifier cc; 15 16 @Override setUp()17 protected void setUp() throws Exception { 18 super.setUp(); 19 20 cc = null; 21 } 22 testCascadeClassifier()23 public void testCascadeClassifier() { 24 cc = new CascadeClassifier(); 25 assertTrue(null != cc); 26 } 27 testCascadeClassifierString()28 public void testCascadeClassifierString() { 29 cc = new CascadeClassifier(OpenCVTestRunner.LBPCASCADE_FRONTALFACE_PATH); 30 assertTrue(null != cc); 31 } 32 testDetectMultiScaleMatListOfRect()33 public void testDetectMultiScaleMatListOfRect() { 34 CascadeClassifier cc = new CascadeClassifier(OpenCVTestRunner.LBPCASCADE_FRONTALFACE_PATH); 35 MatOfRect faces = new MatOfRect(); 36 37 Mat greyLena = new Mat(); 38 Imgproc.cvtColor(rgbLena, greyLena, Imgproc.COLOR_RGB2GRAY); 39 40 // TODO: doesn't detect with 1.1 scale 41 cc.detectMultiScale(greyLena, faces, 1.09, 3, Objdetect.CASCADE_SCALE_IMAGE, new Size(30, 30), new Size()); 42 assertEquals(1, faces.total()); 43 } 44 testDetectMultiScaleMatListOfRectDouble()45 public void testDetectMultiScaleMatListOfRectDouble() { 46 fail("Not yet implemented"); 47 } 48 testDetectMultiScaleMatListOfRectDoubleInt()49 public void testDetectMultiScaleMatListOfRectDoubleInt() { 50 fail("Not yet implemented"); 51 } 52 testDetectMultiScaleMatListOfRectDoubleIntInt()53 public void testDetectMultiScaleMatListOfRectDoubleIntInt() { 54 fail("Not yet implemented"); 55 } 56 testDetectMultiScaleMatListOfRectDoubleIntIntSize()57 public void testDetectMultiScaleMatListOfRectDoubleIntIntSize() { 58 fail("Not yet implemented"); 59 } 60 testDetectMultiScaleMatListOfRectDoubleIntIntSizeSize()61 public void testDetectMultiScaleMatListOfRectDoubleIntIntSizeSize() { 62 fail("Not yet implemented"); 63 } 64 testDetectMultiScaleMatListOfRectListOfIntegerListOfDouble()65 public void testDetectMultiScaleMatListOfRectListOfIntegerListOfDouble() { 66 fail("Not yet implemented"); 67 } 68 testDetectMultiScaleMatListOfRectListOfIntegerListOfDoubleDouble()69 public void testDetectMultiScaleMatListOfRectListOfIntegerListOfDoubleDouble() { 70 fail("Not yet implemented"); 71 } 72 testDetectMultiScaleMatListOfRectListOfIntegerListOfDoubleDoubleInt()73 public void testDetectMultiScaleMatListOfRectListOfIntegerListOfDoubleDoubleInt() { 74 fail("Not yet implemented"); 75 } 76 testDetectMultiScaleMatListOfRectListOfIntegerListOfDoubleDoubleIntInt()77 public void testDetectMultiScaleMatListOfRectListOfIntegerListOfDoubleDoubleIntInt() { 78 fail("Not yet implemented"); 79 } 80 testDetectMultiScaleMatListOfRectListOfIntegerListOfDoubleDoubleIntIntSize()81 public void testDetectMultiScaleMatListOfRectListOfIntegerListOfDoubleDoubleIntIntSize() { 82 fail("Not yet implemented"); 83 } 84 testDetectMultiScaleMatListOfRectListOfIntegerListOfDoubleDoubleIntIntSizeSize()85 public void testDetectMultiScaleMatListOfRectListOfIntegerListOfDoubleDoubleIntIntSizeSize() { 86 fail("Not yet implemented"); 87 } 88 testDetectMultiScaleMatListOfRectListOfIntegerListOfDoubleDoubleIntIntSizeSizeBoolean()89 public void testDetectMultiScaleMatListOfRectListOfIntegerListOfDoubleDoubleIntIntSizeSizeBoolean() { 90 fail("Not yet implemented"); 91 } 92 testEmpty()93 public void testEmpty() { 94 cc = new CascadeClassifier(); 95 assertTrue(cc.empty()); 96 } 97 testLoad()98 public void testLoad() { 99 cc = new CascadeClassifier(); 100 cc.load(OpenCVTestRunner.LBPCASCADE_FRONTALFACE_PATH); 101 assertTrue(!cc.empty()); 102 } 103 104 } 105