In [85]:
import numpy as np
import cv2
import matplotlib.pyplot as plt

In [ ]:
filename = 'cropped.jpg'
img = cv2.imread(filename)

In [95]:
hog = cv2.HOGDescriptor()

# Detect people in static images
# based on http://lear.inrialpes.fr/people/triggs/pubs/Dalal-cvpr05.pdf
peopledetector = cv2.HOGDescriptor_getDefaultPeopleDetector()

# Set the dector
hog.setSVMDetector( peopledetector )
# http://i1.theportalwiki.net/img/2/2a/Turret_turret_autosearch_4.wav
found, weights = hog.detectMultiScale(img,  winStride=(8,8), padding=(32,32), scale=1.01)
found


Out[95]:
array([[1046,  517,   80,  159],
       [ 740,  548,   67,  134],
       [1236,  527,   91,  182],
       [ 426,  611,   76,  152],
       [ 626,  640,  115,  230],
       [ 640,  675,   95,  190]], dtype=int32)

In [84]:
# http://i1.theportalwiki.net/img/5/58/Turret_turret_active_7.wav
fig, ax = plt.subplots(figsize=(13,8))
ax.imshow(img)
for rect in found:
    x,y, w, h = rect
    r = plt.Rectangle([x,y],w,h, alpha=0.3)
    ax.add_patch(r)



In [ ]: