안녕하세요 모두 저는 OpenCV를 사용하여 Python을 사용하는 사람 감지 프로그램을 만들고 있습니다. 나는 this very good example을 보았고 나는 가지고 있던 견본에 그것을 달렸다. 사람들이 직면하고있는 곳을 불문하고 사람들을 감지 할 수 있으며, 또한 뚜렷한 중첩 감지는 물론 흐린 동작을 가지고 있습니다. 나는 내가 가진 일부 이미지 (주로 무릎까지, 허리, 사람의 가슴까지 사진)에 실행되었을 때OpenCV 3 Python - 부분적인 인간 탐지?
그러나, 나는 소프트웨어가 확실히 사람을 감지하지 않는 것을 발견.
당신은 photos from this link 얻을 수 있습니다. 다음 코드는 제가 사용하고있는 코드입니다 :
# import the necessary packages
from __future__ import print_function
from imutils.object_detection import non_max_suppression
from imutils import paths
import numpy as np
import argparse
import imutils
import cv2
ap = argparse.ArgumentParser()
ap.add_argument("-i", "--images", required=True, help="path to images directory")
args = vars(ap.parse_args())
# initialize the HOG descriptor/person detector
hog = cv2.HOGDescriptor()
hog.setSVMDetector(cv2.HOGDescriptor_getDefaultPeopleDetector())
# loop over the image paths
imagePaths = list(paths.list_images(args["images"]))
for imagePath in imagePaths:
# load the image and resize it to (1) reduce detection time
# and (2) improve detection accuracy
image = cv2.imread(imagePath)
image = imutils.resize(image, width=min(400, image.shape[1]))
orig = image.copy()
# detect people in the image
(rects, weights) = hog.detectMultiScale(image, winStride=(4, 4),
padding=(8, 8), scale=1.05)
# draw the original bounding boxes
for (x, y, w, h) in rects:
cv2.rectangle(orig, (x, y), (x + w, y + h), (0, 0, 255), 2)
# apply non-maxima suppression to the bounding boxes using a
# fairly large overlap threshold to try to maintain overlapping
# boxes that are still people
rects = np.array([[x, y, x + w, y + h] for (x, y, w, h) in rects])
pick = non_max_suppression(rects, probs=None, overlapThresh=0.65)
# draw the final bounding boxes
for (xA, yA, xB, yB) in pick:
cv2.rectangle(image, (xA, yA), (xB, yB), (0, 255, 0), 2)
# show some information on the number of bounding boxes
filename = imagePath[imagePath.rfind("/") + 1:]
print("[INFO] {}: {} original boxes, {} after suppression".format(
filename, len(rects), len(pick)))
# show the output images
cv2.imshow("Before NMS", orig)
cv2.imshow("After NMS", image)
cv2.waitKey(0)
매우 간단합니다. 그것은 이미지를 거쳐 그 안에있는 사람들을 찾은 다음 경계 사각형을 그립니다. 직사각형이 겹쳐 있으면 오탐 (false positive)을 방지하고 한 명으로 1 명 이상을 탐지하기 위해 함께 결합됩니다. 제가 위에서 언급 한 바와 같이
그러나 코드는 자신의 발 부분이없는 경우 사람을 인식하지 못합니다.
을 OpenCV는 자신의 신체의 일부있을 수 있습니다 사람들이 인식 할 수있는 방법이 있나요 비디오에 존재하는 (최대 허리를 무릎까지이 가슴까지)? 내 유스 케이스 시나리오에서는 팔과 다리를 찾는 것이 중요하지 않다고 생각합니다. 몸통과 머리가있는 한 볼 수 있어야합니다.
모든 리드가 매우 감사하겠습니다.
상체 탐지를 위해 이미 훈련 된 하얼 폭포를 사용할 수 있습니다. [여기] (http://stackoverflow.com/a/31834603/5008845)와 그 링크 – Miki
@Miki 상위 신체 탐지를 위해 훈련 된 Haar Cascades는 전신이 보이면 상체만을 탐지 할 수있는 것처럼 보입니다. ? 다른 haar cascade xml 파일을 찾고있을 수 있습니다. – Razgriz
나에게 많은 이해가되지 않습니다 ...하지만이 링크를보고 내가 그들을 사용되지 않는, 그래서 나는 확실히 – Miki