use of georegression.struct.point.Point2D_F32 in project BoofCV by lessthanoptimal.
the class TestLocalWeightedHistogramRotRect method isInFastBounds.
@Test
public void isInFastBounds() {
DummyInterpolate interp = new DummyInterpolate();
RectangleRotate_F32 rect = new RectangleRotate_F32(4, 5, 10, 20, 0);
LocalWeightedHistogramRotRect alg = new LocalWeightedHistogramRotRect(10, 3, 12, 3, 255, interp);
alg.c = 1;
alg.s = 0;
assertTrue(alg.isInFastBounds(rect));
// see if it checked to see if the four corners are in bounds
assertEquals(4, interp.list.size());
Point2D_F32 p0 = interp.list.get(0);
Point2D_F32 p1 = interp.list.get(1);
Point2D_F32 p2 = interp.list.get(2);
Point2D_F32 p3 = interp.list.get(3);
// the order really doesn't matter, but easier to code the test this way
assertEquals(4f - 4.5f, p0.x, 1e-4f);
assertEquals(5f - 9.5f, p0.y, 1e-4f);
assertEquals(4f - 4.5f, p1.x, 1e-4f);
assertEquals(5f + 9.5f, p1.y, 1e-4f);
assertEquals(4f + 4.5f, p2.x, 1e-4f);
assertEquals(5f + 9.5f, p2.y, 1e-4f);
assertEquals(4f + 4.5f, p3.x, 1e-4f);
assertEquals(5f - 9.5f, p3.y, 1e-4f);
}
use of georegression.struct.point.Point2D_F32 in project BoofCV by lessthanoptimal.
the class TestQrCodeBinaryGridToPixel method check.
private void check(QrCodeBinaryGridToPixel transformGrid, float x, float y, float expectedX, float expectedY) {
Point2D_F32 found = new Point2D_F32();
transformGrid.gridToImage(y, x, found);
assertEquals(expectedX, found.x, 1e-4f);
assertEquals(expectedY, found.y, 1e-4f);
}
use of georegression.struct.point.Point2D_F32 in project BoofCV by lessthanoptimal.
the class ImplPerspectiveOps_F32 method renderPixel.
public static Point2D_F32 renderPixel(Se3_F32 worldToCamera, FMatrixRMaj K, Point3D_F32 X) {
Point3D_F32 X_cam = new Point3D_F32();
SePointOps_F32.transform(worldToCamera, X, X_cam);
// see if it's behind the camera
if (X_cam.z <= 0)
return null;
Point2D_F32 norm = new Point2D_F32(X_cam.x / X_cam.z, X_cam.y / X_cam.z);
if (K == null)
return norm;
// convert into pixel coordinates
return GeometryMath_F32.mult(K, norm, norm);
}
use of georegression.struct.point.Point2D_F32 in project BoofCV by lessthanoptimal.
the class ImplPerspectiveOps_F32 method convertNormToPixel.
public static Point2D_F32 convertNormToPixel(FMatrixRMaj K, Point2D_F32 norm, Point2D_F32 pixel) {
if (pixel == null)
pixel = new Point2D_F32();
PinholeNtoP_F32 alg = new PinholeNtoP_F32();
alg.set(K.get(0, 0), K.get(1, 1), K.get(0, 1), K.get(0, 2), K.get(1, 2));
alg.compute(norm.x, norm.y, pixel);
return pixel;
}
use of georegression.struct.point.Point2D_F32 in project BoofCV by lessthanoptimal.
the class ImplPerspectiveOps_F32 method convertPixelToNorm.
public static Point2D_F32 convertPixelToNorm(FMatrixRMaj K, Point2D_F32 pixel, Point2D_F32 norm) {
if (norm == null)
norm = new Point2D_F32();
PinholePtoN_F32 alg = new PinholePtoN_F32();
alg.set(K.get(0, 0), K.get(1, 1), K.get(0, 1), K.get(0, 2), K.get(1, 2));
alg.compute(pixel.x, pixel.y, norm);
return norm;
}
Aggregations