Search in sources :

Example 21 with GrayU8

use of boofcv.struct.image.GrayU8 in project BoofCV by lessthanoptimal.

the class TestContourTracer method funk4.

@Test
public void funk4() {
    String s = "101\n" + "111\n" + "101\n";
    GrayU8 pattern = stringToImage(s);
    shiftContourCheck(pattern, 12, ConnectRule.FOUR);
}
Also used : GrayU8(boofcv.struct.image.GrayU8) Test(org.junit.Test)

Example 22 with GrayU8

use of boofcv.struct.image.GrayU8 in project BoofCV by lessthanoptimal.

the class TestContourTracer method interior2.

@Test
public void interior2() {
    String s = "01111\n" + "01101\n" + "11111\n";
    GrayU8 input = stringToImage(s);
    GrayS32 label = new GrayS32(input.width, input.height);
    ContourTracer alg = new ContourTracer(ConnectRule.FOUR);
    // process the image
    alg.setInputs(addBorder(input), label, queue);
    queue.grow();
    alg.trace(2, 3 + 1, 0 + 1, false);
    assertEquals(8, queue.sizeOfTail());
}
Also used : GrayU8(boofcv.struct.image.GrayU8) GrayS32(boofcv.struct.image.GrayS32) Test(org.junit.Test)

Example 23 with GrayU8

use of boofcv.struct.image.GrayU8 in project BoofCV by lessthanoptimal.

the class TestContourTracer method funky3.

@Test
public void funky3() {
    String s = "0100\n" + "0110\n" + "1101\n";
    GrayU8 input = stringToImage(s);
    GrayS32 label = new GrayS32(input.width, input.height);
    ContourTracer alg = new ContourTracer(ConnectRule.EIGHT);
    // process the image
    alg.setInputs(addBorder(input), label, queue);
    queue.grow();
    alg.trace(2, 1 + 1, 0 + 1, true);
    assertEquals(7, queue.totalPoints());
    assertEquals(7, queue.sizeOfTail());
}
Also used : GrayU8(boofcv.struct.image.GrayU8) GrayS32(boofcv.struct.image.GrayS32) Test(org.junit.Test)

Example 24 with GrayU8

use of boofcv.struct.image.GrayU8 in project BoofCV by lessthanoptimal.

the class TestLinearContourLabelChang2004 method print.

private void print(List<Point2D_I32> l, int w, int h) {
    GrayU8 img = new GrayU8(w, h);
    for (Point2D_I32 p : l) {
        img.set(p.x, p.y, 1);
    }
    img.print();
    System.out.println("------------------");
}
Also used : PackedSetsPoint2D_I32(boofcv.struct.PackedSetsPoint2D_I32) Point2D_I32(georegression.struct.point.Point2D_I32) GrayU8(boofcv.struct.image.GrayU8)

Example 25 with GrayU8

use of boofcv.struct.image.GrayU8 in project BoofCV by lessthanoptimal.

the class TestLinearContourLabelChang2004 method test1_8.

@Test
public void test1_8() {
    GrayU8 input = TEST1.clone();
    GrayS32 labeled = new GrayS32(input.width, input.height);
    LinearContourLabelChang2004 alg = new LinearContourLabelChang2004(ConnectRule.EIGHT);
    alg.process(input, labeled);
    assertEquals(1, alg.getContours().size);
    checkContour(alg, labeled, 8);
}
Also used : GrayU8(boofcv.struct.image.GrayU8) GrayS32(boofcv.struct.image.GrayS32) Test(org.junit.Test)

Aggregations

GrayU8 (boofcv.struct.image.GrayU8)417 Test (org.junit.Test)242 BufferedImage (java.awt.image.BufferedImage)53 GrayS32 (boofcv.struct.image.GrayS32)52 GrayF32 (boofcv.struct.image.GrayF32)49 ConvertBufferedImage (boofcv.io.image.ConvertBufferedImage)48 GrayS16 (boofcv.struct.image.GrayS16)45 Planar (boofcv.struct.image.Planar)28 ArrayList (java.util.ArrayList)22 File (java.io.File)17 ListDisplayPanel (boofcv.gui.ListDisplayPanel)16 RectangleLength2D_I32 (georegression.struct.shapes.RectangleLength2D_I32)16 ImageGray (boofcv.struct.image.ImageGray)15 EllipseRotated_F64 (georegression.struct.curve.EllipseRotated_F64)15 Random (java.util.Random)14 Point2D_F64 (georegression.struct.point.Point2D_F64)11 ImageRectangle (boofcv.struct.ImageRectangle)10 GrayU16 (boofcv.struct.image.GrayU16)10 Se3_F64 (georegression.struct.se.Se3_F64)10 Point3D_F64 (georegression.struct.point.Point3D_F64)9