Index: opencv-1.0.0/docs/ref/opencvref_cv.htm =================================================================== --- opencv-1.0.0.orig/docs/ref/opencvref_cv.htm 2006-10-17 15:53:35.000000000 +0200 +++ opencv-1.0.0/docs/ref/opencvref_cv.htm 2006-11-14 10:27:01.000000000 +0100 @@ -465,7 +465,7 @@
 dst(x’,y’)<-src(x,y)
 (x’,y’)T=map_matrix•(x,y,1)T+b if CV_WARP_INVERSE_MAP is not set,
-(x, y)T=map_matrix•(x’,y&apos,1)T+b otherwise
+(x, y)T=map_matrix•(x’,y&apos,1)T+b otherwise
 

The function is similar to cvGetQuadrangleSubPix but they are @@ -543,7 +543,7 @@

 dst(x’,y’)<-src(x,y)
 (t•x’,t•y’,t)T=map_matrix•(x,y,1)T+b if CV_WARP_INVERSE_MAP is not set,
-(t•x, t•y, t)T=map_matrix•(x’,y&apos,1)T+b otherwise
+(t•x, t•y, t)T=map_matrix•(x’,y&apos,1)T+b otherwise
 

For a sparse set of points @@ -642,12 +642,12 @@ { IplImage* src; - if( argc == 2 && (src=cvLoadImage(argv[1],1) != 0 ) + if( argc == 2 && (src=cvLoadImage(argv[1],1) != 0 ) { IplImage* dst = cvCreateImage( cvSize(256,256), 8, 3 ); IplImage* src2 = cvCreateImage( cvGetSize(src), 8, 3 ); - cvLogPolar( src, dst, cvPoint2D32f(src->width/2,src->height/2), 40, CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS ); - cvLogPolar( dst, src2, cvPoint2D32f(src->width/2,src->height/2), 40, CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS+CV_WARP_INVERSE_MAP ); + cvLogPolar( src, dst, cvPoint2D32f(src->width/2,src->height/2), 40, CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS ); + cvLogPolar( dst, src2, cvPoint2D32f(src->width/2,src->height/2), 40, CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS+CV_WARP_INVERSE_MAP ); cvNamedWindow( "log-polar", 1 ); cvShowImage( "log-polar", dst ); cvNamedWindow( "inverse log-polar", 1 ); @@ -951,8 +951,8 @@

  • Transformations within RGB space like adding/removing alpha channel, reversing the channel order, conversion to/from 16-bit RGB color (R5:G6:B5 or R5:G5:B5) color, as well as conversion to/from grayscale using:
    -RGB[A]->Gray: Y<-0.299*R + 0.587*G + 0.114*B
    -Gray->RGB[A]: R<-Y G<-Y B<-Y A<-0
    +RGB[A]->Gray: Y<-0.299*R + 0.587*G + 0.114*B
    +Gray->RGB[A]: R<-Y G<-Y B<-Y A<-0
     
  • RGB<=>CIE XYZ.Rec 709 with D65 white point (CV_BGR2XYZ, CV_RGB2XYZ, CV_XYZ2BGR, CV_XYZ2RGB):
    @@ -1102,7 +1102,7 @@
     document at Charles Poynton site.
     
     

    -
  • Bayer=>RGB (CV_BayerBG2BGR, CV_BayerGB2BGR, CV_BayerRG2BGR, CV_BayerGR2BGR,
    +
  • Bayer=>RGB (CV_BayerBG2BGR, CV_BayerGB2BGR, CV_BayerRG2BGR, CV_BayerGR2BGR,
    CV_BayerBG2RGB, CV_BayerGB2RGB, CV_BayerRG2RGB, CV_BayerGR2RGB
    )

    Bayer pattern is widely used in CCD and CMOS cameras. It allows to get color picture out of a single plane where R,G and B pixels (sensors of a particular component) are interleaved like @@ -1524,7 +1524,7 @@ input image (or down-sized input image, see below) the function executes meanshift iterations, that is, the pixel (X,Y) neighborhood in the joint space-color hyperspace is considered: -

    {(x,y): X-sp≤x≤X+sp && Y-sp≤y≤Y+sp && ||(R,G,B)-(r,g,b)|| ≤ sr},
    +
    {(x,y): X-sp≤x≤X+sp && Y-sp≤y≤Y+sp && ||(R,G,B)-(r,g,b)|| ≤ sr},
    where (R,G,B) and (r,g,b) are the vectors of color components at (X,Y) and (x,y), respectively (though, the algorithm does not depend on the color space used, so any 3-component color space can be used instead). @@ -1732,7 +1732,7 @@ int main(int argc, char** argv) { IplImage* src; - if( argc == 2 && (src=cvLoadImage(argv[1], 0))!= 0) + if( argc == 2 && (src=cvLoadImage(argv[1], 0))!= 0) { IplImage* dst = cvCreateImage( cvGetSize(src), 8, 1 ); IplImage* color_dst = cvCreateImage( cvGetSize(src), 8, 3 ); @@ -1832,15 +1832,15 @@ int main(int argc, char** argv) { IplImage* img; - if( argc == 2 && (img=cvLoadImage(argv[1], 1))!= 0) + if( argc == 2 && (img=cvLoadImage(argv[1], 1))!= 0) { IplImage* gray = cvCreateImage( cvGetSize(img), 8, 1 ); CvMemStorage* storage = cvCreateMemStorage(0); cvCvtColor( img, gray, CV_BGR2GRAY ); cvSmooth( gray, gray, CV_GAUSSIAN, 9, 9 ); // smooth it, otherwise a lot of false circles may be detected - CvSeq* circles = cvHoughCircles( gray, storage, CV_HOUGH_GRADIENT, 2, gray->height/4, 200, 100 ); + CvSeq* circles = cvHoughCircles( gray, storage, CV_HOUGH_GRADIENT, 2, gray->height/4, 200, 100 ); int i; - for( i = 0; i < circles->total; i++ ) + for( i = 0; i < circles->total; i++ ) { float* p = (float*)cvGetSeqElem( circles, i ); cvCircle( img, cvPoint(cvRound(p[0]),cvRound(p[1])), 3, CV_RGB(0,255,0), -1, 8, 0 ); @@ -2076,13 +2076,13 @@

    Queries value of histogram bin

     #define cvQueryHistValue_1D( hist, idx0 ) \
    -    cvGetReal1D( (hist)->bins, (idx0) )
    +    cvGetReal1D( (hist)->bins, (idx0) )
     #define cvQueryHistValue_2D( hist, idx0, idx1 ) \
    -    cvGetReal2D( (hist)->bins, (idx0), (idx1) )
    +    cvGetReal2D( (hist)->bins, (idx0), (idx1) )
     #define cvQueryHistValue_3D( hist, idx0, idx1, idx2 ) \
    -    cvGetReal3D( (hist)->bins, (idx0), (idx1), (idx2) )
    +    cvGetReal3D( (hist)->bins, (idx0), (idx1), (idx2) )
     #define cvQueryHistValue_nD( hist, idx ) \
    -    cvGetRealND( (hist)->bins, (idx) )
    +    cvGetRealND( (hist)->bins, (idx) )
     

    hist
    Histogram.
    idx0, idx1, idx2, idx3
    Indices of the bin. @@ -2098,13 +2098,13 @@

    Returns pointer to histogram bin

     #define cvGetHistValue_1D( hist, idx0 ) \
    -    ((float*)(cvPtr1D( (hist)->bins, (idx0), 0 ))
    +    ((float*)(cvPtr1D( (hist)->bins, (idx0), 0 ))
     #define cvGetHistValue_2D( hist, idx0, idx1 ) \
    -    ((float*)(cvPtr2D( (hist)->bins, (idx0), (idx1), 0 ))
    +    ((float*)(cvPtr2D( (hist)->bins, (idx0), (idx1), 0 ))
     #define cvGetHistValue_3D( hist, idx0, idx1, idx2 ) \
    -    ((float*)(cvPtr3D( (hist)->bins, (idx0), (idx1), (idx2), 0 ))
    +    ((float*)(cvPtr3D( (hist)->bins, (idx0), (idx1), (idx2), 0 ))
     #define cvGetHistValue_nD( hist, idx ) \
    -    ((float*)(cvPtrND( (hist)->bins, (idx), 0 ))
    +    ((float*)(cvPtrND( (hist)->bins, (idx), 0 ))
     

    hist
    Histogram.
    idx0, idx1, idx2, idx3
    Indices of the bin. @@ -2237,7 +2237,7 @@ int main( int argc, char** argv ) { IplImage* src; - if( argc == 2 && (src=cvLoadImage(argv[1], 1))!= 0) + if( argc == 2 && (src=cvLoadImage(argv[1], 1))!= 0) { IplImage* h_plane = cvCreateImage( cvGetSize(src), 8, 1 ); IplImage* s_plane = cvCreateImage( cvGetSize(src), 8, 1 ); @@ -2259,7 +2259,7 @@ cvCvtPixToPlane( hsv, h_plane, s_plane, v_plane, 0 ); hist = cvCreateHist( 2, hist_size, CV_HIST_ARRAY, ranges, 1 ); cvCalcHist( planes, hist, 0, 0 ); - cvGetMinMaxHistValue( hist, 0, &max_value, 0, 0 ); + cvGetMinMaxHistValue( hist, 0, &max_value, 0, 0 ); cvZero( hist_img ); for( h = 0; h < h_bins; h++ ) @@ -2374,8 +2374,8 @@ the two histograms as:

     dist_hist(I)=0      if hist1(I)==0
    -             scale  if hist1(I)!=0 && hist2(I)>hist1(I)
    -             hist2(I)*scale/hist1(I) if hist1(I)!=0 && hist2(I)<=hist1(I)
    +             scale  if hist1(I)!=0 && hist2(I)>hist1(I)
    +             hist2(I)*scale/hist1(I) if hist1(I)!=0 && hist2(I)<=hist1(I)
     

    So the destination histogram bins are within less than scale. @@ -2666,7 +2666,7 @@

  • is_closed=0 - the curve is assumed to be unclosed.
  • is_closed>0 - the curve is assumed to be closed.
  • is_closed<0 - if curve is sequence, the flag CV_SEQ_FLAG_CLOSED of - ((CvSeq*)curve)->flags is checked to determine if the curve is closed or not, + ((CvSeq*)curve)->flags is checked to determine if the curve is closed or not, otherwise (curve is represented by array (CvMat*) of points) it is assumed to be unclosed. @@ -2927,12 +2927,12 @@ for( i = 0; i < count; i++ ) { - pt0.x = rand() % (img->width/2) + img->width/4; - pt0.y = rand() % (img->height/2) + img->height/4; - cvSeqPush( ptseq, &pt0 ); + pt0.x = rand() % (img->width/2) + img->width/4; + pt0.y = rand() % (img->height/2) + img->height/4; + cvSeqPush( ptseq, &pt0 ); } hull = cvConvexHull2( ptseq, 0, CV_CLOCKWISE, 0 ); - hullcount = hull->total; + hullcount = hull->total; #else CvPoint* points = (CvPoint*)malloc( count * sizeof(points[0])); int* hull = (int*)malloc( count * sizeof(hull[0])); @@ -2941,11 +2941,11 @@ for( i = 0; i < count; i++ ) { - pt0.x = rand() % (img->width/2) + img->width/4; - pt0.y = rand() % (img->height/2) + img->height/4; + pt0.x = rand() % (img->width/2) + img->width/4; + pt0.y = rand() % (img->height/2) + img->height/4; points[i] = pt0; } - cvConvexHull2( &point_mat, &hull_mat, CV_CLOCKWISE, 0 ); + cvConvexHull2( &point_mat, &hull_mat, CV_CLOCKWISE, 0 ); hullcount = hull_mat.cols; #endif cvZero( img ); @@ -3552,7 +3552,7 @@
    criteria
    Criteria applied to determine when the window search should be finished.
    comp
    Resultant structure that contains converged search window coordinates -(comp->rect field) and sum of all pixels inside the window (comp->area field). +(comp->rect field) and sum of all pixels inside the window (comp->area field).
  • The function cvMeanShift iterates to find the object center given its back projection and initial position of search window. The iterations are made until the search window @@ -3573,7 +3573,7 @@

    criteria
    Criteria applied to determine when the window search should be finished.
    comp
    Resultant structure that contains converged search window coordinates -(comp->rect field) and sum of all pixels inside the window (comp->area field). +(comp->rect field) and sum of all pixels inside the window (comp->area field).
    box
    Circumscribed box for the object. If not NULL, contains object size and orientation.

    @@ -3648,7 +3648,7 @@

    criteria
    Criteria of termination of velocity computing.

    The function cvCalcOpticalFlowHS computes flow for every pixel of the first input image using -Horn & Schunck algorithm [Horn81]. +Horn & Schunck algorithm [Horn81].

    @@ -3667,7 +3667,7 @@ 32-bit floating-point, single-channel.

    The function cvCalcOpticalFlowLK computes flow for every pixel of the first input image using -Lucas & Kanade algorithm [Lucas81]. +Lucas & Kanade algorithm [Lucas81].

    @@ -3685,7 +3685,7 @@
    max_range
    Size of the scanned neighborhood in pixels around block.
    use_previous
    Uses previous (input) velocity field.
    velx
    Horizontal component of the optical flow of
    - floor((prev->width - block_size.width)/shiftSize.width) × floor((prev->height - block_size.height)/shiftSize.height) size, + floor((prev->width - block_size.width)/shiftSize.width) × floor((prev->height - block_size.height)/shiftSize.height) size, 32-bit floating-point, single-channel.
    vely
    Vertical component of the optical flow of the same size velx, 32-bit floating-point, single-channel. @@ -3766,17 +3766,17 @@ /* backward compatibility fields */ #if 1 - float* PosterState; /* =state_pre->data.fl */ - float* PriorState; /* =state_post->data.fl */ - float* DynamMatr; /* =transition_matrix->data.fl */ - float* MeasurementMatr; /* =measurement_matrix->data.fl */ - float* MNCovariance; /* =measurement_noise_cov->data.fl */ - float* PNCovariance; /* =process_noise_cov->data.fl */ - float* KalmGainMatr; /* =gain->data.fl */ - float* PriorErrorCovariance;/* =error_cov_pre->data.fl */ - float* PosterErrorCovariance;/* =error_cov_post->data.fl */ - float* Temp1; /* temp1->data.fl */ - float* Temp2; /* temp2->data.fl */ + float* PosterState; /* =state_pre->data.fl */ + float* PriorState; /* =state_post->data.fl */ + float* DynamMatr; /* =transition_matrix->data.fl */ + float* MeasurementMatr; /* =measurement_matrix->data.fl */ + float* MNCovariance; /* =measurement_noise_cov->data.fl */ + float* PNCovariance; /* =process_noise_cov->data.fl */ + float* KalmGainMatr; /* =gain->data.fl */ + float* PriorErrorCovariance;/* =error_cov_pre->data.fl */ + float* PosterErrorCovariance;/* =error_cov_post->data.fl */ + float* Temp1; /* temp1->data.fl */ + float* Temp2; /* temp2->data.fl */ #endif CvMat* state_pre; /* predicted state (x'(k)): @@ -3872,17 +3872,17 @@ should be NULL iff there is no external control (control_params=0).

    The function cvKalmanPredict estimates the subsequent stochastic model state -by its current state and stores it at kalman->state_pre:

    +by its current state and stores it at kalman->state_pre:

         x'k=A•xk+B•uk
         P'k=A•Pk-1*AT + Q,
     where
    -x'k is predicted state (kalman->state_pre),
    -xk-1 is corrected state on the previous step (kalman->state_post)
    +x'k is predicted state (kalman->state_pre),
    +xk-1 is corrected state on the previous step (kalman->state_post)
                     (should be initialized somehow in the beginning, zero vector by default),
     uk is external control (control parameter),
    -P'k is priori error covariance matrix (kalman->error_cov_pre)
    -Pk-1 is posteriori error covariance matrix on the previous step (kalman->error_cov_post)
    +P'k is priori error covariance matrix (kalman->error_cov_pre)
    +Pk-1 is posteriori error covariance matrix on the previous step (kalman->error_cov_post)
                     (should be initialized somehow in the beginning, identity matrix by default),
     
    The function returns the estimated state. @@ -3909,7 +3909,7 @@ Kk - Kalman "gain" matrix.
  • -The function stores adjusted state at kalman->state_post and returns it on output. +The function stores adjusted state at kalman->state_post and returns it on output.

    Example. Using Kalman filter to track a rotating point

    @@ -3933,51 +3933,51 @@ CvRandState rng; int code = -1; - cvRandInit( &rng, 0, 1, -1, CV_RAND_UNI ); + cvRandInit( &rng, 0, 1, -1, CV_RAND_UNI ); cvZero( measurement ); cvNamedWindow( "Kalman", 1 ); for(;;) { - cvRandSetRange( &rng, 0, 0.1, 0 ); + cvRandSetRange( &rng, 0, 0.1, 0 ); rng.disttype = CV_RAND_NORMAL; - cvRand( &rng, state ); + cvRand( &rng, state ); - memcpy( kalman->transition_matrix->data.fl, A, sizeof(A)); - cvSetIdentity( kalman->measurement_matrix, cvRealScalar(1) ); - cvSetIdentity( kalman->process_noise_cov, cvRealScalar(1e-5) ); - cvSetIdentity( kalman->measurement_noise_cov, cvRealScalar(1e-1) ); - cvSetIdentity( kalman->error_cov_post, cvRealScalar(1)); + memcpy( kalman->transition_matrix->data.fl, A, sizeof(A)); + cvSetIdentity( kalman->measurement_matrix, cvRealScalar(1) ); + cvSetIdentity( kalman->process_noise_cov, cvRealScalar(1e-5) ); + cvSetIdentity( kalman->measurement_noise_cov, cvRealScalar(1e-1) ); + cvSetIdentity( kalman->error_cov_post, cvRealScalar(1)); /* choose random initial state */ - cvRand( &rng, kalman->state_post ); + cvRand( &ramp;ng, kalman->state_post ); rng.disttype = CV_RAND_NORMAL; for(;;) { #define calc_point(angle) \ - cvPoint( cvRound(img->width/2 + img->width/3*cos(angle)), \ - cvRound(img->height/2 - img->width/3*sin(angle))) + cvPoint( cvRound(img->width/2 + img->width/3*cos(angle)), \ + cvRound(img->height/2 - img->width/3*sin(angle))) - float state_angle = state->data.fl[0]; + float state_angle = state->data.fl[0]; CvPoint state_pt = calc_point(state_angle); /* predict point position */ const CvMat* prediction = cvKalmanPredict( kalman, 0 ); - float predict_angle = prediction->data.fl[0]; + float predict_angle = prediction->data.fl[0]; CvPoint predict_pt = calc_point(predict_angle); float measurement_angle; CvPoint measurement_pt; - cvRandSetRange( &rng, 0, sqrt(kalman->measurement_noise_cov->data.fl[0]), 0 ); - cvRand( &rng, measurement ); + cvRandSetRange( &rng, 0, sqrt(kalman->measurement_noise_cov->data.fl[0]), 0 ); + cvRand( &rng, measurement ); /* generate measurement */ - cvMatMulAdd( kalman->measurement_matrix, state, measurement, measurement ); + cvMatMulAdd( kalman->measurement_matrix, state, measurement, measurement ); - measurement_angle = measurement->data.fl[0]; + measurement_angle = measurement->data.fl[0]; measurement_pt = calc_point(measurement_angle); /* plot points */ @@ -3996,14 +3996,14 @@ /* adjust Kalman filter state */ cvKalmanCorrect( kalman, measurement ); - cvRandSetRange( &rng, 0, sqrt(kalman->process_noise_cov->data.fl[0]), 0 ); - cvRand( &rng, process_noise ); - cvMatMulAdd( kalman->transition_matrix, state, process_noise, state ); + cvRandSetRange( &rng, 0, sqrt(kalman->process_noise_cov->data.fl[0]), 0 ); + cvRand( &rng, process_noise ); + cvMatMulAdd( kalman->transition_matrix, state, process_noise, state ); cvShowImage( "Kalman", img ); code = cvWaitKey( 100 ); - if( code > 0 ) /* break current simulation by pressing a key */ + if( code > 0 ) /* break current simulation by pressing a key */ break; } if( code == 27 ) /* exit by ESCAPE */ @@ -4641,7 +4641,7 @@
     sum_i((x'i-(h11*xi + h12*yi + h13)/(h31*xi + h32*yi + h33))2+
    -      (y'i-(h21*xi + h22*yi + h23)/(h31*xi + h32*yi + h33))2) -> min
    +      (y'i-(h21*xi + h22*yi + h23)/(h31*xi + h32*yi + h33))2) -> min
     
    The function is used to find initial intrinsic and extrinsic matrices. @@ -4978,9 +4978,9 @@ (7-point method may return up to 3 matrices).
    method
    Method for computing the fundamental matrix
    CV_FM_7POINT - for 7-point algorithm. N == 7 -
    CV_FM_8POINT - for 8-point algorithm. N >= 8 -
    CV_FM_RANSAC - for RANSAC algorithm. N >= 8 -
    CV_FM_LMEDS - for LMedS algorithm. N >= 8 +
    CV_FM_8POINT - for 8-point algorithm. N >= 8 +
    CV_FM_RANSAC - for RANSAC algorithm. N >= 8 +
    CV_FM_LMEDS - for LMedS algorithm. N >= 8
    param1
    The parameter is used for RANSAC or LMedS methods only. It is the maximum distance from point to epipolar line in pixels, beyond which the point is considered an outlier and is not used @@ -5030,10 +5030,10 @@ /* Fill the points here ... */ for( i = 0; i < point_count; i++ ) { - points1->data.db[i*2] = <x1,i>; - points1->data.db[i*2+1] = <y1,i>; - points2->data.db[i*2] = <x2,i>; - points2->data.db[i*2+1] = <y2,i>; + points1->data.db[i*2] = <x1,i>; + points1->data.db[i*2+1] = <y1,i>; + points2->data.db[i*2] = <x2,i>; + points2->data.db[i*2+1] = <y2,i>; } fundamental_matrix = cvCreateMat(3,3,CV_32FC1); @@ -5115,7 +5115,7 @@ In case if the input array dimensionality is larger than the output, each point coordinates are divided by the last coordinate:
    -(x,y[,z],w) -> (x',y'[,z']):
    +(x,y[,z],w) -> (x',y'[,z']):
     
     x' = x/w
     y' = y/w
    @@ -5124,7 +5124,7 @@
     
     If the output array dimensionality is larger, an extra 1 is appended to each point.
     
    -(x,y[,z]) -> (x,y[,z],1)
    +(x,y[,z]) -> (x,y[,z],1)
     
    Otherwise, the input array is simply copied (with optional tranposition) to the output.