Search in sources :

Example 76 with Se3_F64

use of georegression.struct.se.Se3_F64 in project BoofCV by lessthanoptimal.

the class GenericQrCodeDetectorChecks method skewed.

/**
 * The marker is at a skewed angle and rotating
 */
@Test
public void skewed() {
    QrCodeDetector<GrayF32> detector = createDetector();
    CameraPinholeRadial model = CalibrationIO.load(getClass().getResource("calib/pinhole_radial.yaml"));
    SimulatePlanarWorld simulator = new SimulatePlanarWorld();
    simulator.setCamera(model);
    simulator.resetScene();
    Se3_F64 markerToWorld = new Se3_F64();
    simulator.addTarget(markerToWorld, simulatedTargetWidth, generateMarker());
    markerToWorld.T.set(0, 0, 0.5);
    for (int i = 0; i < 30; i++) {
        double roll = 2 * Math.PI * i / 30.0;
        double pitch = Math.PI * 0.3;
        ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ, pitch, 0, roll, markerToWorld.R);
        renderAndCheck(detector, simulator);
    }
}
Also used : SimulatePlanarWorld(boofcv.simulation.SimulatePlanarWorld) GrayF32(boofcv.struct.image.GrayF32) CameraPinholeRadial(boofcv.struct.calib.CameraPinholeRadial) Se3_F64(georegression.struct.se.Se3_F64) Test(org.junit.Test)

Example 77 with Se3_F64

use of georegression.struct.se.Se3_F64 in project BoofCV by lessthanoptimal.

the class GenericPlanarCalibrationDetectorChecks method pinhole_radial_fullview.

/**
 * Simulated scene using a pinhole camera model with radial distortion. Entire target is visible
 */
@Test
public void pinhole_radial_fullview() {
    CameraPinholeRadial model = CalibrationIO.load(getClass().getResource("pinhole_radial.yaml"));
    SimulatePlanarWorld simulator = new SimulatePlanarWorld();
    simulator.setCamera(model);
    List<Point2D_F64> locations2D = new ArrayList<>();
    GrayF32 pattern = new GrayF32(1, 1);
    for (int i = 0; i < targetConfigs.size(); i++) {
        // System.out.println("*---------- Configuration "+i);
        failedToDetect = 0;
        DetectorFiducialCalibration detector = createDetector(targetConfigs.get(i));
        renderTarget(targetConfigs.get(i), simulatedTargetWidth, pattern, locations2D);
        simulator.resetScene();
        Se3_F64 markerToWorld = new Se3_F64();
        simulator.addTarget(markerToWorld, simulatedTargetWidth, pattern);
        // up close exploding - center
        markerToWorld.T.set(0, 0, 0.5);
        checkRenderedResults(detector, simulator, locations2D);
        // farther away centered
        markerToWorld.T.set(0, 0, 1);
        checkRenderedResults(detector, simulator, locations2D);
        markerToWorld.T.set(-0.33, 0, 1);
        checkRenderedResults(detector, simulator, locations2D);
        ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ, 0, -1, 0, markerToWorld.getR());
        checkRenderedResults(detector, simulator, locations2D);
        ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ, 0, -1, 0.8, markerToWorld.getR());
        checkRenderedResults(detector, simulator, locations2D);
        markerToWorld.T.set(-0.33, 0.33, 1);
        ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ, 0, -1, 0.8, markerToWorld.getR());
        checkRenderedResults(detector, simulator, locations2D);
        markerToWorld.T.set(0, -0.20, 1);
        ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ, 0.8, -1, 0.8, markerToWorld.getR());
        checkRenderedResults(detector, simulator, locations2D);
        ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ, 0.8, -1, 1.8, markerToWorld.getR());
        checkRenderedResults(detector, simulator, locations2D);
        markerToWorld.T.set(0, -0.15, 1);
        ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ, 0.2, -1, 2.4, markerToWorld.getR());
        checkRenderedResults(detector, simulator, locations2D);
    }
    assertEquals(0, failedToDetect);
}
Also used : SimulatePlanarWorld(boofcv.simulation.SimulatePlanarWorld) DetectorFiducialCalibration(boofcv.abst.geo.calibration.DetectorFiducialCalibration) GrayF32(boofcv.struct.image.GrayF32) CameraPinholeRadial(boofcv.struct.calib.CameraPinholeRadial) Point2D_F64(georegression.struct.point.Point2D_F64) ArrayList(java.util.ArrayList) Se3_F64(georegression.struct.se.Se3_F64) Test(org.junit.Test)

Example 78 with Se3_F64

use of georegression.struct.se.Se3_F64 in project BoofCV by lessthanoptimal.

the class TestCalibrationDetectorCircleRegularGrid method createFisheyePoses.

/**
 * Reduce the intensity of fisheye distortion by moving the markers away from the border
 */
