Search in sources :

Example 21 with CameraPinholeBrown

use of boofcv.struct.calib.CameraPinholeBrown in project BoofCV by lessthanoptimal.

the class TestStereoProcessingBase method createStereoParam.

public static StereoParameters createStereoParam(int width, int height) {
    StereoParameters ret = new StereoParameters();
    ret.setRightToLeft(new Se3_F64());
    ret.getRightToLeft().getT().setTo(-0.2, 0.001, -0.012);
    ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ, 0.001, -0.01, 0.0023, ret.getRightToLeft().getR());
    ret.left = new CameraPinholeBrown().fsetK(300, 320, 0, width / 2, height / 2, width, height).fsetRadial(0.1, 1e-4);
    ret.right = new CameraPinholeBrown().fsetK(290, 310, 0, width / 2 + 2, height / 2 - 6, width, height).fsetRadial(0.05, -2e-4);
    return ret;
}
Also used : CameraPinholeBrown(boofcv.struct.calib.CameraPinholeBrown) StereoParameters(boofcv.struct.calib.StereoParameters) Se3_F64(georegression.struct.se.Se3_F64)

Example 22 with CameraPinholeBrown

use of boofcv.struct.calib.CameraPinholeBrown in project BoofCV by lessthanoptimal.

the class ChecksVisOdomKeyFrameManager method createScene.

public VisOdomBundleAdjustment<BTrack> createScene() {
    VisOdomBundleAdjustment<BTrack> scene = new VisOdomBundleAdjustment<>(BTrack::new);
    scene.addCamera(new CameraPinholeBrown(0, 0, 0, 0, 0, width, height));
    return scene;
}
Also used : CameraPinholeBrown(boofcv.struct.calib.CameraPinholeBrown) BTrack(boofcv.alg.sfm.d3.structure.VisOdomBundleAdjustment.BTrack)

Example 23 with CameraPinholeBrown

use of boofcv.struct.calib.CameraPinholeBrown in project BoofCV by lessthanoptimal.

the class TestSelectTracksInFrameForBundleAdjustment method initializeGrid.

@Test
void initializeGrid() {
    var scene = new VisOdomBundleAdjustment<>(BTrack::new);
    var alg = new SelectTracksInFrameForBundleAdjustment(0xBEEF);
    alg.minTrackObservations = 1;
    scene.addCamera(new CameraPinholeBrown(0, 0, 0, 0, 0, width, height));
    for (int i = 0; i < 3; i++) {
        scene.addFrame(i);
    }
    BFrame targetFrame = scene.frames.get(2);
    // create enough tracks for there to be one in each cell
    connectFrames(1, 2, 200, scene);
    for (int i = 0; i < scene.tracks.size; i++) {
        BTrack track = scene.tracks.get(i);
        // pixel coordinates
        int x = (i * 10) % width;
        int y = 10 * ((i * 10) / width);
        // make sure it's false. should be already
        track.selected = false;
        track.findObservationBy(targetFrame).pixel.setTo(x, y);
    }
    // mark this one as active so that it isn't added to a cell. There should only be one empty cell
    scene.tracks.get(2).selected = true;
    // run it
    alg.initializeGrid(targetFrame, width, height, 10);
    // There should be one track in all but one cell
    for (int i = 0; i < alg.grid.cells.size; i++) {
        Info cell = alg.grid.cells.get(i);
        if (i != 2) {
            assertEquals(0, cell.alreadySelected);
            assertEquals(1, cell.unselected.size());
            assertSame(scene.tracks.get(i), cell.unselected.get(0));
        } else {
            assertEquals(1, cell.alreadySelected);
            assertEquals(0, cell.unselected.size());
        }
    }
}
Also used : CameraPinholeBrown(boofcv.struct.calib.CameraPinholeBrown) BFrame(boofcv.alg.sfm.d3.structure.VisOdomBundleAdjustment.BFrame) Info(boofcv.alg.sfm.d3.structure.SelectTracksInFrameForBundleAdjustment.Info) BTrack(boofcv.alg.sfm.d3.structure.VisOdomBundleAdjustment.BTrack) Test(org.junit.jupiter.api.Test)

Example 24 with CameraPinholeBrown

use of boofcv.struct.calib.CameraPinholeBrown in project BoofCV by lessthanoptimal.

the class TestBaseDetectFiducialSquare method noLensSpecified.

