mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
Update unit tests.
This commit is contained in:
parent
0e6652a3be
commit
5a6903e4e6
@ -1,4 +1,4 @@
|
|||||||
def unittest(data_path, temp_path):
|
def unittest(data_path, temp_path):
|
||||||
import image
|
import image
|
||||||
gs = image.rgb_to_grayscale((120, 200, 120))
|
gs = image.rgb_to_grayscale((120, 200, 120))
|
||||||
return (gs == 167)
|
return (abs(167-gs) < 2)
|
||||||
|
|||||||
@ -2,4 +2,4 @@ def unittest(data_path, temp_path):
|
|||||||
import image
|
import image
|
||||||
img = image.Image("unittest/data/shapes.ppm", copy_to_fb=True)
|
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)
|
circles = img.find_circles(threshold = 5000, x_margin = 30, y_margin = 30, r_margin = 30)
|
||||||
return len(circles) == 1 and circles[0][0:] == (118, 56, 22, 5829)
|
return len(circles) == 1 and circles[0][0:-1] == (118, 56, 22)
|
||||||
|
|||||||
@ -3,7 +3,11 @@ def unittest(data_path, temp_path):
|
|||||||
img = image.Image("unittest/data/shapes.ppm", copy_to_fb=True)
|
img = image.Image("unittest/data/shapes.ppm", copy_to_fb=True)
|
||||||
lines = img.find_lines(threshold = 10000, theta_margin = 25, rho_margin = 25)
|
lines = img.find_lines(threshold = 10000, theta_margin = 25, rho_margin = 25)
|
||||||
return len(lines) == 4 and\
|
return len(lines) == 4 and\
|
||||||
lines[0][0:] == (22, 0, 22, 119, 119, 17340, 0, 22) and\
|
lines[0][0:-3] == (22, 0, 22, 119, 119) and\
|
||||||
lines[1][0:] == (0, 39, 159, 39, 159, 17340, 90, 39) and\
|
lines[1][0:-3] == (0, 39, 159, 39, 159) and\
|
||||||
lines[2][0:] == (57, 0, 57, 119, 119, 17340, 0, 57) and\
|
lines[2][0:-3] == (57, 0, 57, 119, 119) and\
|
||||||
lines[3][0:] == (0, 75, 159, 75, 159, 21420, 90, 75)
|
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)
|
||||||
|
|||||||
@ -2,4 +2,4 @@ def unittest(data_path, temp_path):
|
|||||||
import image
|
import image
|
||||||
img = image.Image("unittest/data/shapes.ppm", copy_to_fb=True)
|
img = image.Image("unittest/data/shapes.ppm", copy_to_fb=True)
|
||||||
rects = img.find_rects(threshold = 50000)
|
rects = img.find_rects(threshold = 50000)
|
||||||
return len(rects) == 1 and rects[0][0:] == (23, 39, 35, 36, 146566)
|
return len(rects) == 1 and rects[0][0:-1] == (23, 39, 35, 36)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user