Class P3PGrunert

  • All Implemented Interfaces:
    P3PLineDistance

    public class P3PGrunert
    extends java.lang.Object
    implements P3PLineDistance

    Solves for the 3 unknown distances between camera center and 3 observed points by finding the roots of a 4th order polynomial, This is probably the first solution to the P3P problem and first proposed in 1841 by Grunert. This implementation is based off the discussion in [1]. There are up to four solutions.

    See P3PLineDistance for a more detailed problem description.

    [1] Haralick, Robert M. and Lee, Chung-Nan and Ottenberg, Karsten and Nolle, Michael, "Review and analysis of solutions of the three point perspective pose estimation problem" Int. J. Comput. Vision, 1994 vol 13, no. 13, pages 331-356

    • Constructor Summary

      Constructors 
      Constructor Description
      P3PGrunert​(org.ddogleg.solver.PolynomialRoots rootFinder)
      Specifies the polynomial root finder.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static double computeCosine​(georegression.struct.point.Point2D_F64 a, georegression.struct.point.Point2D_F64 b)  
      org.ddogleg.struct.FastQueue<PointDistance3> getSolutions()
      Returns a set of solutions.
      static double pow2​(double a)  
      boolean process​(georegression.struct.point.Point2D_F64 obs1, georegression.struct.point.Point2D_F64 obs2, georegression.struct.point.Point2D_F64 obs3, double length23, double length13, double length12)
      Solve for the distance between the camera's origin and each of the 3 points in 3D space.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • P3PGrunert

        public P3PGrunert​(org.ddogleg.solver.PolynomialRoots rootFinder)
        Specifies the polynomial root finder.
        Parameters:
        rootFinder - Root finder for real 4th order roots.
    • Method Detail

      • process

        public boolean process​(georegression.struct.point.Point2D_F64 obs1,
                               georegression.struct.point.Point2D_F64 obs2,
                               georegression.struct.point.Point2D_F64 obs3,
                               double length23,
                               double length13,
                               double length12)
        Description copied from interface: P3PLineDistance
        Solve for the distance between the camera's origin and each of the 3 points in 3D space.
        Specified by:
        process in interface P3PLineDistance
        Parameters:
        obs1 - Observation of P1 in normalized image coordinates
        obs2 - Observation of P2 in normalized image coordinates
        obs3 - Observation of P3 in normalized image coordinates
        length23 - Distance between points P2 and P3
        length13 - Distance between points P1 and P3
        length12 - Distance between points P1 and P2
        Returns:
        true if successful or false if it failed to generate any solutions
      • pow2

        public static double pow2​(double a)
      • computeCosine

        public static double computeCosine​(georegression.struct.point.Point2D_F64 a,
                                           georegression.struct.point.Point2D_F64 b)
      • getSolutions

        public org.ddogleg.struct.FastQueue<PointDistance3> getSolutions()
        Description copied from interface: P3PLineDistance
        Returns a set of solutions. Each solution contains the distance to the respective point.
        Specified by:
        getSolutions in interface P3PLineDistance
        Returns:
        List of solutions.