Ask Your Question
0

OpenCV 3.1 - Upper body detection not working in any example

asked 2016-06-07 10:29:50 -0600

bvoid gravatar image

updated 2016-06-07 15:58:39 -0600

My problem: no upper bodies are being detected when using haarcascade_profileface.xml or haarcascade_mcs_profileface.xml.

Software used:

  • print cv2._ _version__ yields 3.0.0 although the x86 version (cv2.pyd) of OpenCV 3.1 is used

  • Python 2.7 x86

  • Numpy 11.1.0 x86
  • Eclipse x86
  • Windows 7 x64

(I tried with all x64 version but upperbodies remain undetected)

The following code is used:

import numpy as np
import cv2

img = cv2.imread('723.jpg',0)

upperBody_cascade = cv2.CascadeClassifier('haarcascade_upperbody.xml')    

arrUpperBody = upperBody_cascade.detectMultiScale(img)
if arrUpperBody != ():
        for (x,y,w,h) in arrUpperBody:
            cv2.rectangle(img,(x,y),(x+w,y+h),(255,0,0),2)
        print 'body found'

cv2.imshow('image',img)
cv2.waitKey(0)
cv2.destroyAllWindows()

Result: no upper bodies detected: Result: no upper bodies detected

Using haarcascade _mcs_upperbody.xml also yields NO detection.

When other haarcascades (eye, nose, mouth, face_default) are used, detection works fine. (And similar code using a webcam stream shows the same behaviour) Result with HAAR facecascade

Does anyone have an idea what can be the issue here?

edit retag flag offensive close merge delete

Comments

I tried with OpenCV 3.0 but the problem persists.. Anybody?

bvoid gravatar imagebvoid ( 2016-06-09 11:47:15 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2016-06-18 10:38:16 -0600

Eduardo gravatar image

updated 2016-06-18 10:53:52 -0600

I think it is normal that the detection with haarcascade_upperbody.xml returns no detection for your test image.

The learning file was trained for pedestrian detection purpose and thus is not adapted for your case. Following is the quote from the file haarcascade_upperbody.xml:

"Haar"-based Detectors For Pedestrian Detection by Hannes Kruppa and Bernt Schiele, ETH Zurich, Switzerland

This archive provides the following three detectors: - upper body detector (most fun, useful in many scenarios!) - lower body detector - full body detector

These detectors have been successfully applied to pedestrian detection in still images. They can be directly passed as parameters to the program HaarFaceDetect. NOTE: These detectors deal with frontal and backside views but not with side views (also see "Known limitations" below).

Here the video results for pedestrian detection:

By the way, here is what I got with haarcascade_upperbody.xml (no detection with the two others):

image description

edit flag offensive delete link more

Comments

Ok, so the training for pedestrians implies that a full pedestrian (from head to toes) should be visible before the upper body can be detected. It still surprises me that your code finds 2 hits while mine finds none. Are you willing to share it? Thank you :)

bvoid gravatar imagebvoid ( 2016-06-21 02:54:06 -0600 )edit

There is nothing particular in the code except that I used the C++ interface.

Eduardo gravatar imageEduardo ( 2016-06-21 03:56:05 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2016-06-07 10:29:50 -0600

Seen: 8,710 times

Last updated: Jun 18 '16