Index: /trunk/psLib/src/imageops/psImageBackground.c
===================================================================
--- /trunk/psLib/src/imageops/psImageBackground.c	(revision 26450)
+++ /trunk/psLib/src/imageops/psImageBackground.c	(revision 26451)
@@ -15,4 +15,11 @@
 #include "psRandom.h"
 #include "psError.h"
+
+static int nFailures = 0;
+
+void psImageBackgroundInit() {
+    nFailures = 0;
+    return;
+}
 
 // XXX allow the user to choose the stats method?
@@ -91,6 +98,8 @@
     }
     if (n < 0.01*Nsubset) {
-        psLogMsg("psLib.psImageBackground", PS_LOG_DETAIL,
-                 "Unable to measure image background: too few data points (%ld)", n);
+	if ((nFailures < 3) || (nFailures % 100 == 0)) {
+	    psLogMsg("psLib.psImageBackground", PS_LOG_DETAIL, "Unable to measure image background: too few data points (%ld) (%d failures)", n, nFailures);
+	}
+	nFailures ++;
         psFree(values);
         return false;
@@ -108,5 +117,8 @@
 
         if (!psVectorSort(values, values)) {
-            psError(PS_ERR_UNKNOWN, false, "Unable to sort values.\n");
+	    if ((nFailures < 3) || (nFailures % 100 == 0)) {
+		psError(PS_ERR_UNKNOWN, false, "Unable to sort values.(%d failures)\n", nFailures);
+	    }
+	    nFailures ++;
             psFree(values);
             return false;
@@ -132,7 +144,10 @@
                 fclose (f);
             }
-            psError(PS_ERR_UNKNOWN, false, "Unable to measure statistics for image background "
-                    "(%dx%d, (row0,col0) = (%d,%d)",
-                    image->numRows, image->numCols, image->row0, image->col0);
+	    if ((nFailures < 3) || (nFailures % 100 == 0)) {
+		psError(PS_ERR_UNKNOWN, false, "Unable to measure statistics for image background "
+			"(%dx%d, (row0,col0) = (%d,%d) (%d failures)\n",
+			image->numRows, image->numCols, image->row0, image->col0, nFailures);
+	    }		
+	    nFailures ++;
             psFree(values);
             return false;
Index: /trunk/psLib/src/imageops/psImageBackground.h
===================================================================
--- /trunk/psLib/src/imageops/psImageBackground.h	(revision 26450)
+++ /trunk/psLib/src/imageops/psImageBackground.h	(revision 26451)
@@ -22,4 +22,6 @@
 #include <psRandom.h>
 
+void psImageBackgroundInit();
+
 // Get the background for an image
 bool psImageBackground(psStats *stats, // desired measurement and options
