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);
}
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);
}
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);
}
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;
}
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);
}
Aggregations