Changeset 776 for trunk/psLib/src/image/psImageStats.c
- Timestamp:
- May 24, 2004, 5:08:41 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/image/psImageStats.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/image/psImageStats.c
r775 r776 40 40 return(hist); 41 41 } 42 43 42 44 43 /***************************************************************************** … … 140 139 const psPolynomial2D *coeffs) 141 140 { 141 int x = 0; 142 int y = 0; 143 int i = 0; 144 int j = 0; 145 float **sums = NULL; 146 psPolynomial1D **chebPolys = NULL; 147 int maxChebyPoly = 0; 148 149 // Create the sums[][] data structure. This will hold the LHS of equation 150 // 29 in the ADD: sums[k][l] = SUM { image(x,y) * Tk(x) * Tl(y) } 151 sums = (float **) psAlloc(coeffs->nX * sizeof(float *)); 152 for (i=0;i<coeffs->nX;i++) { 153 sums[i] = (float *) psAlloc(coeffs->nY * sizeof(float)); 154 } 155 for (i=0;i<coeffs->nX;i++) { 156 for (j=0;j<coeffs->nY;j++) { 157 sums[i][j] = 0.0; 158 } 159 } 160 161 // Determine how many Chebyshev polynomials are needed, then create them. 162 maxChebyPoly = coeffs->nX; 163 if (coeffs->nX > coeffs->nY) { 164 maxChebyPoly = coeffs->nY; 165 } 166 167 chebPolys = (psPolynomial1D **) psAlloc(maxChebyPoly * 168 sizeof(psPolynomial1D *)); 169 for (i=0;i<maxChebyPoly;i++) { 170 chebPolys[i] = psPolynomial1DAlloc(i); 171 } 172 173 // Create the Chebyshev polynomials 174 chebPolys[1]->coeff[0] = 1; 175 for (i=2;i<maxChebyPoly;i++) { 176 for (j=0;j<chebPolys[i-1]->n;j++) { 177 chebPolys[i]->coeff[j+1] = 2 * chebPolys[i-1]->coeff[j]; 178 } 179 for (j=0;j<chebPolys[i-2]->n;j++) { 180 chebPolys[i]->coeff[j]-= chebPolys[i-2]->coeff[j]; 181 } 182 } 183 184 142 185 return(0); 143 186 }
Note:
See TracChangeset
for help on using the changeset viewer.
