[ocrfeeder] Add the page background color as an instance variable of ImageProcessor



commit 468166a17e25371ab26327694d18fe8cb454c5e3
Author: Joaquim Rocha <jrocha igalia com>
Date:   Wed Jul 7 18:45:59 2010 +0200

    Add the page background color as an instance variable of ImageProcessor
    
    imageManipulator.ImageProcessor: Remove the hardcoded value of the
    page's background color and set it as an instance variable.
    (Although that variable is constant, it is likely it might be
    changes in the future)

 feeder/imageManipulation.py |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/feeder/imageManipulation.py b/feeder/imageManipulation.py
index b2ccf22..86a6c2d 100644
--- a/feeder/imageManipulation.py
+++ b/feeder/imageManipulation.py
@@ -50,6 +50,7 @@ class ImageProcessor:
         else:
             debug(sys.exc_info())
             raise ImageManipulationError(error_message)
+        self.bg_color = 255
 
     def __windowContrast(self, bgcolor, x, y):
         image = self.black_n_white_image
@@ -83,7 +84,7 @@ class ImageProcessor:
         i, j = 0, 0
         while j < height / self.window_size:
             while i < width / self.window_size:
-                binary_info[-1] += str(self.__windowContrast(255, i, j))
+                binary_info[-1] += str(self.__windowContrast(self.bg_color, i, j))
                 i += 1
             i = 0
             binary_info += ['']



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]