use of boofcv.abst.geo.bundle.SceneObservations in project BoofCV by lessthanoptimal.
the class TestBundleAdjustmentProjectiveResidualFunction method multipleCalls.
void multipleCalls(boolean homogenous) {
SceneStructureProjective structure = homogenous ? createSceneH(rand) : createScene3D(rand);
SceneObservations obs = createObservations(rand, structure);
double[] param = new double[structure.getParameterCount()];
new CodecSceneStructureProjective().encode(structure, param);
BundleAdjustmentProjectiveResidualFunction alg = new BundleAdjustmentProjectiveResidualFunction();
alg.configure(structure, obs);
double[] expected = new double[alg.getNumOfOutputsM()];
double[] found = new double[alg.getNumOfOutputsM()];
alg.process(param, expected);
alg.process(param, found);
assertArrayEquals(expected, found, UtilEjml.TEST_F64);
}
use of boofcv.abst.geo.bundle.SceneObservations in project BoofCV by lessthanoptimal.
the class TestBundleAdjustmentProjectiveSchurJacobian_DSCC method compareToNumerical_Homogenous.
@Test
void compareToNumerical_Homogenous() {
SceneStructureProjective structure = createSceneH(rand);
SceneObservations observations = createObservations(rand, structure);
double[] param = new double[structure.getParameterCount()];
new CodecSceneStructureProjective().encode(structure, param);
BundleAdjustmentProjectiveSchurJacobian_DSCC alg = new BundleAdjustmentProjectiveSchurJacobian_DSCC();
FunctionNtoMxN<DMatrixSparseCSC> jac = new SchurJacobian_to_NtoMxN.DSCC(alg);
BundleAdjustmentProjectiveResidualFunction func = new BundleAdjustmentProjectiveResidualFunction();
alg.configure(structure, observations);
func.configure(structure, observations);
// DerivativeChecker.jacobianPrint(func, jac, param, 0.1 );
assertTrue(DerivativeChecker.jacobian(func, jac, param, 0.1));
}
use of boofcv.abst.geo.bundle.SceneObservations in project BoofCV by lessthanoptimal.
the class CommonBundleAdjustmentMetricSchurJacobian method compareToNumerical_relative.
public void compareToNumerical_relative(boolean homogenous) {
SceneStructureMetric structure = createScene(rand, homogenous, false, true);
SceneObservations observations = createObservations(rand, structure);
// Try different patterns of relative views and attempt to cover all the edge cases
compareToNumerical_relative(new boolean[] { true, true, true, false }, structure, observations);
compareToNumerical_relative(new boolean[] { true, true, false, true }, structure, observations);
compareToNumerical_relative(new boolean[] { true, true, false, false }, structure, observations);
compareToNumerical_relative(new boolean[] { true, false, false, false }, structure, observations);
compareToNumerical_relative(new boolean[] { true, false, true, false }, structure, observations);
compareToNumerical_relative(new boolean[] { false, true, true, true }, structure, observations);
}
use of boofcv.abst.geo.bundle.SceneObservations in project BoofCV by lessthanoptimal.
the class CommonBundleAdjustmentMetricSchurJacobian method compareToNumerical.
public void compareToNumerical(BundleAdjustmentMetricSchurJacobian<M> alg, boolean homogenous, boolean hasRigid, boolean hasRelative) {
SceneStructureMetric structure = createScene(rand, homogenous, hasRigid, hasRelative);
SceneObservations observations = createObservations(rand, structure);
var param = new double[structure.getParameterCount()];
new CodecSceneStructureMetric().encode(structure, param);
var jac = createJacobian(alg);
var func = new BundleAdjustmentMetricResidualFunction();
alg.configure(structure, observations);
func.configure(structure, observations);
// TODO I think the Rodrigues jacobian is computed in a numerically unstable way.
// multiplying tolerance by 100 is ridiculous
// DerivativeChecker.jacobianPrint(func, jac, param, 100*UtilEjml.TEST_F64_SQ );
assertTrue(DerivativeChecker.jacobian(func, jac, param, 110 * UtilEjml.TEST_F64_SQ));
}
use of boofcv.abst.geo.bundle.SceneObservations in project BoofCV by lessthanoptimal.
the class CommonBundleAdjustmentMetricSchurJacobian method sameMotionInChain.
public void sameMotionInChain(boolean homogenous) {
SceneStructureMetric structure = createSceneChainSameMotion(rand, homogenous);
SceneObservations observations = createObservations(rand, structure);
var param = new double[structure.getParameterCount()];
new CodecSceneStructureMetric().encode(structure, param);
var alg = createAlg();
var jac = createJacobian(alg);
var func = new BundleAdjustmentMetricResidualFunction();
alg.configure(structure, observations);
func.configure(structure, observations);
// DerivativeChecker.jacobianPrint(func, jac, param, 100*UtilEjml.TEST_F64_SQ );
assertTrue(DerivativeChecker.jacobian(func, jac, param, 100 * UtilEjml.TEST_F64_SQ));
}
Aggregations