diff --git a/pixelocr/image.py b/pixelocr/image.py index 4c03c28..be70257 100644 --- a/pixelocr/image.py +++ b/pixelocr/image.py @@ -85,12 +85,17 @@ class Image(object): line_start = None prev_line_end = 0 + + def is_nonblank(row): + return row.any() + for i, row in enumerate(self.bitmap): - if row.any(): # non-blank row + if is_nonblank(row): if line_start is None: line_start = i - if line_start - prev_line_end >= min_space: - yield self.child_cls.space(line_start - prev_line_end, self.width) + height = line_start - prev_line_end + if height >= min_space: + yield self.child_cls.space(height, self.width) else: if line_start is not None: yield self.child_cls(self._data[line_start:i, :])