@Test
void noLensSpecified() {
    int width = 640, height = 640;
    CameraPinholeBrown intrinsic = new CameraPinholeBrown(500, 500, 0, width / 2, height / 2, width, height);
    checkDetectRender(width, height, intrinsic, false);
}
Also used : CameraPinholeBrown(boofcv.struct.calib.CameraPinholeBrown) Test(org.junit.jupiter.api.Test)

Example 25 with CameraPinholeBrown

use of boofcv.struct.calib.CameraPinholeBrown in project BoofCV by lessthanoptimal.

the class GenericDetectSingleFiducialCalibrationChecks method pinhole_radial_fullview.

/**
 * Simulated scene using a pinhole camera model with radial distortion. Entire target is visible
 */
@Test
void pinhole_radial_fullview() {
    CameraPinholeBrown 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;
        DetectSingleFiducialCalibration detector = createDetector(targetConfigs.get(i));
        renderTarget(targetConfigs.get(i), simulatedTargetWidth, pattern, locations2D);
        simulator.resetScene();
        Se3_F64 markerToWorld = new Se3_F64();
        ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ, 0, Math.PI, 0, markerToWorld.R);
        simulator.addSurface(markerToWorld, simulatedTargetWidth, pattern);
        // up close exploding - center
        markerToWorld.T.setTo(0, 0, 0.5);
        checkRenderedResults(detector, simulator, locations2D);
        // farther away centered
        markerToWorld.T.setTo(0, 0, 1);
        checkRenderedResults(detector, simulator, locations2D);
        markerToWorld.T.setTo(-0.33, 0, 1);
        checkRenderedResults(detector, simulator, locations2D);
        ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ, 0, Math.PI - 1, 0, markerToWorld.getR());
        checkRenderedResults(detector, simulator, locations2D);
        ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ, 0, Math.PI - 1, 0.8, markerToWorld.getR());
        checkRenderedResults(detector, simulator, locations2D);
        markerToWorld.T.setTo(-0.33, 0.33, 1);
        ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ, 0, Math.PI - 1, 0.8, markerToWorld.getR());
        checkRenderedResults(detector, simulator, locations2D);
        markerToWorld.T.setTo(0, -0.20, 1);
        ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ, 0.8, Math.PI, 0.8, markerToWorld.getR());
        checkRenderedResults(detector, simulator, locations2D);
        ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ, 0.8, Math.PI, 1.8, markerToWorld.getR());
        checkRenderedResults(detector, simulator, locations2D);
        markerToWorld.T.setTo(0, -0.15, 1);
        ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ, 0.2, Math.PI, 2.4, markerToWorld.getR());
        checkRenderedResults(detector, simulator, locations2D);
    }
    assertEquals(0, failedToDetect);
}
Also used : DetectSingleFiducialCalibration(boofcv.abst.geo.calibration.DetectSingleFiducialCalibration) SimulatePlanarWorld(boofcv.simulation.SimulatePlanarWorld) GrayF32(boofcv.struct.image.GrayF32) CameraPinholeBrown(boofcv.struct.calib.CameraPinholeBrown) Point2D_F64(georegression.struct.point.Point2D_F64) ArrayList(java.util.ArrayList) Se3_F64(georegression.struct.se.Se3_F64) Test(org.junit.jupiter.api.Test)

Aggregations

CameraPinholeBrown (boofcv.struct.calib.CameraPinholeBrown)99 Test (org.junit.jupiter.api.Test)62 Se3_F64 (georegression.struct.se.Se3_F64)39 GrayF32 (boofcv.struct.image.GrayF32)29 Point2D_F64 (georegression.struct.point.Point2D_F64)19 SimulatePlanarWorld (boofcv.simulation.SimulatePlanarWorld)16 LensDistortionBrown (boofcv.alg.distort.brown.LensDistortionBrown)14 ConvertBufferedImage (boofcv.io.image.ConvertBufferedImage)14 BufferedImage (java.awt.image.BufferedImage)14 ArrayList (java.util.ArrayList)12 CameraPinhole (boofcv.struct.calib.CameraPinhole)11 Point2Transform2_F64 (boofcv.struct.distort.Point2Transform2_F64)10 DMatrixRMaj (org.ejml.data.DMatrixRMaj)10 File (java.io.File)9 StereoParameters (boofcv.struct.calib.StereoParameters)6 GrayU8 (boofcv.struct.image.GrayU8)6 Point3D_F64 (georegression.struct.point.Point3D_F64)6 ImageBase (boofcv.struct.image.ImageBase)5 ImageType (boofcv.struct.image.ImageType)5 DogArray (org.ddogleg.struct.DogArray)5