use of boofcv.struct.calib.StereoParameters in project BoofCV by lessthanoptimal.
the class TestPnPStereoResidualReprojection method compareToReprojection.
@Test
void compareToReprojection() {
Se3_F64 worldToLeft = new Se3_F64();
ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ, 0.1, 1, -0.2, worldToLeft.getR());
worldToLeft.getT().setTo(-0.3, 0.4, 1);
generateScene(10, worldToLeft, false);
// make the input model incorrect
worldToLeft.getR().set(2, 1, 2);
// compute the error in normalized image coordinates per element
PnPStereoResidualReprojection alg = new PnPStereoResidualReprojection();
alg.setModel(new StereoPose(worldToLeft, leftToRight));
// compute errors with perfect model
double[] error = new double[alg.getN()];
alg.computeResiduals(pointPose.get(0), error, 0);
double found = 0;
for (double e : error) {
found += e * e;
}
PnPStereoDistanceReprojectionSq validation = new PnPStereoDistanceReprojectionSq();
StereoParameters param = new StereoParameters();
param.right_to_left = this.param.right_to_left;
// intrinsic parameters are configured to be identical to normalized image coordinates
param.left = new CameraPinholeBrown(1, 1, 0, 0, 0, 0, 0).fsetRadial(0, 0);
param.right = new CameraPinholeBrown(1, 1, 0, 0, 0, 0, 0).fsetRadial(0, 0);
validation.setStereoParameters(param);
validation.setModel(worldToLeft);
double expected = validation.distance(pointPose.get(0));
assertEquals(expected, found, 1e-8);
}
use of boofcv.struct.calib.StereoParameters in project BoofCV by lessthanoptimal.
the class CheckVisualOdometryStereoSim method changeInputSize.
@Test
void changeInputSize() {
StereoVisualOdometry<I> algorithm = createAlgorithm();
I leftSmall = GeneralizedImageOps.createSingleBand(inputType, width / 2, height / 2);
I rightSmall = GeneralizedImageOps.createSingleBand(inputType, width / 2, height / 2);
I leftLarge = GeneralizedImageOps.createSingleBand(inputType, width, height);
I rightLarge = GeneralizedImageOps.createSingleBand(inputType, width, height);
GImageMiscOps.fillUniform(leftSmall, rand, 0, 100);
GImageMiscOps.fillUniform(leftSmall, rand, 0, 100);
GImageMiscOps.fillUniform(leftLarge, rand, 0, 100);
GImageMiscOps.fillUniform(rightLarge, rand, 0, 100);
StereoParameters paramSmall = createStereoParam();
paramSmall.left.width = paramSmall.right.width = leftSmall.width;
paramSmall.left.height = paramSmall.right.height = leftSmall.height;
algorithm.reset();
algorithm.setCalibration(paramSmall);
assertTrue(algorithm.process(leftSmall, rightSmall));
StereoParameters paramLarge = createStereoParam();
paramLarge.left.width = paramLarge.right.width = leftLarge.width;
paramLarge.left.height = paramLarge.right.height = leftLarge.height;
algorithm.reset();
algorithm.setCalibration(paramLarge);
assertTrue(algorithm.process(leftLarge, rightSmall));
}
Aggregations