Search in sources :

Example 11 with GrayS8

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

the class TestImplEdgeNonMaxSuppression method naive8.

@Test
public void naive8() {
    GrayF32 intensity = new GrayF32(3, 3);
    GrayF32 output = new GrayF32(3, 3);
    GrayS8 direction = new GrayS8(3, 3);
    // test it against simple positive and negative cases
    for (int dir = -3; dir < 5; dir++) {
        direction.set(1, 1, dir);
        GImageMiscOps.fill(intensity, 0);
        intensity.set(1, 1, 10);
        // test suppress
        setByDirection8(intensity, dir, 15);
        ImplEdgeNonMaxSuppression.naive8(intensity, direction, output);
        assertEquals(0, output.get(1, 1), 1e-4f);
        // test no suppression
        setByDirection8(intensity, dir, 5);
        ImplEdgeNonMaxSuppression.naive8(intensity, direction, output);
        assertEquals(intensity.get(1, 1), output.get(1, 1), 1e-4f);
    }
}
Also used : GrayF32(boofcv.struct.image.GrayF32) GrayS8(boofcv.struct.image.GrayS8) Test(org.junit.Test)

Example 12 with GrayS8

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

the class TestDescribePlanar method checkNumBands.

/**
 * Sanity check to see if input image and number of descriptors is the same
 */
@Test(expected = IllegalArgumentException.class)
public void checkNumBands() {
    DescribeRegionPoint[] descs = new DummyDesc[3];
    descs[0] = new DummyDesc();
    descs[1] = new DummyDesc();
    descs[2] = new DummyDesc();
    DummyAlg alg = new DummyAlg(descs);
    alg.setImage(new Planar(GrayS8.class, 1, 1, 2));
}
Also used : GrayS8(boofcv.struct.image.GrayS8) DescribeRegionPoint(boofcv.abst.feature.describe.DescribeRegionPoint) Planar(boofcv.struct.image.Planar) Test(org.junit.Test)

Example 13 with GrayS8

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

the class TestDescribePlanar method various.

@Test
public void various() {
    DescribeRegionPoint[] descs = new DummyDesc[3];
    descs[0] = new DummyDesc();
    descs[1] = new DummyDesc();
    descs[2] = new DummyDesc();
    DummyAlg alg = new DummyAlg(descs);
    alg.setImage(new Planar(GrayS8.class, 1, 1, 3));
    alg.process(0, 1, 2, 3, alg.createDescription());
    assertEquals(30, alg.createDescription().size());
    assertEquals(1, alg.numCombined);
    for (int i = 0; i < 3; i++) {
        assertEquals(1, ((DummyDesc) descs[i]).numProcess);
    }
}
Also used : GrayS8(boofcv.struct.image.GrayS8) DescribeRegionPoint(boofcv.abst.feature.describe.DescribeRegionPoint) Planar(boofcv.struct.image.Planar) DescribeRegionPoint(boofcv.abst.feature.describe.DescribeRegionPoint) Test(org.junit.Test)

Example 14 with GrayS8

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

the class TestGradientToEdgeFeatures method nonMaxSuppression4.

@Test
public void nonMaxSuppression4() {
    GrayF32 intensity = new GrayF32(width, height);
    GrayS8 direction = new GrayS8(width, height);
    GrayF32 expected = new GrayF32(width, height);
    GrayF32 found = new GrayF32(width, height);
    BoofTesting.checkSubImage(this, "nonMaxSuppression4", true, intensity, direction, expected, found);
}
Also used : GrayF32(boofcv.struct.image.GrayF32) GrayS8(boofcv.struct.image.GrayS8) Test(org.junit.Test)

Example 15 with GrayS8

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

the class TestGradientToEdgeFeatures method discretizeDirection4.

@Test
public void discretizeDirection4() {
    GrayF32 angle = new GrayF32(5, 5);
    angle.set(0, 0, (float) (3 * Math.PI / 8 + 0.01));
    angle.set(1, 0, (float) (3 * Math.PI / 8 - 0.01));
    angle.set(2, 0, (float) (Math.PI / 4));
    angle.set(3, 0, (float) (Math.PI / 8 + 0.01));
    angle.set(4, 0, (float) (Math.PI / 8 - 0.01));
    angle.set(0, 1, (float) (-3 * Math.PI / 8 + 0.01));
    angle.set(1, 1, (float) (-3 * Math.PI / 8 - 0.01));
    GrayS8 d = new GrayS8(5, 5);
    GradientToEdgeFeatures.discretizeDirection4(angle, d);
    assertEquals(2, d.get(0, 0));
    assertEquals(1, d.get(1, 0));
    assertEquals(1, d.get(2, 0));
    assertEquals(1, d.get(3, 0));
    assertEquals(0, d.get(4, 0));
    assertEquals(-1, d.get(0, 1));
    assertEquals(2, d.get(1, 1));
}
Also used : GrayF32(boofcv.struct.image.GrayF32) GrayS8(boofcv.struct.image.GrayS8) Test(org.junit.Test)

Aggregations

GrayS8 (boofcv.struct.image.GrayS8)21 GrayF32 (boofcv.struct.image.GrayF32)16 Test (org.junit.Test)16 GrayU8 (boofcv.struct.image.GrayU8)5 DescribeRegionPoint (boofcv.abst.feature.describe.DescribeRegionPoint)2 ConvertBufferedImage (boofcv.io.image.ConvertBufferedImage)2 Planar (boofcv.struct.image.Planar)2 BufferedImage (java.awt.image.BufferedImage)2 HysteresisEdgeTraceMark (boofcv.alg.feature.detect.edge.HysteresisEdgeTraceMark)1 ConnectLinesGrid (boofcv.alg.feature.detect.line.ConnectLinesGrid)1 Edgel (boofcv.alg.feature.detect.line.gridline.Edgel)1 GridLineModelDistance (boofcv.alg.feature.detect.line.gridline.GridLineModelDistance)1 GridLineModelFitter (boofcv.alg.feature.detect.line.gridline.GridLineModelFitter)1 ImplGridRansacLineDetector_F32 (boofcv.alg.feature.detect.line.gridline.ImplGridRansacLineDetector_F32)1 ListDisplayPanel (boofcv.gui.ListDisplayPanel)1 ImageLinePanel (boofcv.gui.feature.ImageLinePanel)1 ModelManagerLinePolar2D_F32 (georegression.fitting.line.ModelManagerLinePolar2D_F32)1 LinePolar2D_F32 (georegression.struct.line.LinePolar2D_F32)1 LineSegment2D_F32 (georegression.struct.line.LineSegment2D_F32)1 Ransac (org.ddogleg.fitting.modelset.ransac.Ransac)1