Search in sources :

Example 6 with ImageResults

use of boofcv.abst.geo.calibration.ImageResults in project BoofCV by lessthanoptimal.

the class FisheyePlanarPanel method updateResultsGUI.

@Override
protected void updateResultsGUI() {
    if (selectedImage < results.size()) {
        ImageResults r = results.get(selectedImage);
        String textMean = String.format("%5.1e", r.meanError);
        String textMax = String.format("%5.1e", r.maxError);
        meanError.setText(textMean);
        maxError.setText(textMax);
    }
}
Also used : ImageResults(boofcv.abst.geo.calibration.ImageResults)

Example 7 with ImageResults

use of boofcv.abst.geo.calibration.ImageResults in project BoofCV by lessthanoptimal.

the class MonoPlanarPanel method updateResultsGUI.

// private void setSelected( int selected ) {
// mainView.setSelected(selected);
// selectedImage = selected;
// 
// if( results != null ) {
// updateResultsGUI();
// }
// }
@Override
protected void updateResultsGUI() {
    if (selectedImage < results.size()) {
        ImageResults r = results.get(selectedImage);
        String textMean = String.format("%5.1e", r.meanError);
        String textMax = String.format("%5.1e", r.maxError);
        meanError.setText(textMean);
        maxError.setText(textMax);
    }
}
Also used : ImageResults(boofcv.abst.geo.calibration.ImageResults)

Example 8 with ImageResults

use of boofcv.abst.geo.calibration.ImageResults 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;
}
Also used : ImageResults(boofcv.abst.geo.calibration.ImageResults) SceneObservations(boofcv.abst.geo.bundle.SceneObservations) ArrayList(java.util.ArrayList) BundleAdjustmentMetricResidualFunction(boofcv.alg.geo.bundle.BundleAdjustmentMetricResidualFunction) CodecSceneStructureMetric(boofcv.alg.geo.bundle.CodecSceneStructureMetric) VerbosePrint(org.ddogleg.struct.VerbosePrint)

Example 9 with ImageResults

use of boofcv.abst.geo.calibration.ImageResults in project BoofCV by lessthanoptimal.

the class GenericCalibrationZhang99 method fullTest.

void fullTest(boolean partial) {
    for (CameraConfig config : createCamera(rand)) {
        CalibInputs inputs = createInputs(config.model, 3, rand);
        // remove points for partial visibility of a target
        if (partial) {
            for (int i = 0; i < inputs.observations.size(); i++) {
                CalibrationObservation o = inputs.observations.get(i);
                for (int j = 0; j < 5; j++) {
                    o.points.remove(rand.nextInt(o.points.size()));
                }
            }
        }
        Zhang99Camera zhangCamera = createGenerator(config, inputs.layout);
        CalibrationPlanarGridZhang99 alg = new CalibrationPlanarGridZhang99(inputs.layout, zhangCamera);
        // estimate camera parameters using full non-linear methods
        alg.process(inputs.observations);
        // verify results using errors
        List<ImageResults> errors = alg.computeErrors();
        for (int i = 0; i < errors.size(); i++) {
            assertEquals(0, errors.get(i).meanError, reprojectionTol);
        }
    }
}
Also used : ImageResults(boofcv.abst.geo.calibration.ImageResults) Zhang99Camera(boofcv.alg.geo.calibration.cameras.Zhang99Camera)

Aggregations

ImageResults (boofcv.abst.geo.calibration.ImageResults)9 Zhang99Camera (boofcv.alg.geo.calibration.cameras.Zhang99Camera)2 SceneObservations (boofcv.abst.geo.bundle.SceneObservations)1 BundleAdjustmentMetricResidualFunction (boofcv.alg.geo.bundle.BundleAdjustmentMetricResidualFunction)1 CodecSceneStructureMetric (boofcv.alg.geo.bundle.CodecSceneStructureMetric)1 CalibrationObservation (boofcv.alg.geo.calibration.CalibrationObservation)1 ConvertBufferedImage (boofcv.io.image.ConvertBufferedImage)1 BufferedImage (java.awt.image.BufferedImage)1 File (java.io.File)1 ArrayList (java.util.ArrayList)1 VerbosePrint (org.ddogleg.struct.VerbosePrint)1 DMatrixRMaj (org.ejml.data.DMatrixRMaj)1