void MatchesPointsToMat ( const matching::IndMatches & putativeMatches, const cameras::IntrinsicBase * cam_I, const features::PointFeatures & feature_I, const cameras::IntrinsicBase * cam_J, const features::PointFeatures & feature_J, MatT & x_I, MatT & x_J ) { const size_t n = putativeMatches.size(); x_I.resize(2, n); x_J.resize(2, n); typedef typename MatT::Scalar Scalar; // Output matrix type for (size_t i=0; i < putativeMatches.size(); ++i) { const features::PointFeature & pt_I = feature_I[putativeMatches[i].i_]; const features::PointFeature & pt_J = feature_J[putativeMatches[i].j_]; if (cam_I) x_I.col(i) = cam_I->get_ud_pixel(pt_I.coords().cast<double>()); else x_I.col(i) = pt_I.coords().cast<double>(); if (cam_J) x_J.col(i) = cam_J->get_ud_pixel(pt_J.coords().cast<double>()); else x_J.col(i) = pt_J.coords().cast<double>(); } }
static void PointsToMat( const IntrinsicBase * cam, const PointFeatures & vec_feats, MatT & m) { m.resize(2, vec_feats.size()); typedef typename MatT::Scalar Scalar; // Output matrix type size_t i = 0; for( PointFeatures::const_iterator iter = vec_feats.begin(); iter != vec_feats.end(); ++iter, ++i) { if (cam) m.col(i) = cam->get_ud_pixel(Vec2(iter->x(), iter->y())); else m.col(i) << iter->x(), iter->y(); } }