use of boofcv.alg.geo.bundle.CodecSceneStructureMetric in project BoofCV by lessthanoptimal.
the class CalibrateStereoPlanar method computeErrors.
public List<ImageResults> computeErrors() {
final SceneStructureMetric structure = bundleUtils.getStructure();
final SceneObservations observations = bundleUtils.getObservations();
List<ImageResults> errors = new ArrayList<>();
double[] parameters = new double[structure.getParameterCount()];
double[] residuals = new double[observations.getObservationCount() * 2];
CodecSceneStructureMetric codec = new CodecSceneStructureMetric();
codec.encode(structure, parameters);
BundleAdjustmentMetricResidualFunction function = new BundleAdjustmentMetricResidualFunction();
function.configure(structure, observations);
function.process(parameters, residuals);
int idx = 0;
for (int i = 0; i < observations.viewsRigid.size; i++) {
SceneObservations.View v = observations.viewsRigid.data[i];
ImageResults r = new ImageResults(v.size());
double sumX = 0;
double sumY = 0;
double meanErrorMag = 0;
double maxError = 0;
for (int j = 0; j < v.size(); j++) {
double x = residuals[idx++];
double y = residuals[idx++];
double nerr = r.pointError[j] = Math.sqrt(x * x + y * y);
meanErrorMag += nerr;
maxError = Math.max(maxError, nerr);
sumX += x;
sumY += y;
}
r.biasX = sumX / v.size();
r.biasY = sumY / v.size();
r.meanError = meanErrorMag / v.size();
r.maxError = maxError;
errors.add(r);
}
return errors;
}
use of boofcv.alg.geo.bundle.CodecSceneStructureMetric in project BoofCV by lessthanoptimal.
the class CalibrationPlanarGridZhang99 method computeErrors.
public List<ImageResults> computeErrors() {
List<ImageResults> errors = new ArrayList<>();
double[] parameters = new double[structure.getParameterCount()];
double[] residuals = new double[observations.getObservationCount() * 2];
CodecSceneStructureMetric codec = new CodecSceneStructureMetric();
codec.encode(structure, parameters);
BundleAdjustmentMetricResidualFunction function = new BundleAdjustmentMetricResidualFunction();
function.configure(structure, observations);
function.process(parameters, residuals);
int idx = 0;
for (int i = 0; i < observations.viewsRigid.size; i++) {
SceneObservations.View v = observations.viewsRigid.data[i];
ImageResults r = new ImageResults(v.size());
double sumX = 0;
double sumY = 0;
double meanErrorMag = 0;
double maxError = 0;
for (int j = 0; j < v.size(); j++) {
double x = r.residuals[j * 2] = residuals[idx++];
double y = r.residuals[j * 2 + 1] = residuals[idx++];
double nerr = r.pointError[j] = Math.sqrt(x * x + y * y);
meanErrorMag += nerr;
maxError = Math.max(maxError, nerr);
sumX += x;
sumY += y;
}
r.biasX = sumX / v.size();
r.biasY = sumY / v.size();
r.meanError = meanErrorMag / v.size();
r.maxError = maxError;
errors.add(r);
}
return errors;
}
Aggregations