Update unit-tests.

* Update unit-tests to match the values after disabling YUV table.
This commit is contained in:
iabdalkader 2020-02-03 19:33:02 +02:00
parent 0e4b46e416
commit a601cda422
4 changed files with 7 additions and 11 deletions

View File

@ -1,4 +1,4 @@
def unittest(data_path, temp_path):
import image
gs = image.rgb_to_grayscale((120, 200, 120))
return (abs(167-gs) < 2)
return (gs == 166)

View File

@ -2,4 +2,4 @@ def unittest(data_path, temp_path):
import image
img = image.Image("unittest/data/shapes.ppm", copy_to_fb=True)
circles = img.find_circles(threshold = 5000, x_margin = 30, y_margin = 30, r_margin = 30)
return len(circles) == 1 and circles[0][0:-1] == (118, 56, 22)
return len(circles) == 1 and circles[0][0:] == (118, 56, 22, 5858)

View File

@ -3,11 +3,7 @@ def unittest(data_path, temp_path):
img = image.Image("unittest/data/shapes.ppm", copy_to_fb=True)
lines = img.find_lines(threshold = 10000, theta_margin = 25, rho_margin = 25)
return len(lines) == 4 and\
lines[0][0:-3] == (22, 0, 22, 119, 119) and\
lines[1][0:-3] == (0, 39, 159, 39, 159) and\
lines[2][0:-3] == (57, 0, 57, 119, 119) and\
lines[3][0:-3] == (0, 75, 159, 75, 159) and\
lines[0][-2:] == (0, 22) and\
lines[1][-2:] == (90, 39) and\
lines[2][-2:] == (0, 57) and\
lines[3][-2:] == (90, 75)
lines[0][0:] == (22, 0, 22, 119, 119, 17272, 0, 22) and\
lines[1][0:] == (0, 39, 159, 39, 159, 17272, 90, 39) and\
lines[2][0:] == (57, 0, 57, 119, 119, 17272, 0, 57) and\
lines[3][0:] == (0, 75, 159, 75, 159, 21336, 90, 75)

View File

@ -2,4 +2,4 @@ def unittest(data_path, temp_path):
import image
img = image.Image("unittest/data/shapes.ppm", copy_to_fb=True)
rects = img.find_rects(threshold = 50000)
return len(rects) == 1 and rects[0][0:-1] == (23, 39, 35, 36)
return len(rects) == 1 and rects[0][0:] == (23, 39, 35, 36, 145992)