use of georegression.struct.point.Point2D_I32 in project BoofCV by lessthanoptimal.
the class TestBinaryEllipseDetectorPixel method undistortContour.
/**
* Undistort the image when no distoriton is provided
*/
@Test
public void undistortContour() {
List<Point2D_I32> input = new ArrayList<>();
FastQueue<Point2D_F64> output = new FastQueue<>(Point2D_F64.class, true);
for (int i = 0; i < 10; i++) {
input.add(new Point2D_I32(i, i));
}
BinaryEllipseDetectorPixel alg = new BinaryEllipseDetectorPixel();
alg.undistortContour(input, output);
assertEquals(input.size(), output.size);
for (int i = 0; i < input.size(); i++) {
Point2D_I32 p = input.get(i);
assertEquals(p.x, output.get(i).x, 1e-8);
assertEquals(p.y, output.get(i).y, 1e-8);
}
}
use of georegression.struct.point.Point2D_I32 in project BoofCV by lessthanoptimal.
the class TestDetectPolygonFromContour method touchesBorder_false.
@Test
public void touchesBorder_false() {
List<Point2D_I32> contour = new ArrayList<>();
DetectPolygonFromContour alg = createDetector(GrayU8.class, 4, 4);
alg.getLabeled().reshape(20, 30);
assertFalse(alg.touchesBorder(contour));
contour.add(new Point2D_I32(10, 1));
assertFalse(alg.touchesBorder(contour));
contour.add(new Point2D_I32(10, 28));
assertFalse(alg.touchesBorder(contour));
contour.add(new Point2D_I32(1, 15));
assertFalse(alg.touchesBorder(contour));
contour.add(new Point2D_I32(18, 15));
assertFalse(alg.touchesBorder(contour));
}
use of georegression.struct.point.Point2D_I32 in project BoofCV by lessthanoptimal.
the class TestRefinePolygonToContour method reverseOrder.
@Test
public void reverseOrder() {
RectangleLength2D_I32 rect = new RectangleLength2D_I32(0, 0, 10, 5);
List<Point2D_I32> contour = rectToContour(rect);
GrowQueue_I32 vertexes = computeContourVertexes(rect);
flip(vertexes.data, vertexes.size);
RefinePolygonToContour alg = new RefinePolygonToContour();
Polygon2D_F64 found = new Polygon2D_F64();
alg.process(contour, vertexes, found);
assertTrue(checkPolygon(new double[] { 0, 0, 0, 4, 9, 4, 9, 0 }, found));
}
use of georegression.struct.point.Point2D_I32 in project BoofCV by lessthanoptimal.
the class TestRefinePolygonToContour method basic.
@Test
public void basic() {
RectangleLength2D_I32 rect = new RectangleLength2D_I32(0, 0, 10, 5);
List<Point2D_I32> contour = rectToContour(rect);
GrowQueue_I32 vertexes = computeContourVertexes(rect);
RefinePolygonToContour alg = new RefinePolygonToContour();
Polygon2D_F64 found = new Polygon2D_F64();
alg.process(contour, vertexes, found);
assertTrue(checkPolygon(new double[] { 0, 0, 9, 0, 9, 4, 0, 4 }, found));
}
use of georegression.struct.point.Point2D_I32 in project BoofCV by lessthanoptimal.
the class TestMinimizeEnergyPrune method prine_no_change.
/**
* Perfect case. See if it does nothing
*/
@Test
public void prine_no_change() {
List<Point2D_I32> contours = createSquare(10, 12, 20, 30);
GrowQueue_I32 corners = createSquareCorners(10, 12, 20, 30);
MinimizeEnergyPrune alg = new MinimizeEnergyPrune(1);
GrowQueue_I32 output = new GrowQueue_I32();
alg.prune(contours, corners, output);
assertEquals(corners.size(), output.size());
for (int i = 0; i < corners.size(); i++) {
assertEquals(corners.get(i), output.get(i));
}
}
Aggregations