Changeset 1406 for trunk/psLib/test/image/tst_psImageStats02.c
- Timestamp:
- Aug 6, 2004, 12:34:06 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/image/tst_psImageStats02.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/image/tst_psImageStats02.c
r1365 r1406 4 4 thouroughly tested elsewhere, we will only test psImageStats() with 5 5 the PS_STAT_SAMPLE_MEAN here. 6 6 7 7 NOTE: After you debug, set CHEBY_X_DIM != CHEBY_Y_DIM. 8 8 Also, uses non-square images. … … 32 32 int rc = 0; 33 33 int currentId = 0; 34 34 35 35 currentId = psMemGetId(); 36 36 /*************************************************************************/ … … 40 40 outImage = psImageAlloc( IMAGE_SIZE, IMAGE_SIZE, PS_TYPE_F32 ); 41 41 for ( i = 0;i < IMAGE_SIZE;i++ ) { 42 for ( j = 0;j < IMAGE_SIZE;j++ ) { 43 tmpImage->data.F32[ i ][ j ] = 4.0; 44 tmpImage->data.F32[ i ][ j ] = ( float ) ( i + j ); 45 tmpImage->data.F32[ i ][ j ] = ( float ) ( i + j ) + ( 4.0 * ( float ) i ); 46 outImage->data.F32[ i ][ j ] = 0.0; 47 } 42 for ( j = 0;j < IMAGE_SIZE;j++ ) { 43 tmpImage->data.F32[ i ][ j ] = 4.0; 44 tmpImage->data.F32[ i ][ j ] = ( float ) ( i + j ); 45 tmpImage->data.F32[ i ][ j ] = ( float ) ( i + j ) + ( 4.0 * ( float ) i ); 46 outImage->data.F32[ i ][ j ] = 0.0; 48 47 } 48 } 49 49 my2DPoly = psPolynomial2DAlloc( CHEBY_X_DIM, CHEBY_Y_DIM ); 50 50 /*************************************************************************/ … … 54 54 "psImageStats functions", 55 55 "Calculate Chebyshev Polynomials, no mask" ); 56 56 57 57 my2DPoly = psImageFitPolynomial( tmpImage, my2DPoly ); 58 58 for ( i = 0;i < CHEBY_X_DIM;i++ ) { 59 for ( j = 0;j < CHEBY_Y_DIM;j++ ) { 60 printf( "Cheby Polynomial (%d, %d) coefficient is %.2f\n", i, j, my2DPoly->coeff[ i ][ j ] ); 61 } 59 for ( j = 0;j < CHEBY_Y_DIM;j++ ) { 60 printf( "Cheby Polynomial (%d, %d) coefficient is %.2f\n", i, j, my2DPoly->coeff[ i ][ j ] ); 62 61 } 63 62 } 63 64 64 psMemCheckCorruption( 1 ); 65 65 printFooter( stdout, … … 73 73 "psImageStats functions", 74 74 "Calculate Chebyshev Polynomials, no mask" ); 75 75 76 76 rc = psImageEvalPolynomial( outImage, my2DPoly ); 77 77 for ( i = 0;i < IMAGE_SIZE;i++ ) { 78 for ( j = 0;j < IMAGE_SIZE;j++ ) { 79 80 // printf("pixel[%d][%d] is (%f, %f)\n", i, j, 81 // tmpImage->data.F32[i][j], 82 // outImage->data.F32[i][j]); 83 if ( fabs( outImage->data.F32[ i ][ j ] - tmpImage->data.F32[ i ][ j ] ) > THRESHOLD ) { 84 printf( "Pixel (%d, %d) is %.2f, should be %.2f\n", i, j, 85 outImage->data.F32[ i ][ j ], 86 tmpImage->data.F32[ i ][ j ] ); 87 } 88 89 } 78 for ( j = 0;j < IMAGE_SIZE;j++ ) { 79 80 // printf("pixel[%d][%d] is (%f, %f)\n", i, j, 81 // tmpImage->data.F32[i][j], 82 // outImage->data.F32[i][j]); 83 if ( fabs( outImage->data.F32[ i ][ j ] - tmpImage->data.F32[ i ][ j ] ) > THRESHOLD ) { 84 printf( "Pixel (%d, %d) is %.2f, should be %.2f\n", i, j, 85 outImage->data.F32[ i ][ j ], 86 tmpImage->data.F32[ i ][ j ] ); 87 } 88 90 89 } 91 90 } 91 92 92 psMemCheckCorruption( 1 ); 93 93 printFooter( stdout, … … 95 95 "Calculate Chebyshev Polynomials, no mask", 96 96 testStatus ); 97 97 98 98 /*************************************************************************/ 99 99 /* Deallocate data structures */ … … 106 106 psFree( outImage ); 107 107 psFree( my2DPoly ); 108 108 109 109 psMemCheckCorruption( 1 ); 110 110 memLeaks = psMemCheckLeaks( currentId, NULL, NULL ); 111 111 if ( 0 != memLeaks ) { 112 psAbort( __func__, "Memory Leaks! (%d leaks)", memLeaks );113 }114 112 psAbort( __func__, "Memory Leaks! (%d leaks)", memLeaks ); 113 } 114 115 115 printFooter( stdout, 116 116 "psImageStats functions", 117 117 "Deallocate the psStats/psImage structure.", 118 118 testStatus ); 119 119 120 120 return ( !testStatus ); 121 121 }
Note:
See TracChangeset
for help on using the changeset viewer.
