IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 27, 2004, 11:55:44 AM (22 years ago)
Author:
gusciora
Message:

Fixed the ImageEvalPolynomial() routine.

File:
1 edited

Legend:

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

    r784 r795  
    132132        }
    133133    }
     134
     135
     136    // Free the Chebyshev polynomials that were created in this routine.
     137    for (i=0;i<maxChebyPoly;i++) {
     138        psFree(chebPolys[i]);
     139    }
     140
    134141    return(coeffs);
    135142}
    136143
     144/*****************************************************************************
     145 
     146 *****************************************************************************/
    137147int
    138148psImageEvalPolynomial(const psImage *input,
     
    141151    int i = 0;
    142152    int j = 0;
     153    int x = 0;
     154    int y = 0;
    143155    float **sums = NULL;
    144156    psPolynomial1D **chebPolys = NULL;
    145157    int maxChebyPoly = 0;
     158    float polySum = 0.0;
    146159
    147160    // Create the sums[][] data structure.  This will hold the LHS of equation
     
    181194
    182195
     196    for (x=0;x<input->numRows;x++) {
     197        for (y=0;y<input->numCols;y++) {
     198            polySum = 0.0;
     199            for (i=0;i<coeffs->nX;i++) {
     200                for (j=0;j<coeffs->nY;j++) {
     201                    polySum+= psEvalPolynomial1D((float)x, chebPolys[i]) *
     202                              psEvalPolynomial1D((float)y, chebPolys[y]) *
     203                              coeffs->coeff[i][j];
     204
     205                }
     206            }
     207            input->data.F32[x][y] = polySum;
     208        }
     209    }
     210
     211
     212    // Free the Chebyshev polynomials that were created in this routine.
     213    for (i=0;i<maxChebyPoly;i++) {
     214        psFree(chebPolys[i]);
     215    }
     216
    183217    return(0);
    184218}
Note: See TracChangeset for help on using the changeset viewer.