Commit 824c43ba authored by Michael Murtaugh's avatar Michael Murtaugh

sizes:

parent b2efd8d1
......@@ -60,11 +60,16 @@ def ensure_list (f):
else:
return [f]
def tuple_lists(args):
for (key, value) in args.items():
if type(value) == list:
args[key] = tuple(value)
return args
def process_features (grayimg, features):
ret = {}
for x in features:
roi = grayimg
ox, oy = 0, 0
if type(x) == list:
f1, f2 = x
else:
......@@ -82,13 +87,12 @@ def process_features (grayimg, features):
else:
rects2 = ret[f2['name']]
for (x,y,w,h) in f1['_cascade'].detectMultiScale(roi, **f1['args']):
for (x,y,w,h) in f1['_cascade'].detectMultiScale(roi, **tuple_lists(f1['args'])):
rects.append([int(x), int(y), int(w), int(h)])
# narrow for (evt) next cascaded feature...
if f2:
roi = roi[y:y+h, x:x+w]
for (x2,y2,w2,h2) in f2['_cascade'].detectMultiScale(roi, **f2['args']):
for (x2,y2,w2,h2) in f2['_cascade'].detectMultiScale(roi, **tuple_lists(f2['args'])):
rects2.append([int(x+x2), int(y+y2), int(w2), int(h2)])
return ret
......
{
"port":10987,
"ipaddress":"192.168.0.21",
"archive": "archive.features.json",
"ipaddress":"localhost",
"features": [
{"name": "bodies", "cascade": "haarcascade_fullbody.xml", "color": "255,0,0", "width": 2, "args": {"minSize": [100, 100] }},
[
{"name": "faces", "cascade": "haarcascade_frontalface_default.xml", "color": "255,255,0", "width": 2},
{"name": "eyes", "cascade": "haarcascade_eye.xml", "color": "255,255,0", "width": 2}
],
{"name": "bodies", "cascade": "haarcascade_fullbody.xml", "color": "255,255,0", "width": 2}
{"name": "faces", "cascade": "haarcascade_frontalface_default.xml", "color": "0,0,255", "width": 2, "args": {"minSize": [100, 100] }},
{"name": "eyes", "cascade": "haarcascade_eye.xml", "color": "0,255,0", "width": 2}
]
]
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment