Search in sources :

Example 1 with GenerateHomographyLinear

use of boofcv.alg.geo.robust.GenerateHomographyLinear 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 GenerateHomographyLinear

use of boofcv.alg.geo.robust.GenerateHomographyLinear in project BoofCV by lessthanoptimal.

the class FactoryMultiViewRobust method homographyRansac.

/**
 * Robust solution for estimating {@link Homography2D_F64} with {@link Ransac}.  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 ransac Parameters for RANSAC.  Can't be null.
 * @return Homography estimator
 */
public static Ransac<Homography2D_F64, AssociatedPair> homographyRansac(ConfigHomography homography, ConfigRansac ransac) {
    if (homography == null)
        homography = new ConfigHomography();
    ModelManager<Homography2D_F64> manager = new ModelManagerHomography2D_F64();
    GenerateHomographyLinear modelFitter = new GenerateHomographyLinear(homography.normalize);
    DistanceHomographySq distance = new DistanceHomographySq();
    double ransacTol = ransac.inlierThreshold * ransac.inlierThreshold;
    return new Ransac<>(ransac.randSeed, manager, modelFitter, distance, ransac.maxIterations, ransacTol);
}
Also used : DistanceHomographySq(boofcv.alg.geo.robust.DistanceHomographySq) ModelManagerHomography2D_F64(georegression.fitting.homography.ModelManagerHomography2D_F64) GenerateHomographyLinear(boofcv.alg.geo.robust.GenerateHomographyLinear) Homography2D_F64(georegression.struct.homography.Homography2D_F64) ModelManagerHomography2D_F64(georegression.fitting.homography.ModelManagerHomography2D_F64) Ransac(org.ddogleg.fitting.modelset.ransac.Ransac)

Aggregations

DistanceHomographySq (boofcv.alg.geo.robust.DistanceHomographySq)2 GenerateHomographyLinear (boofcv.alg.geo.robust.GenerateHomographyLinear)2 ModelManagerHomography2D_F64 (georegression.fitting.homography.ModelManagerHomography2D_F64)2 Homography2D_F64 (georegression.struct.homography.Homography2D_F64)2 AssociatedPair (boofcv.struct.geo.AssociatedPair)1 LeastMedianOfSquares (org.ddogleg.fitting.modelset.lmeds.LeastMedianOfSquares)1 Ransac (org.ddogleg.fitting.modelset.ransac.Ransac)1