Exemplo n.º 1
0
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>();
  }
}
Exemplo n.º 2
0
 void mod_size( MatT& A, unsigned r, unsigned c, unsigned s ) {
     A.resize( r, c, s );
     A.randn( r, c, s );
     for( unsigned i=0; i<r; i++ ) {
         for( unsigned j=0; j<c; j++ ) {
             for( unsigned k=0; k<s; k++ ) {
                 A(i,j,k) = (typename MatT::elem_type)(i*100+j*10+k);
             }
         }
     }
 };
Exemplo n.º 3
0
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)
  {
    m.col(i) = cam->get_ud_pixel(Vec2(iter->x(), iter->y()));
  }
}