@Override
protected void createFisheyePoses() {
    Se3_F64 markerToWorld = new Se3_F64();
    // up close exploding - center
    markerToWorld.T.set(0, 0, 0.08);
    fisheye_poses.add(markerToWorld.copy());
    // up close exploding - left
    markerToWorld.T.set(0.1, 0, 0.18);
    fisheye_poses.add(markerToWorld.copy());
    markerToWorld.T.set(0.25, 0, 0.2);
    fisheye_poses.add(markerToWorld.copy());
    ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ, 0, -0.2, 0, markerToWorld.getR());
    fisheye_poses.add(markerToWorld.copy());
    markerToWorld.T.set(0.3, 0, 0.15);
    ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ, 0, -1, 0, markerToWorld.getR());
    fisheye_poses.add(markerToWorld.copy());
    ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ, 0, -1, 0.15, markerToWorld.getR());
    fisheye_poses.add(markerToWorld.copy());
    ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ, 0, -1, 0.27, markerToWorld.getR());
    fisheye_poses.add(markerToWorld.copy());
}
Also used : Se3_F64(georegression.struct.se.Se3_F64)

Example 79 with Se3_F64

use of georegression.struct.se.Se3_F64 in project BoofCV by lessthanoptimal.

the class VisualOdometryPanel method setCameraToWorld.

public void setCameraToWorld(Se3_F64 cameraToWorld) {
    displayX.setText(String.format("%6.1f", cameraToWorld.getT().x));
    displayY.setText(String.format("%6.1f", cameraToWorld.getT().y));
    displayZ.setText(String.format("%6.1f", cameraToWorld.getT().z));
    Vector3D_F64 v = new Vector3D_F64(0, 0, 1);
    GeometryMath_F64.mult(cameraToWorld.getR(), v, v);
    orientation.setVector(v);
    orientation.repaint();
    displayOrigin.setText(String.format("%6.1f", cameraToWorld.getT().norm()));
    if (prevToWorld == null) {
        prevToWorld = cameraToWorld.copy();
    } else {
        Se3_F64 worldToPrev = prevToWorld.invert(null);
        cameraToWorld.concat(worldToPrev, prevToWorld);
        integral += prevToWorld.getT().norm();
        prevToWorld.set(cameraToWorld);
    }
    displayIntegral.setText(String.format("%6.1f", integral));
}
Also used : Vector3D_F64(georegression.struct.point.Vector3D_F64) Se3_F64(georegression.struct.se.Se3_F64)

Example 80 with Se3_F64

use of georegression.struct.se.Se3_F64 in project BoofCV by lessthanoptimal.

the class VisualOdometryPanel2 method setCameraToWorld.

public void setCameraToWorld(Se3_F64 cameraToWorld) {
    Vector3D_F64 v = new Vector3D_F64(0, 0, 1);
    GeometryMath_F64.mult(cameraToWorld.getR(), v, v);
    orientation.setVector(v);
    orientation.repaint();
    displayOrigin.setText(String.format("%6.1f", cameraToWorld.getT().norm()));
    if (prevToWorld == null) {
        prevToWorld = cameraToWorld.copy();
    } else {
        Se3_F64 worldToPrev = prevToWorld.invert(null);
        cameraToWorld.concat(worldToPrev, prevToWorld);
        integral += prevToWorld.getT().norm();
        prevToWorld.set(cameraToWorld);
    }
    displayIntegral.setText(String.format("%6.1f", integral));
}
Also used : Vector3D_F64(georegression.struct.point.Vector3D_F64) Se3_F64(georegression.struct.se.Se3_F64)

Aggregations

Se3_F64 (georegression.struct.se.Se3_F64)214 Test (org.junit.Test)83 Point3D_F64 (georegression.struct.point.Point3D_F64)74 Point2D_F64 (georegression.struct.point.Point2D_F64)68 DMatrixRMaj (org.ejml.data.DMatrixRMaj)52 Point2D3D (boofcv.struct.geo.Point2D3D)31 Vector3D_F64 (georegression.struct.point.Vector3D_F64)30 ArrayList (java.util.ArrayList)27 CameraPinholeRadial (boofcv.struct.calib.CameraPinholeRadial)26 GrayF32 (boofcv.struct.image.GrayF32)18 AssociatedPair (boofcv.struct.geo.AssociatedPair)17 StereoParameters (boofcv.struct.calib.StereoParameters)12 GrayU8 (boofcv.struct.image.GrayU8)10 BufferedImage (java.awt.image.BufferedImage)10 PointTrack (boofcv.abst.feature.tracker.PointTrack)9 ConvertBufferedImage (boofcv.io.image.ConvertBufferedImage)9 Stereo2D3D (boofcv.struct.sfm.Stereo2D3D)9 ModelManagerSe3_F64 (georegression.fitting.se.ModelManagerSe3_F64)9 RectifyCalibrated (boofcv.alg.geo.rectify.RectifyCalibrated)8 LensDistortionNarrowFOV (boofcv.alg.distort.LensDistortionNarrowFOV)7