I'm looking for a way to detect humans in a picture. For instance, regarding the picture below, I'd like to coarsely determine how many people are in the scene. I must be able to detect both standing and sitting people. I do not mind not detecting people located behind a physical object (such as the glass in the bus picture).

enter image description here

AFAIK, such a problem can rather easily be solved by training deep neural networks. However, my coworkers would like me to also implement a detection technique based on general image processing techniques. I've spent several days looking for techniques designed by researchers but I couldn't find anything else than saliency-based techniques (which may be fine, but I'd like to test several techniques based on old-fashioned image processing).

I have strong constraints on the nature of images, for instance luminosity: whether they've been taken during the day or at night, the pictures will have very different characteristics (e.g. image contrast can strongly vary).

Long story short, I'd like to know if there's indeed some existing segmentation technique for which it'd be interesting giving a shot, given the fact that the information carried by the images vary a lot?


1 Answer 1


One of the popular feature descriptors used for human detection is HOG - Histogram of Oriented Gradients. Usually you would train a classifier for recognizing human vs non-human, and then you would implement a sliding window technique. HOG has implementations in most of the scientific libraries in the Python community, for example in skimage there is an example here, which I am copying here because a link could always become broken:

import matplotlib.pyplot as plt

from skimage.feature import hog
from skimage import data, exposure

image = data.astronaut()

fd, hog_image = hog(image, orientations=8, pixels_per_cell=(16, 16),
                    cells_per_block=(1, 1), visualize=True, multichannel=True)

fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(8, 4), sharex=True, sharey=True)

ax1.imshow(image, cmap=plt.cm.gray)
ax1.set_title('Input image')

# Rescale histogram for better display
hog_image_rescaled = exposure.rescale_intensity(hog_image, in_range=(0, 10))

ax2.imshow(hog_image_rescaled, cmap=plt.cm.gray)
ax2.set_title('Histogram of Oriented Gradients')

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.