SuzukiContourProcessor implements ImageAnalyser<FImage> { public static Contour findContours(final FImage image) { return findContours(image, new SuzukiContourProcessor()); }  @Override void analyseImage(final FImage image); static Contour findContours(final FImage image); static Contour findContours(final FImage image, SuzukiContourProcessor proc); void setMinRelativeChildProp(double d); public Contour root; }
@Test public void testFig3() throws Exception { final FImage img = new FImage(new float[][] { new float[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, new float[] { 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0 }, new float[] { 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0 }, new float[] { 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0 }, new float[] { 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0 }, new float[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, }); final FImage imgC = img.clone(); final Contour root = SuzukiContourProcessor.findContours(imgC); final FImage expected = new FImage(new float[][] { new float[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, new float[] { 0, 0, 2, 2, 2, 2, 2, 2, -2, 0, 0, 0 }, new float[] { 0, 0, -3, 0, 0, -4, 0, 0, -2, 0, -5, 0 }, new float[] { 0, 0, -3, 0, 0, -4, 0, 0, -2, 0, 0, 0 }, new float[] { 0, 0, 2, 2, 2, 2, 2, 2, -2, 0, 0, 0 }, new float[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, }); assertTrue(imgC.equals(expected)); System.out.println(root); }