Home | History | Annotate | Download | only in src

Lines Matching refs:moments

43 /* The function calculates center of gravity and central second order moments */
45 icvCompleteMomentState( CvMoments* moments )
50 assert( moments != 0 );
51 moments->inv_sqrt_m00 = 0;
53 if( fabs(moments->m00) > DBL_EPSILON )
55 double inv_m00 = 1. / moments->m00;
56 cx = moments->m10 * inv_m00;
57 cy = moments->m01 * inv_m00;
58 moments->inv_sqrt_m00 = sqrt( fabs(inv_m00) );
62 mu20 = moments->m20 - moments->m10 * cx;
64 mu11 = moments->m11 - moments->m10 * cy;
66 mu02 = moments->m02 - moments->m01 * cy;
68 moments->mu20 = mu20;
69 moments->mu11 = mu11;
70 moments->mu02 = mu02;
73 moments->mu30 = moments->m30 - cx * (3 * mu20 + cx * moments->m10);
76 moments->mu21 = moments->m21 - cx * (mu11 + cx * moments->m01) - cy * mu20;
78 moments->mu12 = moments->m12 - cy * (mu11 + cy * moments->m10) - cx * mu02;
80 moments->mu03 = moments->m03 - cy * (3 * mu02 + cy * moments->m01);
85 icvContourMoments( CvSeq* contour, CvMoments* moments )
179 /* spatial moments */
180 moments->m00 = a00 * db1_2;
181 moments->m10 = a10 * db1_6;
182 moments->m01 = a01 * db1_6;
183 moments->m20 = a20 * db1_12;
184 moments->m11 = a11 * db1_24;
185 moments->m02 = a02 * db1_12;
186 moments->m30 = a30 * db1_20;
187 moments->m21 = a21 * db1_60;
188 moments->m12 = a12 * db1_60;
189 moments->m03 = a03 * db1_20;
191 icvCompleteMomentState( moments );
199 icvAccumulateMoments( double *tiles, CvSize size, CvSize tile_size, CvMoments * moments )
211 moments->m00 += tiles[0];
214 moments->m10 += tiles[1] + dxm;
217 moments->m01 += tiles[2] + dym;
220 moments->m20 += tiles[3] + dx * (tiles[1] * 2 + dxm);
223 moments->m11 += tiles[4] + dx * (tiles[2] + dym) + dy * tiles[1];
226 moments->m02 += tiles[5] + dy * (tiles[2] * 2 + dym);
229 moments->m30 += tiles[6] + dx * (3. * tiles[3] + dx * (3. * tiles[1] + dxm));
232 moments->m21 += tiles[7] + dx * (2 * (tiles[4] + dy * tiles[1]) +
236 moments->m12 += tiles[8] + dy * (2 * (tiles[4] + dx * tiles[2]) +
240 moments->m03 += tiles[9] + dy * (3. * tiles[5] + dy * (3. * tiles[2] + dym));
244 icvCompleteMomentState( moments );
249 * Spatial Moments *
254 ( const srctype* img, int step, CvSize size, int cn, int coi, double *moments ) \
328 moments[x] = (double)mom[x]; \
366 cvMoments( const void* array, CvMoments* moments, int binary )
403 if( !moments )
406 memset( moments, 0, sizeof(*moments));
423 icvContourMoments( contour, moments );
451 icvGetSpatialMoment_64f_p( ippmomentstate, 0, 0, 0, cvPoint(0,0), &moments->m00 );
452 icvGetSpatialMoment_64f_p( ippmomentstate, 1, 0, 0, cvPoint(0,0), &moments->m10 );
453 icvGetSpatialMoment_64f_p( ippmomentstate, 0, 1, 0, cvPoint(0,0), &moments->m01 );
454 icvGetSpatialMoment_64f_p( ippmomentstate, 2, 0, 0, cvPoint(0,0), &moments->m20 );
455 icvGetSpatialMoment_64f_p( ippmomentstate, 1, 1, 0, cvPoint(0,0), &moments->m11 );
456 icvGetSpatialMoment_64f_p( ippmomentstate, 0, 2, 0, cvPoint(0,0), &moments->m02 );
457 icvGetSpatialMoment_64f_p( ippmomentstate, 3, 0, 0, cvPoint(0,0), &moments->m30 );
458 icvGetSpatialMoment_64f_p( ippmomentstate, 2, 1, 0, cvPoint(0,0), &moments->m21 );
459 icvGetSpatialMoment_64f_p( ippmomentstate, 1, 2, 0, cvPoint(0,0), &moments->m12 );
460 icvGetSpatialMoment_64f_p( ippmomentstate, 0, 3, 0, cvPoint(0,0), &moments->m03 );
461 icvCompleteMomentState( moments );
496 icvAccumulateMoments( tiles, size, tile_size, moments );
508 // Purpose: Returns Hu moments
512 // HuState - pointer to output structure containing seven Hu moments
580 cvGetSpatialMoment( CvMoments * moments, int x_order, int y_order )
589 if( !moments )
594 moment = (&(moments->m00))[order + (order >> 1) + (order > 2) * 2 + y_order];
618 cvGetCentralMoment( CvMoments * moments, int x_order, int y_order )
627 if( !moments )
634 mu = (&(moments->m00))[4 + order * 3 + y_order];
637 mu = moments->m00;
661 cvGetNormalizedCentralMoment( CvMoments * moments, int x_order, int y_order )
671 mu = cvGetCentralMoment( moments, x_order, y_order );
674 m00s = moments->inv_sqrt_m00;