/** * Splits the associated pairs into two lists * @param input List of associated features * @return two lists containing each set of features */ public static Tuple2<List<Point2D_F64>,List<Point2D_F64>> split2( List<AssociatedPair> input ) { List<Point2D_F64> list1 = new ArrayList<>(); List<Point2D_F64> list2 = new ArrayList<>(); for (int i = 0; i < input.size(); i++) { list1.add( input.get(i).p1 ); list2.add( input.get(i).p2 ); } return new Tuple2<>(list1,list2); }
/** * Decomposes a homography matrix that's in Euclidean space (computed from features in normalized image coordinates). * The homography is defined as H = (R + (1/d)*T*N<sup>T</sup>), where R is a 3x3 rotation matrix, * d is the distance of the plane, N is the plane's normal (unit vector), T is the translation vector. If * the homography is from view 'a' to 'b' then transform (R,T) will be from reference 'a' to 'b'. Note that the * returned 'T' is divided by 'd'. * * @see DecomposeHomography * * @param H Homography in Euclidean space * @return The set of four possible solutions. First param: motion (R,T). Second param: plane normal vector. */ public static List<Tuple2<Se3_F64,Vector3D_F64>> decomposeHomography( DMatrixRMaj H ) { DecomposeHomography d = new DecomposeHomography(); d.decompose(H); List<Vector3D_F64> solutionsN = d.getSolutionsN(); List<Se3_F64> solutionsSe = d.getSolutionsSE(); List<Tuple2<Se3_F64,Vector3D_F64>> ret = new ArrayList<>(); for( int i = 0; i < 4; i++ ) { ret.add(new Tuple2<>(solutionsSe.get(i), solutionsN.get(i))); } return ret; }
/** * Decomposes a homography matrix that's in Euclidean space (computed from features in normalized image coordinates). * The homography is defined as H = (R + (1/d)*T*N<sup>T</sup>), where R is a 3x3 rotation matrix, * d is the distance of the plane, N is the plane's normal (unit vector), T is the translation vector. If * the homography is from view 'a' to 'b' then transform (R,T) will be from reference 'a' to 'b'. Note that the * returned 'T' is divided by 'd'. * * @see DecomposeHomography * * @param H Homography in Euclidean space * @return The set of four possible solutions. First param: motion (R,T). Second param: plane normal vector. */ public static List<Tuple2<Se3_F64,Vector3D_F64>> decomposeHomography( DenseMatrix64F H ) { DecomposeHomography d = new DecomposeHomography(); d.decompose(H); List<Vector3D_F64> solutionsN = d.getSolutionsN(); List<Se3_F64> solutionsSe = d.getSolutionsSE(); List<Tuple2<Se3_F64,Vector3D_F64>> ret = new ArrayList<>(); for( int i = 0; i < 4; i++ ) { ret.add(new Tuple2<>(solutionsSe.get(i), solutionsN.get(i))); } return ret; } }