make facedetect.py work when the nested cascade is not specified
This commit is contained in:
parent
5f8f56ea0e
commit
036c438904
@ -49,11 +49,12 @@ if __name__ == '__main__':
|
|||||||
rects = detect(gray, cascade)
|
rects = detect(gray, cascade)
|
||||||
vis = img.copy()
|
vis = img.copy()
|
||||||
draw_rects(vis, rects, (0, 255, 0))
|
draw_rects(vis, rects, (0, 255, 0))
|
||||||
for x1, y1, x2, y2 in rects:
|
if not nested.empty():
|
||||||
roi = gray[y1:y2, x1:x2]
|
for x1, y1, x2, y2 in rects:
|
||||||
vis_roi = vis[y1:y2, x1:x2]
|
roi = gray[y1:y2, x1:x2]
|
||||||
subrects = detect(roi.copy(), nested)
|
vis_roi = vis[y1:y2, x1:x2]
|
||||||
draw_rects(vis_roi, subrects, (255, 0, 0))
|
subrects = detect(roi.copy(), nested)
|
||||||
|
draw_rects(vis_roi, subrects, (255, 0, 0))
|
||||||
dt = clock() - t
|
dt = clock() - t
|
||||||
|
|
||||||
draw_str(vis, (20, 20), 'time: %.1f ms' % (dt*1000))
|
draw_str(vis, (20, 20), 'time: %.1f ms' % (dt*1000))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user