def get_similarIamgeRect(*args):
"""
????????.
:param img:
:param lefttop_x:
:param lefttop_y:
:return:
"""
kargs = args[0]
img = kargs[0];
lefttop_x = kargs[1];
lefttop_y = kargs[2];
min_wdw_sz = kargs[3];
downscale = kargs[4]
scale = kargs[5];
# Calculate the HOG features
right_y = lefttop_y + min_wdw_sz[1];
right_x = lefttop_x + min_wdw_sz[0];
fd = hog(img[lefttop_y:right_y, lefttop_x:right_x],
orientations,
pixels_per_cell,
cells_per_block,
visualize,
normalize)
prod = clf.predict_proba([fd])[0][1]
prod = round(prod, 3);
# print '------------------'
if prod >= 0.85: ##???????0.5?????
mutex.acquire();
detections.append((int(lefttop_x * (downscale ** scale)), int(lefttop_y * (downscale ** scale)), prod,
int(min_wdw_sz[0] * (downscale ** scale)),
int(min_wdw_sz[1] * (downscale ** scale))));
print _thread.current_thread(), "Detection:: Location -> ({}, {})".format(lefttop_x, lefttop_y)
print _thread.current_thread(), "Scale -> {} | Confidence Score {} \n".format(scale, prod)
mutex.release();
评论列表
文章目录