说明
基于opencv3.3.0自带的example例程而来
对例程做了较大的改动
参数需要根据实际的场景和应用来进行调整,相对于人脸识别,人体识别收到的影响更大,识别率和虚警率都较高,必须配合其他的模式一起方可实用。
步骤
读入图片
按照自带的训练集进行人体的识别
规范图片的显示顺序
图片矩形框的处理
图片显示和保存
'''
python3.6.3+opencv3.3.0
video_capture_HOG_people_detection
baseed on opencv3.3.0 example
'''
from __future__ import print_function
import cv2
import numpy as np
path='c://'
def inside(r, q):
rx, ry, rw, rh = r
qx, qy, qw, qh = q
return rx > qx and ry > qy and rx + rw < qx + qw and ry + rh < qy + qh
def draw_detections(img, rects, thickness = 1):
for x, y, w, h in rects:
# the HOG detector returns slightly la