Skip to content

Commit 33fc18c

Browse files
committed
Fixed error in keep_box()
The SIZE of the EB should be greater than 15 pixels but smaller than 1/5th of the image dimension to be considered for further processing. This fix should also solve this issue: jasonlfunk#2
1 parent c27168d commit 33fc18c

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

extract_text

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -150,17 +150,11 @@ def keep_box(contour):
150150
print "\t Rejected because of shape: (" + str(xx) + "," + str(yy) + "," + str(w_) + "," + str(h_) + ")" + \
151151
str(w_ / h_)
152152
return False
153-
154-
# Test whether the box is too wide
155-
if w_ > img_x / 5:
156-
if DEBUG:
157-
print "\t Rejected because of width: " + str(w_)
158-
return False
159-
160-
# Test whether the box is too tall
161-
if h_ > img_y / 5:
153+
154+
# check size of the box
155+
if ((w_ * h_) > ((img_x * img_y) / 5)) or ((w_ * h_) < 15):
162156
if DEBUG:
163-
print "\t Rejected because of height: " + str(h_)
157+
print "\t Rejected because of size"
164158
return False
165159

166160
return True

0 commit comments

Comments
 (0)