[ocrfeeder] Fix single recognition of a content area



commit 699adc03f7543d3f02ea122d4500e4ff2c0de033
Author: Joaquim Rocha <jrocha igalia com>
Date:   Wed Oct 26 18:03:15 2011 +0200

    Fix single recognition of a content area
    
    The issue was that the image used for getting the text size was
    not ensured to be grayscale.

 src/ocrfeeder/feeder/layoutAnalysis.py |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/src/ocrfeeder/feeder/layoutAnalysis.py b/src/ocrfeeder/feeder/layoutAnalysis.py
index 13af038..4f41348 100644
--- a/src/ocrfeeder/feeder/layoutAnalysis.py
+++ b/src/ocrfeeder/feeder/layoutAnalysis.py
@@ -523,6 +523,8 @@ class LayoutAnalysis(object):
         return data_box
 
     def getTextSizeFromImage(self, image, page_resolution):
+        if image.mode != 'L':
+            image = image.convert('L')
         width, height = image.size
         # We get the right half of the image only because this
         # way we avoid measuring eventual "initial chars" which



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