libNumerics/computeH.cpp
// Wrap vector of unknowns `v' into structure `map'
Wrap vector of unknowns `v' into structure `map'
Wrap vector of unknowns ` v ' into structure ` map '
void ComputeH::wrap(Homography& h, const vector<double>& v) const
{
    int i = 0;
    h.mat()(0,0) = (_type==Translation)? 1.0f: v(i++);
    h.mat()(0,1) = (_type==Translation || _type==Zoom || _type==GeneralZoom) ?
        0: v(i++);
    if(n >= 6) {
        h.mat()(1,0) = v(i++);
        h.mat()(1,1) = v(i++);
    } else {
        h.mat()(1,0) = -h.mat()(0,1);
        h.mat()(1,1) = (_type==GeneralZoom)? v(i++): h.mat()(0,0);
    }
    h.mat()(0,2) = v(i++);
    h.mat()(1,2) = v(i++);
    if(_type == Projective) {
        h.mat()(2,0) = v(i++);
        h.mat()(2,1) = v(i++);
    } else
        h.mat()(2,0) = h.mat()(2,1) = 0;
    h.mat()(2,2) = 1.0;
}
void ComputeH :: wrap ( Homography & h , const vector < double > & v ) const { int i = 0 ; h . mat ( ) ( 0 , 0 ) = ( _type == Translation ) ? 1.0f : v ( i ++ ) ; h . mat ( ) ( 0 , 1 ) = ( _type == Translation || _type == Zoom || _type == GeneralZoom ) ? 0 : v ( i ++ ) ; if ( n >= 6 ) { h . mat ( ) ( 1 , 0 ) = v ( i ++ ) ; h . mat ( ) ( 1 , 1 ) = v ( i ++ ) ; } else { h . mat ( ) ( 1 , 0 ) = - h . mat ( ) ( 0 , 1 ) ; h . mat ( ) ( 1 , 1 ) = ( _type == GeneralZoom ) ? v ( i ++ ) : h . mat ( ) ( 0 , 0 ) ; } h . mat ( ) ( 0 , 2 ) = v ( i ++ ) ; h . mat ( ) ( 1 , 2 ) = v ( i ++ ) ; if ( _type == Projective ) { h . mat ( ) ( 2 , 0 ) = v ( i ++ ) ; h . mat ( ) ( 2 , 1 ) = v ( i ++ ) ; } else h . mat ( ) ( 2 , 0 ) = h . mat ( ) ( 2 , 1 ) = 0 ; h . mat ( ) ( 2 , 2 ) = 1.0 ; }
Wrap vector of unknowns `v' into structure `map'
Wrap vector of unknowns ` v ' into structure ` map '