Index: trunk/psLib/src/image/psImageStats.c
===================================================================
--- trunk/psLib/src/image/psImageStats.c	(revision 784)
+++ trunk/psLib/src/image/psImageStats.c	(revision 795)
@@ -132,7 +132,17 @@
         }
     }
+
+
+    // Free the Chebyshev polynomials that were created in this routine.
+    for (i=0;i<maxChebyPoly;i++) {
+        psFree(chebPolys[i]);
+    }
+
     return(coeffs);
 }
 
+/*****************************************************************************
+ 
+ *****************************************************************************/
 int
 psImageEvalPolynomial(const psImage *input,
@@ -141,7 +151,10 @@
     int i = 0;
     int j = 0;
+    int x = 0;
+    int y = 0;
     float **sums = NULL;
     psPolynomial1D **chebPolys = NULL;
     int maxChebyPoly = 0;
+    float polySum = 0.0;
 
     // Create the sums[][] data structure.  This will hold the LHS of equation
@@ -181,4 +194,25 @@
 
 
+    for (x=0;x<input->numRows;x++) {
+        for (y=0;y<input->numCols;y++) {
+            polySum = 0.0;
+            for (i=0;i<coeffs->nX;i++) {
+                for (j=0;j<coeffs->nY;j++) {
+                    polySum+= psEvalPolynomial1D((float)x, chebPolys[i]) *
+                              psEvalPolynomial1D((float)y, chebPolys[y]) *
+                              coeffs->coeff[i][j];
+
+                }
+            }
+            input->data.F32[x][y] = polySum;
+        }
+    }
+
+
+    // Free the Chebyshev polynomials that were created in this routine.
+    for (i=0;i<maxChebyPoly;i++) {
+        psFree(chebPolys[i]);
+    }
+
     return(0);
 }
