-
Notifications
You must be signed in to change notification settings - Fork 120
/
test_image.py
77 lines (66 loc) · 1.91 KB
/
test_image.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
from pdb import Pdb
from Image_Video import display,blur,edge_detect,count_cards,face_detect,webcam_face_detect
import os
import glob
def test_display():
try:
for f in glob.glob("test*.png"):
os.remove(f)
except:
pass
image = "Image_Video/ship.jpg"
display.display(image, True)
assert(os.path.exists("test_display2.png"))
def test_blur():
try:
for f in glob.glob("test*.png"):
os.remove(f)
except:
pass
image = "Image_Video/ship.jpg"
blur.blur_display(image, True)
assert(os.path.exists("test_blurred.png"))
def test_edge():
try:
for f in glob.glob("test*.png"):
os.remove(f)
except:
pass
image = "Image_Video/ship.jpg"
edge_detect.edge_detect(image, True)
assert(os.path.exists("test_edge.png"))
def test_count_cards():
try:
for f in glob.glob("test*.png"):
os.remove(f)
except:
pass
image = "Image_Video/cards.jpg"
cards = count_cards.count_cards(image, True)
assert(cards == 5)
assert(os.path.exists("test_count_cards.png"))
for f in glob.glob("test*.png"):
os.remove(f)
def test_face_detect():
try:
for f in glob.glob("test*.png"):
os.remove(f)
except:
pass
image = "Image_Video/abba.png"
faces = face_detect.face_detect(image, True, "Image_Video/haarcascade_frontalface_default.xml")
assert(faces == 4)
assert(os.path.exists("test_face.png"))
for f in glob.glob("test*.png"):
os.remove(f)
def test_webcam_face_detect():
try:
for f in glob.glob("test*.png"):
os.remove(f)
except:
pass
image = "Image_Video/abba.png"
faces = webcam_face_detect.webcam_face_detect("Image_Video/webcam.mp4", True, "Image_Video/haarcascade_frontalface_default.xml")
assert(faces == 2)
for f in glob.glob("test*.png"):
os.remove(f)