Search in sources :

Example 11 with RectangleLength2D_I32

use of georegression.struct.shapes.RectangleLength2D_I32 in project BoofCV by lessthanoptimal.

the class TestLikelihoodHueSatHistInd_PL_U8 method multipleColors.

@Test
public void multipleColors() {
    LikelihoodHueSatHistInd_PL_U8 alg = new LikelihoodHueSatHistInd_PL_U8(255, 5);
    Planar<GrayU8> image = new Planar<>(GrayU8.class, 30, 40, 3);
    RectangleLength2D_I32 r0 = new RectangleLength2D_I32(3, 4, 8, 8);
    RectangleLength2D_I32 r1 = new RectangleLength2D_I32(11, 4, 4, 8);
    setColor(image, r0, 100, 105, 12);
    setColor(image, r1, 50, 200, 50);
    RectangleLength2D_I32 region = new RectangleLength2D_I32(3, 4, 12, 8);
    alg.setImage(image);
    alg.createModel(region);
    float v0 = alg.compute(3, 4);
    float v1 = alg.compute(11, 4);
    assertTrue(v0 > v1);
}
Also used : RectangleLength2D_I32(georegression.struct.shapes.RectangleLength2D_I32) Planar(boofcv.struct.image.Planar) GrayU8(boofcv.struct.image.GrayU8) Test(org.junit.Test)

Example 12 with RectangleLength2D_I32

use of georegression.struct.shapes.RectangleLength2D_I32 in project BoofCV by lessthanoptimal.

the class TestContourEdgeIntensity method smallContours.

@Test
public void smallContours() {
    GrayU8 image = new GrayU8(200, 150);
    RectangleLength2D_I32 r = new RectangleLength2D_I32(20, 25, 5, 4);
    ImageMiscOps.fillRectangle(image, 200, r.x0, r.y0, r.width, r.height);
    List<Point2D_I32> contour = rectToContour(r);
    ContourEdgeIntensity<GrayU8> alg = new ContourEdgeIntensity<>(30, 2, 1.0, GrayU8.class);
    alg.setImage(image);
    alg.process(contour, true);
    assertTrue(alg.getOutsideAverage() < 8);
    assertTrue(alg.getInsideAverage() > 195);
}
Also used : RectangleLength2D_I32(georegression.struct.shapes.RectangleLength2D_I32) Point2D_I32(georegression.struct.point.Point2D_I32) GrayU8(boofcv.struct.image.GrayU8) Test(org.junit.Test)

Example 13 with RectangleLength2D_I32

use of georegression.struct.shapes.RectangleLength2D_I32 in project BoofCV by lessthanoptimal.

the class TestContourEdgeIntensity method simpleCase.

@Test
public void simpleCase() {
    GrayU8 image = new GrayU8(200, 150);
    RectangleLength2D_I32 r = new RectangleLength2D_I32(20, 25, 30, 35);
    ImageMiscOps.fillRectangle(image, 200, r.x0, r.y0, r.width, r.height);
    List<Point2D_I32> contour = rectToContour(r);
    ContourEdgeIntensity<GrayU8> alg = new ContourEdgeIntensity<>(20, 2, 1.0, GrayU8.class);
    alg.setImage(image);
    alg.process(contour, true);
    assertTrue(alg.getOutsideAverage() < 8);
    assertTrue(alg.getInsideAverage() > 195);
    // test the CCW flag AND multiple calls
    alg.process(contour, false);
    assertTrue(alg.getOutsideAverage() > 195);
    assertTrue(alg.getInsideAverage() < 8);
    // change the number of contour samples
    alg = new ContourEdgeIntensity<>(10, 2, 1.0, GrayU8.class);
    alg.setImage(image);
    alg.process(contour, true);
    assertTrue(alg.getOutsideAverage() < 8);
    assertTrue(alg.getInsideAverage() > 195);
    // change the number of tangent samples
    alg = new ContourEdgeIntensity<>(20, 1, 1.0, GrayU8.class);
    alg.setImage(image);
    alg.process(contour, true);
    assertTrue(alg.getOutsideAverage() < 8);
    assertTrue(alg.getInsideAverage() > 195);
}
Also used : RectangleLength2D_I32(georegression.struct.shapes.RectangleLength2D_I32) Point2D_I32(georegression.struct.point.Point2D_I32) GrayU8(boofcv.struct.image.GrayU8) Test(org.junit.Test)

Example 14 with RectangleLength2D_I32

use of georegression.struct.shapes.RectangleLength2D_I32 in project BoofCV by lessthanoptimal.

the class Msl_to_TrackerObjectQuad method process.

@Override
public boolean process(T image, Quadrilateral_F64 results) {
    if (!tracker.process(image))
        return false;
    RectangleLength2D_I32 rect = tracker.getLocation();
    UtilPolygons2D_F64.convert(rect, results);
    return true;
}
Also used : RectangleLength2D_I32(georegression.struct.shapes.RectangleLength2D_I32)

Example 15 with RectangleLength2D_I32

use of georegression.struct.shapes.RectangleLength2D_I32 in project BoofCV by lessthanoptimal.

the class TestLikelihoodHistCoupled_PL_U8 method numBins.

@Test
public void numBins() {
    LikelihoodHistCoupled_PL_U8 alg = new LikelihoodHistCoupled_PL_U8(255, 30);
    Planar<GrayU8> image = new Planar<>(GrayU8.class, 30, 40, 3);
    // make sure the upper limit is handled correctly
    setColor(image, 5, 6, 255, 255, 255);
    alg.setImage(image);
    alg.createModel(new RectangleLength2D_I32(5, 6, 1, 1));
    assertEquals(30 * 30 * 30, alg.hist.length);
    assertEquals(1f, alg.hist[alg.hist.length - 1], 1e-4);
}
Also used : RectangleLength2D_I32(georegression.struct.shapes.RectangleLength2D_I32) Planar(boofcv.struct.image.Planar) GrayU8(boofcv.struct.image.GrayU8) Test(org.junit.Test)

Aggregations

RectangleLength2D_I32 (georegression.struct.shapes.RectangleLength2D_I32)24 Test (org.junit.Test)20 GrayU8 (boofcv.struct.image.GrayU8)16 Planar (boofcv.struct.image.Planar)12 Point2D_I32 (georegression.struct.point.Point2D_I32)5 Affine2D_F32 (georegression.struct.affine.Affine2D_F32)2 Polygon2D_F64 (georegression.struct.shapes.Polygon2D_F64)2 GrowQueue_I32 (org.ddogleg.struct.GrowQueue_I32)2 TrackerMeanShiftLikelihood (boofcv.alg.tracker.meanshift.TrackerMeanShiftLikelihood)1 TrackerObjectQuadPanel (boofcv.gui.tracker.TrackerObjectQuadPanel)1 MediaManager (boofcv.io.MediaManager)1 DefaultMediaManager (boofcv.io.wrapper.DefaultMediaManager)1