Skip to content

Commit

Permalink
#120 :: Tweak _clean_image() to get new set of numbers to be recognised
Browse files Browse the repository at this point in the history
  • Loading branch information
JackBuck committed Mar 18, 2017
1 parent 2c45492 commit 0eb0bf3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion roboplot/dottodot/number_recognition.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def _recognise_number_in_clean_image(img) -> int:


def _clean_image(img):
img = cv2.medianBlur(img, ksize=5)
img = cv2.medianBlur(img, ksize=3)
img = cv2.adaptiveThreshold(img, maxValue=255, adaptiveMethod=cv2.ADAPTIVE_THRESH_GAUSSIAN_C,
thresholdType=cv2.THRESH_BINARY, blockSize=11, C=2)
return img
Expand Down
8 changes: 4 additions & 4 deletions testing/test_number_recognition.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ def test_basic_number_recognition(self):

# Compare
self.assertEqual(number.numeric_value, expected_number)
self.assertAlmostEqual(number.dot_location_yx[0], expected_spot_location[0], places=0)
self.assertAlmostEqual(number.dot_location_yx[1], expected_spot_location[1], places=0)
self.assertAlmostEqual(number.dot_location_yx[0], expected_spot_location[0], delta=2)
self.assertAlmostEqual(number.dot_location_yx[1], expected_spot_location[1], delta=2)

def test_rotated_number_recognition(self):
"""Regression test number recognition on potentially rotated images."""
Expand All @@ -59,8 +59,8 @@ def test_rotated_number_recognition(self):

# Compare
self.assertEqual(number.numeric_value, expected_number)
self.assertAlmostEqual(number.dot_location_yx[0], expected_spot_location[0], places=0)
self.assertAlmostEqual(number.dot_location_yx[1], expected_spot_location[1], places=0)
self.assertAlmostEqual(number.dot_location_yx[0], expected_spot_location[0], delta=2)
self.assertAlmostEqual(number.dot_location_yx[1], expected_spot_location[1], delta=2)


if __name__ == '__main__':
Expand Down

0 comments on commit 0eb0bf3

Please sign in to comment.