libNumerics/computeH.cpp
// Add two corresponding points, type involving at most 4 parameters
Add two corresponding points, type involving at most 4 parameters
Add two corresponding points type involving at most 4 parameters
void ComputeH::add_4parameters(float x, float y, float X, float Y, float w)
{
    double *A = Ann, *B = Bn;
    if(_type == Translation) {
        A[0] += w;
        A[3] += w;
        B[0] += w* (X - x);
        B[1] += w* (Y - y);
        b += w* ((X-x)*(X-x) + (Y-y)*(Y-y));
        return;
    }
    b += w* (X*X + Y*Y);
    if(_type == GeneralZoom) {
        A[0] += w* x*x;
        A[2] += w* x;
        B[0] += w* x*X;
        A[5] += w* y*y;
        A[7] += w* y;
        B[1] += w* y*Y;
        A[10]+= w;
        B[2] += w* X;
        A[15]+= w;
        B[3] += w* Y;
        return;
    }
    *A++ += w* (x*x + y*y); 
    if(_type != Zoom) 
        A++;
    *A++ += w* x;
    *A++ += w* y;
    *B++ += w* (x*X + y*Y);
    if(_type != Zoom) { 
        A++; 
        *A++ += w* (x*x + y*y);
        *A++ += w* y;
        *A++ -= w* x;
        *B++ += w* (y*X - x*Y);
        A++; 
    }
    A++; 
    *A++ += w;
    A++;
    *B++ += w* X;
    A += n-1; 
    *A++ += w;
    *B++ += w* Y;
}
void ComputeH :: add_4parameters ( float x , float y , float X , float Y , float w ) { double * A = Ann , * B = Bn ; if ( _type == Translation ) { A [ 0 ] += w ; A [ 3 ] += w ; B [ 0 ] += w * ( X - x ) ; B [ 1 ] += w * ( Y - y ) ; b += w * ( ( X - x ) * ( X - x ) + ( Y - y ) * ( Y - y ) ) ; return ; } b += w * ( X * X + Y * Y ) ; if ( _type == GeneralZoom ) { A [ 0 ] += w * x * x ; A [ 2 ] += w * x ; B [ 0 ] += w * x * X ; A [ 5 ] += w * y * y ; A [ 7 ] += w * y ; B [ 1 ] += w * y * Y ; A [ 10 ] += w ; B [ 2 ] += w * X ; A [ 15 ] += w ; B [ 3 ] += w * Y ; return ; } * A ++ += w * ( x * x + y * y ) ; if ( _type != Zoom ) A ++ ; * A ++ += w * x ; * A ++ += w * y ; * B ++ += w * ( x * X + y * Y ) ; if ( _type != Zoom ) { A ++ ; * A ++ += w * ( x * x + y * y ) ; * A ++ += w * y ; * A ++ -= w * x ; * B ++ += w * ( y * X - x * Y ) ; A ++ ; } A ++ ; * A ++ += w ; A ++ ; * B ++ += w * X ; A += n - 1 ; * A ++ += w ; * B ++ += w * Y ; }
Add two corresponding points, type involving at most 4 parameters
Add two corresponding points type involving at most 4 parameters
// Equation 1 // Similarity or Rotation // Similarity or Rotation // Equation 2 // Prepare for next line // Equation 3 // Equation 4