Search in sources :

Example 41 with GrayU8

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

the class TestBinaryNaiveOps method edge8_border.

@Test
public void edge8_border() {
    GrayU8 input;
    input = createInput(1, 1, 1, 1, 1, 1, 1, 1, 1);
    checkImage("edge8", input, 0, 0, 0, 0, 0, 0, 0, 0, 0);
    input = createInput(0, 0, 0, 0, 1, 0, 0, 0, 0);
    checkImage("edge8", input, 0, 0, 0, 0, 1, 0, 0, 0, 0);
    input = createInput(0, 1, 0, 1, 1, 1, 0, 1, 0);
    checkImage("edge8", input, 0, 1, 0, 1, 1, 1, 0, 1, 0);
}
Also used : GrayU8(boofcv.struct.image.GrayU8) Test(org.junit.Test)

Example 42 with GrayU8

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

the class TestBinaryNaiveOps method erode4_border.

@Test
public void erode4_border() {
    GrayU8 input;
    input = createInput(0, 1, 0, 1, 1, 1, 0, 1, 0);
    checkImage("erode4", input, 0, 0, 0, 0, 1, 0, 0, 0, 0);
    input = createInput(1, 1, 1, 1, 1, 1, 1, 1, 1);
    checkImage("erode4", input, 1, 1, 1, 1, 1, 1, 1, 1, 1);
}
Also used : GrayU8(boofcv.struct.image.GrayU8) Test(org.junit.Test)

Example 43 with GrayU8

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

the class TestBinaryThinning method thinning.

/**
 * Run the overall algorithm and compare against a known result
 */
@Test
public void thinning() {
    GrayU8 img = new GrayU8(20, 25);
    ImageMiscOps.fill(img.subimage(1, 5, 19, 10), 1);
    BinaryThinning alg = new BinaryThinning();
    alg.apply(img, -1);
    // the tests below aren't really that great.  really just checks to see if the algorithm has changed
    assertEquals(24, ImageStatistics.sum(img));
    for (int i = 2; i < 18; i++) {
        assertEquals(1, img.get(i, 7));
    }
}
Also used : GrayU8(boofcv.struct.image.GrayU8) Test(org.junit.Test)

Example 44 with GrayU8

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

the class TestBinaryThinning method findBlackPixels.

@Test
public void findBlackPixels() {
    GrayU8 img = new GrayU8(5, 7);
    img.set(2, 3, 1);
    img.set(4, 1, 1);
    findBlackPixels(img);
    findBlackPixels(BoofTesting.createSubImageOf(img));
}
Also used : GrayU8(boofcv.struct.image.GrayU8) Test(org.junit.Test)

Example 45 with GrayU8

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

the class TestBinaryThinning method checkGenericMask.

@Test
public void checkGenericMask() {
    // manually construct masks which will fit the first of each type of mask
    GrayU8 imgA = new GrayU8(3, 3);
    imgA.data = new byte[] { 0, 0, 0, 0, 1, 0, 1, 1, 1 };
    GrayU8 imgB = new GrayU8(3, 3);
    imgB.data = new byte[] { 0, 0, 0, 1, 1, 0, 1, 1, 0 };
    BinaryThinning alg = new BinaryThinning();
    // these are then rotated through all the perputations
    checkGenericMask(imgA, imgB, alg);
    checkGenericMask(BoofTesting.createSubImageOf(imgA), BoofTesting.createSubImageOf(imgB), alg);
}
Also used : GrayU8(boofcv.struct.image.GrayU8) 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