Skip to content

Commit daf7d10

Browse files
committedAug 27, 2019
chore: adjust cv2.dilate
1 parent d86147a commit daf7d10

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed
 

‎core/utils/image_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def get_text(image_path, use_cv2=True):
126126
thresh = cv2.adaptiveThreshold(gray, 255, 1, 1, 11, 2)
127127

128128
# apply some dilation and erosion to join the gaps - change iteration to detect more or less area's
129-
thresh = cv2.dilate(thresh, None, iterations=5)
129+
thresh = cv2.dilate(thresh, None, iterations=10)
130130
thresh = cv2.erode(thresh, None, iterations=3)
131131

132132
# Find the contours

‎core_tests/unit/utils/image_tests.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class ImageUtilsTests(unittest.TestCase):
2323
app_image = os.path.join(current_folder, 'resources', 'app.png')
2424
app_image_ng = os.path.join(current_folder, 'resources', 'app_ng.png')
2525
app_image_ios = os.path.join(current_folder, 'resources', 'app_ios.png')
26+
app_image_default_ios = os.path.join(current_folder, 'resources', 'app_ios_default.png')
2627
iphone_image = os.path.join(current_folder, 'resources', 'screenshot.png')
2728
unicode_image = os.path.join(current_folder, 'resources', 'unicode.png')
2829
blue = numpy.array([255, 188, 48])
@@ -43,6 +44,12 @@ def test_03_get_main_color(self):
4344

4445
@unittest.skipIf(os.environ.get('TRAVIS', None) is not None, 'Skip on Travis.')
4546
def test_04_get_text(self):
47+
# OCR on iOS 13
48+
text = ImageUtils.get_text(self.app_image_default_ios)
49+
assert 'taps left' in text
50+
assert 'Tap the button' in text
51+
assert 'TAP' in text
52+
4653
# OCR on Hello-World app
4754
text = ImageUtils.get_text(self.app_image_ios)
4855
assert 'My App' in text
Loading

0 commit comments

Comments
 (0)
Please sign in to comment.