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;
}
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;
}
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;
}
Aggregations