Search in sources :

Example 1 with PnPLepetitEPnP

use of boofcv.alg.geo.pose.PnPLepetitEPnP in project BoofCV by lessthanoptimal.

the class FactoryMultiView method computePnP_1.

/**
 * Created an estimator for the P3P problem that selects a single solution by considering additional
 * observations.
 *
 * <p>NOTE: Observations are in normalized image coordinates NOT pixels.</p>
 *
 * <p>
 * NOTE: EPnP has several tuning parameters and the defaults here might not be the best for your situation.
 * Use {@link #computePnPwithEPnP} if you wish to have access to all parameters.
 * </p>
 *
 * @param which The algorithm which is to be returned.
 * @param numIterations Number of iterations. Only used by some algorithms and recommended number varies
 *                      significantly by algorithm.
 * @param numTest How many additional sample points are used to remove ambiguity in the solutions.  Not used
 *                if only a single solution is found.
 * @return An estimator which returns a single estimate.
 */
public static Estimate1ofPnP computePnP_1(EnumPNP which, int numIterations, int numTest) {
    if (which == EnumPNP.EPNP) {
        PnPLepetitEPnP alg = new PnPLepetitEPnP(0.1);
        alg.setNumIterations(numIterations);
        return new WrapPnPLepetitEPnP(alg);
    }
    FastQueue<Se3_F64> solutions = new FastQueue<>(4, Se3_F64.class, true);
    return new EstimateNto1ofPnP(computePnP_N(which, -1), solutions, numTest);
}
Also used : PnPLepetitEPnP(boofcv.alg.geo.pose.PnPLepetitEPnP) FastQueue(org.ddogleg.struct.FastQueue) Se3_F64(georegression.struct.se.Se3_F64)

Example 2 with PnPLepetitEPnP

use of boofcv.alg.geo.pose.PnPLepetitEPnP in project BoofCV by lessthanoptimal.

the class FactoryMultiView method computePnPwithEPnP.

/**
 * Returns a solution to the PnP problem for 4 or more points using EPnP. Fast and fairly
 * accurate algorithm.  Can handle general and planar scenario automatically.
 *
 * <p>NOTE: Observations are in normalized image coordinates NOT pixels.</p>
 *
 * @see PnPLepetitEPnP
 *
 * @param numIterations If more then zero then non-linear optimization is done.  More is not always better.  Try 10
 * @param magicNumber Affects how the problem is linearized.  See comments in {@link PnPLepetitEPnP}.  Try 0.1
 * @return  Estimate1ofPnP
 */
public static Estimate1ofPnP computePnPwithEPnP(int numIterations, double magicNumber) {
    PnPLepetitEPnP alg = new PnPLepetitEPnP(magicNumber);
    alg.setNumIterations(numIterations);
    return new WrapPnPLepetitEPnP(alg);
}
Also used : PnPLepetitEPnP(boofcv.alg.geo.pose.PnPLepetitEPnP)

Aggregations

PnPLepetitEPnP (boofcv.alg.geo.pose.PnPLepetitEPnP)2 Se3_F64 (georegression.struct.se.Se3_F64)1 FastQueue (org.ddogleg.struct.FastQueue)1