Index: trunk/psLib/src/imageops/psImageCovariance.c
===================================================================
--- trunk/psLib/src/imageops/psImageCovariance.c	(revision 28149)
+++ trunk/psLib/src/imageops/psImageCovariance.c	(revision 28151)
@@ -571,5 +571,5 @@
 
     psKernel *out = psKernelAlloc(xMinOut, xMaxOut, yMinOut, yMaxOut); // Output covariance
-    double sum = 0.0;                                                  // Sum of covariance
+    double outSum = 0.0;                                               // Sum of covariance
     for (int y = yMinOut; y <= yMaxOut; y++) {
         float yIn = y * scale + 0.5 - yMinIn + 1; // Position on input image (not the kernel)
@@ -581,10 +581,17 @@
                 return false;
             }
-            sum += out->kernel[y][x] = value;
+            outSum += out->kernel[y][x] = value;
         }
     }
     psFree(interp);
 
-    float norm = 1.0 / PS_SQR(scale) / sum; // Renormalisation for covariance (to remove errors in interp.)
+    double inSum = 0.0;                 // Sum of covariance
+    for (int y = yMinIn; y <= yMaxIn; y++) {
+        for (int x = xMinIn; x <= xMaxIn; x++) {
+            inSum += in->kernel[y][x];
+        }
+    }
+
+    float norm = inSum / PS_SQR(scale) / outSum; // Renormalisation (to remove errors in interp.)
     for (int y = yMinOut; y <= yMaxOut; y++) {
         for (int x = xMinOut; x <= xMaxOut; x++) {
