Search in sources :

Example 1 with LeastMedianOfSquares

use of org.ddogleg.fitting.modelset.lmeds.LeastMedianOfSquares in project BoofCV by lessthanoptimal.

the class FactoryMultiViewRobust method homographyLMedS.

/**
 * Robust solution for estimating {@link Homography2D_F64} with {@link LeastMedianOfSquares LMedS}.  Input
 * observations are in pixel coordinates.
 *
 * <ul>
 *     <li>Four point linear is used internally</p>
 *     <li>inlierThreshold is in pixels</p>
 * </ul>
 *
 * <p>See code for all the details.</p>
 *
 * @param homography Homography estimation parameters.  If null default is used.
 * @param configLMedS Parameters for LMedS.  Can't be null.
 * @return Homography estimator
 */
public static LeastMedianOfSquares<Homography2D_F64, AssociatedPair> homographyLMedS(ConfigHomography homography, ConfigLMedS configLMedS) {
    if (homography == null)
        homography = new ConfigHomography();
    ModelManager<Homography2D_F64> manager = new ModelManagerHomography2D_F64();
    GenerateHomographyLinear modelFitter = new GenerateHomographyLinear(homography.normalize);
    DistanceHomographySq distance = new DistanceHomographySq();
    LeastMedianOfSquares<Homography2D_F64, AssociatedPair> lmeds = new LeastMedianOfSquares<>(configLMedS.randSeed, configLMedS.totalCycles, manager, modelFitter, distance);
    lmeds.setErrorFraction(configLMedS.errorFraction);
    return lmeds;
}
Also used : AssociatedPair(boofcv.struct.geo.AssociatedPair) DistanceHomographySq(boofcv.alg.geo.robust.DistanceHomographySq) ModelManagerHomography2D_F64(georegression.fitting.homography.ModelManagerHomography2D_F64) GenerateHomographyLinear(boofcv.alg.geo.robust.GenerateHomographyLinear) LeastMedianOfSquares(org.ddogleg.fitting.modelset.lmeds.LeastMedianOfSquares) Homography2D_F64(georegression.struct.homography.Homography2D_F64) ModelManagerHomography2D_F64(georegression.fitting.homography.ModelManagerHomography2D_F64)

Example 2 with LeastMedianOfSquares

use of org.ddogleg.fitting.modelset.lmeds.LeastMedianOfSquares in project BoofCV by lessthanoptimal.

the class FactoryMultiViewRobust method pnpLMedS.

/**
 * Robust solution to PnP problem using {@link LeastMedianOfSquares LMedS}.  Input observations are
 * in normalized image coordinates.
 *
 * <ul>
 *     <li>Input observations are in normalized image coordinates NOT pixels</li>
 *     <li>Error units are pixels squared.</li>
 * </ul>
 *
 * <p>See code for all the details.</p>
 *
 * @param configPnP PnP parameters.  Can't be null.
 * @param configLMedS Parameters for LMedS.  Can't be null.
 * @return Robust Se3_F64 estimator
 */
public static LeastMedianOfSquares<Se3_F64, Point2D3D> pnpLMedS(ConfigPnP configPnP, ConfigLMedS configLMedS) {
    configPnP.checkValidity();
    configLMedS.checkValidity();
    Estimate1ofPnP estimatorPnP = FactoryMultiView.computePnP_1(configPnP.which, configPnP.epnpIterations, configPnP.numResolve);
    DistanceModelMonoPixels<Se3_F64, Point2D3D> distance = new PnPDistanceReprojectionSq();
    distance.setIntrinsic(configPnP.intrinsic.fx, configPnP.intrinsic.fy, configPnP.intrinsic.skew);
    ModelManagerSe3_F64 manager = new ModelManagerSe3_F64();
    EstimatorToGenerator<Se3_F64, Point2D3D> generator = new EstimatorToGenerator<>(estimatorPnP);
    LeastMedianOfSquares<Se3_F64, Point2D3D> lmeds = new LeastMedianOfSquares<>(configLMedS.randSeed, configLMedS.totalCycles, manager, generator, distance);
    lmeds.setErrorFraction(configLMedS.errorFraction);
    return lmeds;
}
Also used : Point2D3D(boofcv.struct.geo.Point2D3D) PnPDistanceReprojectionSq(boofcv.alg.geo.pose.PnPDistanceReprojectionSq) Estimate1ofPnP(boofcv.abst.geo.Estimate1ofPnP) LeastMedianOfSquares(org.ddogleg.fitting.modelset.lmeds.LeastMedianOfSquares) ModelManagerSe3_F64(georegression.fitting.se.ModelManagerSe3_F64) Se3_F64(georegression.struct.se.Se3_F64) ModelManagerSe3_F64(georegression.fitting.se.ModelManagerSe3_F64)

