use of boofcv.struct.calib.CameraPinhole in project BoofCV by lessthanoptimal.
the class TestSelfCalibrationLinearDualQuadratic method constructMatrix.
@Test
void constructMatrix() {
List<CameraPinhole> intrinsics = new ArrayList<>();
for (int i = 0; i < 10; i++) {
intrinsics.add(new CameraPinhole(400 + i * 5, 420, 0.1, 0, 0, 0, 0));
}
renderGood(intrinsics);
SelfCalibrationLinearDualQuadratic alg = new SelfCalibrationLinearDualQuadratic(false);
addProjectives(alg);
DMatrixRMaj L = new DMatrixRMaj(3, 3);
alg.constructMatrix(L);
DMatrixRMaj q = new DMatrixRMaj(10, 1);
q.data[0] = Q.get(0, 0);
q.data[1] = Q.get(0, 1);
q.data[2] = Q.get(0, 2);
q.data[3] = Q.get(0, 3);
q.data[4] = Q.get(1, 1);
q.data[5] = Q.get(1, 2);
q.data[6] = Q.get(1, 3);
q.data[7] = Q.get(2, 2);
q.data[8] = Q.get(2, 3);
q.data[9] = Q.get(3, 3);
// double[] sv = SingularOps_DDRM.singularValues(L);
// for (int i = 0; i < sv.length; i++) {
// System.out.println("sv["+i+"] = "+sv[i]);
// }
DMatrixRMaj found = new DMatrixRMaj(L.numRows, 1);
// See if it's the null space
CommonOps_DDRM.mult(L, q, found);
assertEquals(0, NormOps_DDRM.normF(found), 10 * UtilEjml.TEST_F64);
}
use of boofcv.struct.calib.CameraPinhole in project BoofCV by lessthanoptimal.
the class TestSelfCalibrationLinearRotationSingle method performTest.
private void performTest(CameraPinhole intrinsic) {
// compute planes at infinity
List<Homography2D_F64> homographies = new ArrayList<>();
for (int i = 0; i < listP.size(); i++) {
DMatrixRMaj P = listP.get(i);
Equation eq = new Equation();
eq.alias(P, "P", planeAtInfinity, "p");
eq.process("H = P(:,0:2) - P(:,3)*p'");
Homography2D_F64 H = new Homography2D_F64();
DConvertMatrixStruct.convert(eq.lookupDDRM("H"), H);
homographies.add(H);
}
SelfCalibrationLinearRotationSingle alg = new SelfCalibrationLinearRotationSingle();
CameraPinhole found = new CameraPinhole();
assertTrue(alg.estimate(homographies, found));
assertEquals(intrinsic.fx, found.fx, UtilEjml.TEST_F64_SQ);
assertEquals(intrinsic.fy, found.fy, UtilEjml.TEST_F64_SQ);
assertEquals(intrinsic.cx, found.cx, UtilEjml.TEST_F64_SQ);
assertEquals(intrinsic.cy, found.cy, UtilEjml.TEST_F64_SQ);
assertEquals(intrinsic.skew, found.skew, UtilEjml.TEST_F64_SQ);
}
use of boofcv.struct.calib.CameraPinhole in project BoofCV by lessthanoptimal.
the class TestSelfCalibrationLinearRotationSingle method stationary.
/**
* This should fail because there isn't enough visual motion
*/
@Test
void stationary() {
CameraPinhole intrinsic = new CameraPinhole(400, 420, 0.1, 450, 475, 0, 0);
renderStationary(intrinsic);
checkFailure();
}
use of boofcv.struct.calib.CameraPinhole in project BoofCV by lessthanoptimal.
the class TestSelfCalibrationLinearRotationSingle method two_axis.
@Test
void two_axis() {
CameraPinhole intrinsic = new CameraPinhole(400, 420, 0.1, 450, 475, 0, 0);
renderRotateTwoAxis(intrinsic);
performTest(intrinsic);
}
use of boofcv.struct.calib.CameraPinhole in project BoofCV by lessthanoptimal.
the class TestSelfCalibrationLinearRotationSingle method checkFailure.
private void checkFailure() {
// compute planes at infinity
List<Homography2D_F64> homographies = new ArrayList<>();
for (int i = 0; i < listP.size(); i++) {
DMatrixRMaj P = listP.get(i);
Equation eq = new Equation();
eq.alias(P, "P", planeAtInfinity, "p");
eq.process("H = P(:,0:2) - P(:,3)*p'");
Homography2D_F64 H = new Homography2D_F64();
DConvertMatrixStruct.convert(eq.lookupDDRM("H"), H);
homographies.add(H);
}
SelfCalibrationLinearRotationSingle alg = new SelfCalibrationLinearRotationSingle();
CameraPinhole found = new CameraPinhole();
assertFalse(alg.estimate(homographies, found));
}
Aggregations