Search in sources :

Example 1 with Vector3D_F32

use of georegression.struct.point.Vector3D_F32 in project BoofCV by lessthanoptimal.

the class TestNarrowToWidePtoP_F32 method checkFOVBounds.

/**
 * Request points at the border and see if it has the expected vertical and horizontal FOV
 */
@Test
public void checkFOVBounds() {
    NarrowToWidePtoP_F32 alg = createAlg();
    Point2D_F32 foundA = new Point2D_F32();
    Point2D_F32 foundB = new Point2D_F32();
    Point3D_F32 vA = new Point3D_F32();
    Point3D_F32 vB = new Point3D_F32();
    // Compute the horizontal FOV
    alg.compute(0, 250, foundA);
    alg.compute(500, 250, foundB);
    Point2Transform3_F32 wideToSphere = createModelWide().undistortPtoS_F32();
    wideToSphere.compute(foundA.x, foundA.y, vA);
    wideToSphere.compute(foundB.x, foundB.y, vB);
    float found = UtilVector3D_F32.acute(new Vector3D_F32(vA), new Vector3D_F32(vB));
    float expected = 2.0f * (float) Math.atan(250.0f / 400.0f);
    assertEquals(expected, found, 0.01f);
    // Compute the vertical FOV
    alg.compute(250, 0, foundA);
    alg.compute(250, 500, foundB);
    wideToSphere.compute(foundA.x, foundA.y, vA);
    wideToSphere.compute(foundB.x, foundB.y, vB);
    found = UtilVector3D_F32.acute(new Vector3D_F32(vA), new Vector3D_F32(vB));
    expected = 2.0f * (float) Math.atan(250.0f / 400.0f);
    assertEquals(expected, found, 0.001f);
}
Also used : Point3D_F32(georegression.struct.point.Point3D_F32) Vector3D_F32(georegression.struct.point.Vector3D_F32) UtilVector3D_F32(georegression.geometry.UtilVector3D_F32) Point2D_F32(georegression.struct.point.Point2D_F32) Point2Transform3_F32(boofcv.struct.distort.Point2Transform3_F32) Test(org.junit.Test)

Example 2 with Vector3D_F32

use of georegression.struct.point.Vector3D_F32 in project BoofCV by lessthanoptimal.

the class DisplayFisheyeCalibrationPanel method setPinholeCenter.

public void setPinholeCenter(double pixelX, double pixelY) {
    this.pixelX = pixelX;
    this.pixelY = pixelY;
    Point3D_F32 norm = new Point3D_F32();
    fisheyeDistort.undistortPtoS_F32().compute((float) pixelX, (float) pixelY, norm);
    Rodrigues_F32 rotation = new Rodrigues_F32();
    Vector3D_F32 canonical = new Vector3D_F32(0, 0, 1);
    rotation.theta = UtilVector3D_F32.acute(new Vector3D_F32(norm), canonical);
    GeometryMath_F32.cross(canonical, norm, rotation.unitAxisRotation);
    rotation.unitAxisRotation.normalize();
    FMatrixRMaj R = ConvertRotation3D_F32.rodriguesToMatrix(rotation, null);
    distorter.setRotationWideToNarrow(R);
    distortImage.setModel(new PointToPixelTransform_F32(distorter));
}
Also used : Point3D_F32(georegression.struct.point.Point3D_F32) Vector3D_F32(georegression.struct.point.Vector3D_F32) UtilVector3D_F32(georegression.geometry.UtilVector3D_F32) FMatrixRMaj(org.ejml.data.FMatrixRMaj) Rodrigues_F32(georegression.struct.so.Rodrigues_F32)

Aggregations

UtilVector3D_F32 (georegression.geometry.UtilVector3D_F32)2 Point3D_F32 (georegression.struct.point.Point3D_F32)2 Vector3D_F32 (georegression.struct.point.Vector3D_F32)2 Point2Transform3_F32 (boofcv.struct.distort.Point2Transform3_F32)1 Point2D_F32 (georegression.struct.point.Point2D_F32)1 Rodrigues_F32 (georegression.struct.so.Rodrigues_F32)1 FMatrixRMaj (org.ejml.data.FMatrixRMaj)1 Test (org.junit.Test)1