Example 3 with LeastMedianOfSquares

use of org.ddogleg.fitting.modelset.lmeds.LeastMedianOfSquares in project BoofCV by lessthanoptimal.

the class FactoryMultiViewRobust method epipolarLMedS.

private static LeastMedianOfSquares<Se3_F64, AssociatedPair> epipolarLMedS(Estimate1ofEpipolar epipolar, CameraPinholeRadial intrinsic, ConfigLMedS configLMedS) {
    TriangulateTwoViewsCalibrated triangulate = FactoryMultiView.triangulateTwoGeometric();
    ModelManager<Se3_F64> manager = new ModelManagerSe3_F64();
    ModelGenerator<Se3_F64, AssociatedPair> generateEpipolarMotion = new Se3FromEssentialGenerator(epipolar, triangulate);
    DistanceFromModel<Se3_F64, AssociatedPair> distanceSe3 = new DistanceSe3SymmetricSq(triangulate, intrinsic.fx, intrinsic.fy, intrinsic.skew, intrinsic.fx, intrinsic.fy, intrinsic.skew);
    LeastMedianOfSquares<Se3_F64, AssociatedPair> config = new LeastMedianOfSquares<>(configLMedS.randSeed, configLMedS.totalCycles, manager, generateEpipolarMotion, distanceSe3);
    config.setErrorFraction(configLMedS.errorFraction);
    return config;
}
Also used : AssociatedPair(boofcv.struct.geo.AssociatedPair) LeastMedianOfSquares(org.ddogleg.fitting.modelset.lmeds.LeastMedianOfSquares) DistanceSe3SymmetricSq(boofcv.alg.geo.robust.DistanceSe3SymmetricSq) ModelManagerSe3_F64(georegression.fitting.se.ModelManagerSe3_F64) Se3FromEssentialGenerator(boofcv.alg.geo.robust.Se3FromEssentialGenerator) TriangulateTwoViewsCalibrated(boofcv.abst.geo.TriangulateTwoViewsCalibrated) Se3_F64(georegression.struct.se.Se3_F64) ModelManagerSe3_F64(georegression.fitting.se.ModelManagerSe3_F64)

Aggregations

LeastMedianOfSquares (org.ddogleg.fitting.modelset.lmeds.LeastMedianOfSquares)3 AssociatedPair (boofcv.struct.geo.AssociatedPair)2 ModelManagerSe3_F64 (georegression.fitting.se.ModelManagerSe3_F64)2 Se3_F64 (georegression.struct.se.Se3_F64)2 Estimate1ofPnP (boofcv.abst.geo.Estimate1ofPnP)1 TriangulateTwoViewsCalibrated (boofcv.abst.geo.TriangulateTwoViewsCalibrated)1 PnPDistanceReprojectionSq (boofcv.alg.geo.pose.PnPDistanceReprojectionSq)1 DistanceHomographySq (boofcv.alg.geo.robust.DistanceHomographySq)1 DistanceSe3SymmetricSq (boofcv.alg.geo.robust.DistanceSe3SymmetricSq)1 GenerateHomographyLinear (boofcv.alg.geo.robust.GenerateHomographyLinear)1 Se3FromEssentialGenerator (boofcv.alg.geo.robust.Se3FromEssentialGenerator)1 Point2D3D (boofcv.struct.geo.Point2D3D)1 ModelManagerHomography2D_F64 (georegression.fitting.homography.ModelManagerHomography2D_F64)1 Homography2D_F64 (georegression.struct.homography.Homography2D_F64)1