use of georegression.struct.point.Point2D_F32 in project BoofCV by lessthanoptimal.
the class TestPointTransformHomography_F32 method compareToDirect.
/**
* Directly computes the output
*/
@Test
public void compareToDirect() {
Point2D_F32 input = new Point2D_F32(50, 60);
Point2D_F32 output = new Point2D_F32();
Point2D_F32 expected = new Point2D_F32();
Homography2D_F32 H = new Homography2D_F32(1, 2, 3, 4, 5, 6, 7, 8, 9);
HomographyPointOps_F32.transform(H, input, expected);
PointTransformHomography_F32 alg = new PointTransformHomography_F32();
alg.set(H);
alg.compute(input.x, input.y, output);
assertEquals(expected.x, output.x, 1e-4);
assertEquals(expected.y, output.y, 1e-4);
}
use of georegression.struct.point.Point2D_F32 in project BoofCV by lessthanoptimal.
the class TestImageDeformPointMLS_F32 method checkNoTransform.
private void checkNoTransform(ImageDeformPointMLS_F32 alg) {
alg.fixateUndistorted();
alg.fixateDistorted();
// should be no change now
Point2D_F32 found = new Point2D_F32();
for (int i = 0; i < height; i++) {
for (int j = 0; j < width; j++) {
alg.compute(j, i, found);
assertEquals(j, found.x, GrlConstants.TEST_F32);
assertEquals(i, found.y, GrlConstants.TEST_F32);
}
}
}
use of georegression.struct.point.Point2D_F32 in project BoofCV by lessthanoptimal.
the class TestImageDeformPointMLS_F32 method CheckInterpolated.
private void CheckInterpolated(float x, float y, float expectedX, float expectedY, ImageDeformPointMLS_F32 alg) {
Point2D_F32 p = new Point2D_F32();
alg.interpolateDeformedPoint(x, y, p);
assertEquals(expectedX, p.x, GrlConstants.TEST_F32);
assertEquals(expectedY, p.y, GrlConstants.TEST_F32);
}
use of georegression.struct.point.Point2D_F32 in project BoofCV by lessthanoptimal.
the class TestImageDeformPointMLS_F32 method checkCompute.
private void checkCompute(float x, float y, float expectedX, float expectedY, ImageDeformPointMLS_F32 alg) {
Point2D_F32 found = new Point2D_F32();
alg.compute(x, y, found);
assertEquals(expectedX, found.x, GrlConstants.TEST_F32);
assertEquals(expectedY, found.y, GrlConstants.TEST_F32);
}
use of georegression.struct.point.Point2D_F32 in project BoofCV by lessthanoptimal.
the class TestImageDeformPointMLS_F32 method testAllAtOnce_CloserToCloser.
/**
* See if the distorted point is closer to the closest control point
*/
@Test
public void testAllAtOnce_CloserToCloser() {
for (TypeDeformMLS type : TypeDeformMLS.values()) {
ImageDeformPointMLS_F32 alg = new ImageDeformPointMLS_F32(type);
alg.configure(width, height, rows, cols);
alg.addControl(5, 5);
alg.addControl(10, 20);
alg.addControl(30, 50);
alg.addControl(16, 0);
alg.setDistorted(0, 10, 12);
alg.setDistorted(1, 14, 30);
alg.setDistorted(2, 25, 45);
alg.setDistorted(3, 20, 8);
alg.fixateUndistorted();
alg.fixateDistorted();
Point2D_F32 a = new Point2D_F32();
Point2D_F32 b = new Point2D_F32();
alg.compute(4, 4, a);
alg.compute(1, 4, b);
float distA = a.distance(10, 12);
float distB = b.distance(10, 12);
assertTrue(distA < distB);
}
}
Aggregations