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;
}
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;
}
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());
}
}
}
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);
}
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);
}
Aggregations