From b836f508400477b8e4dd59b14db414a8943e55a5 Mon Sep 17 00:00:00 2001 From: Mohit Jain Date: Wed, 14 Nov 2018 14:49:31 +0530 Subject: [PATCH] Contour rejection parameter update for English --- extract_text | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/extract_text b/extract_text index f02c611..45bc096 100755 --- a/extract_text +++ b/extract_text @@ -169,12 +169,14 @@ def include_box(index, h_, contour): count_children(get_parent(index, h_), h_, contour)) + " children" print "\thas " + str(count_children(index, h_, contour)) + " children" - if is_child(index, h_) and count_children(get_parent(index, h_), h_, contour) <= 2: + # English language can have maximum 5 sub-contours inside a letter-contour (not 2). + # Refer to @varunkumar2310's answer : https://github.com/jasonlfunk/ocr-text-extraction/issues/2 + if is_child(index, h_) and count_children(get_parent(index, h_), h_, contour) <= 5: if DEBUG: print "\t skipping: is an interior to a letter" return False - if count_children(index, h_, contour) > 2: + if count_children(index, h_, contour) > 5: if DEBUG: print "\t skipping, is a container of letters" return False