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