IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 24, 2004, 5:08:41 PM (22 years ago)
Author:
gusciora
Message:

...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/image/psImageStats.c

    r775 r776  
    4040    return(hist);
    4141}
    42 
    4342
    4443/*****************************************************************************
     
    140139                      const psPolynomial2D *coeffs)
    141140{
     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
    142185    return(0);
    143186}
Note: See TracChangeset for help on using the changeset viewer.