Search in sources :

Example 36 with AssociatedPair

use of boofcv.struct.geo.AssociatedPair in project BoofCV by lessthanoptimal.

the class RectifyFundamental method computeAffineH.

/**
 * Finds the values of a,b,c which minimize
 *
 * sum (a*x(+)_i + b*y(+)_i + c - x(-)_i)^2
 *
 * See page 306
 *
 * @return Affine transform
 */
private SimpleMatrix computeAffineH(List<AssociatedPair> observations, DMatrixRMaj H, DMatrixRMaj Hzero) {
    SimpleMatrix A = new SimpleMatrix(observations.size(), 3);
    SimpleMatrix b = new SimpleMatrix(A.numRows(), 1);
    Point2D_F64 c = new Point2D_F64();
    Point2D_F64 k = new Point2D_F64();
    for (int i = 0; i < observations.size(); i++) {
        AssociatedPair a = observations.get(i);
        GeometryMath_F64.mult(Hzero, a.p1, k);
        GeometryMath_F64.mult(H, a.p2, c);
        A.setRow(i, 0, k.x, k.y, 1);
        b.set(i, 0, c.x);
    }
    SimpleMatrix x = A.solve(b);
    SimpleMatrix Ha = SimpleMatrix.identity(3);
    Ha.setRow(0, 0, x.getDDRM().data);
    return Ha;
}
Also used : AssociatedPair(boofcv.struct.geo.AssociatedPair) SimpleMatrix(org.ejml.simple.SimpleMatrix) Point2D_F64(georegression.struct.point.Point2D_F64)

Example 37 with AssociatedPair

use of boofcv.struct.geo.AssociatedPair in project BoofCV by lessthanoptimal.

the class DistanceAffine2D method computeDistance.

@Override
public void computeDistance(List<AssociatedPair> points, double[] distance) {
    for (int i = 0; i < points.size(); i++) {
        AssociatedPair p = points.get(i);
        AffinePointOps_F64.transform(model, p.p1, expected);
        distance[i] = expected.distance(p.p2);
    }
}
Also used : AssociatedPair(boofcv.struct.geo.AssociatedPair)

Example 38 with AssociatedPair

use of boofcv.struct.geo.AssociatedPair in project BoofCV by lessthanoptimal.

the class DistanceAffine2DSq method computeDistance.

@Override
public void computeDistance(List<AssociatedPair> points, double[] distance) {
    for (int i = 0; i < points.size(); i++) {
        AssociatedPair p = points.get(i);
        AffinePointOps_F64.transform(model, p.p1, expected);
        distance[i] = expected.distance2(p.p2);
    }
}
Also used : AssociatedPair(boofcv.struct.geo.AssociatedPair)

Example 39 with AssociatedPair

use of boofcv.struct.geo.AssociatedPair in project BoofCV by lessthanoptimal.

the class DistanceHomographyPixelSq method computeDistance.

@Override
public void computeDistance(List<AssociatedPair> points, double[] distance) {
    for (int i = 0; i < points.size(); i++) {
        AssociatedPair p = points.get(i);
        HomographyPointOps_F64.transform(model, p.p1, expected);
        distance[i] = errorCam2.errorSq(expected, p.p2);
    }
}
Also used : AssociatedPair(boofcv.struct.geo.AssociatedPair)

Example 40 with AssociatedPair

use of boofcv.struct.geo.AssociatedPair in project BoofCV by lessthanoptimal.

the class DistanceSe3SymmetricSq method computeDistance.

@Override
public void computeDistance(List<AssociatedPair> associatedPairs, double[] distance) {
    for (int i = 0; i < associatedPairs.size(); i++) {
        AssociatedPair obs = associatedPairs.get(i);
        distance[i] = computeDistance(obs);
    }
}
Also used : AssociatedPair(boofcv.struct.geo.AssociatedPair)

Aggregations

AssociatedPair (boofcv.struct.geo.AssociatedPair)110 Test (org.junit.Test)32 Point2D_F64 (georegression.struct.point.Point2D_F64)28 ArrayList (java.util.ArrayList)27 DMatrixRMaj (org.ejml.data.DMatrixRMaj)22 Se3_F64 (georegression.struct.se.Se3_F64)17 Point3D_F64 (georegression.struct.point.Point3D_F64)12 ScaleTranslate2D (boofcv.struct.sfm.ScaleTranslate2D)7 DetectDescribePoint (boofcv.abst.feature.detdesc.DetectDescribePoint)6 Estimate1ofEpipolar (boofcv.abst.geo.Estimate1ofEpipolar)5 Point2Transform2_F64 (boofcv.struct.distort.Point2Transform2_F64)4 AssociatedIndex (boofcv.struct.feature.AssociatedIndex)4 ScaleTranslateRotate2D (boofcv.struct.sfm.ScaleTranslateRotate2D)4 ClosestPoint3D_F64 (georegression.metric.ClosestPoint3D_F64)4 ConfigFastHessian (boofcv.abst.feature.detect.interest.ConfigFastHessian)3 TriangulateTwoViewsCalibrated (boofcv.abst.geo.TriangulateTwoViewsCalibrated)3 AssociationPanel (boofcv.gui.feature.AssociationPanel)3 BrightFeature (boofcv.struct.feature.BrightFeature)3 Homography2D_F64 (georegression.struct.homography.Homography2D_F64)3 Ransac (org.ddogleg.fitting.modelset.ransac.Ransac)3