Search in sources :

Example 41 with Point2D_F32

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);
}
Also used : RectangleRotate_F32(boofcv.struct.RectangleRotate_F32) Point2D_F32(georegression.struct.point.Point2D_F32) Test(org.junit.Test)

Example 42 with Point2D_F32

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);
}
Also used : Point2D_F32(georegression.struct.point.Point2D_F32)

Example 43 with Point2D_F32

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);
}
Also used : Point3D_F32(georegression.struct.point.Point3D_F32) Point2D_F32(georegression.struct.point.Point2D_F32)

Example 44 with Point2D_F32

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;
}
Also used : PinholeNtoP_F32(boofcv.alg.distort.pinhole.PinholeNtoP_F32) Point2D_F32(georegression.struct.point.Point2D_F32)

Example 45 with Point2D_F32

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;
}
Also used : PinholePtoN_F32(boofcv.alg.distort.pinhole.PinholePtoN_F32) Point2D_F32(georegression.struct.point.Point2D_F32)

Aggregations

Point2D_F32 (georegression.struct.point.Point2D_F32)98 Test (org.junit.Test)36 Point3D_F32 (georegression.struct.point.Point3D_F32)10 Point2Transform2_F32 (boofcv.struct.distort.Point2Transform2_F32)9 LineSegment2D_F32 (georegression.struct.line.LineSegment2D_F32)8 ArrayList (java.util.ArrayList)8 Point2D_F64 (georegression.struct.point.Point2D_F64)7 FMatrixRMaj (org.ejml.data.FMatrixRMaj)7 CameraPinholeRadial (boofcv.struct.calib.CameraPinholeRadial)5 LineParametric2D_F32 (georegression.struct.line.LineParametric2D_F32)5 Point2Transform3_F32 (boofcv.struct.distort.Point2Transform3_F32)4 Point3Transform2_F32 (boofcv.struct.distort.Point3Transform2_F32)4 GrayF32 (boofcv.struct.image.GrayF32)4 ClosestPoint2D_F32 (georegression.metric.ClosestPoint2D_F32)4 PointToPixelTransform_F32 (boofcv.alg.distort.PointToPixelTransform_F32)3 CameraPinhole (boofcv.struct.calib.CameraPinhole)3 GrayU8 (boofcv.struct.image.GrayU8)3 PixelTransformCached_F32 (boofcv.alg.distort.PixelTransformCached_F32)2 PinholePtoN_F32 (boofcv.alg.distort.pinhole.PinholePtoN_F32)2 CalibrationObservation (boofcv.alg.geo.calibration.CalibrationObservation)2