Head and Shoulder Detection (looking from the top)

2.2k Views Asked by At

This is my first post here since I cannot find any suitable answer for my research.

I want to use openCV to detect the Head-shoulder pattern to be use in some project.

Camera setting is in the ceiling directly facing down to be used in apps for like people counting etc.

I want my camera to detect/recognize the head and the shoulder from top and not the usual face detection wherein in frontal or back.

Do anyone knows how to? Kindly share me some tips or a simple source code for this one.

2

There are 2 best solutions below

2
On

Apparantly they have used some sort of Time-of-Flight (ToF) Camera, instead of an intesity-based device. I assume that your specific camera is of the latter type, so I don't see any practical approach to the task.

If you had a ToF camera image segmentation would be close to trivial (e.g. thresholding). Afterwards you could simply look for shapes and gradients (distance plateaus and gradients) that are characteristical for head and shoulders and you'd be done.

My suggestion is to go and get a ToF camera and play around with standard CV algorithms. Also have a look at the Kinect, which also is a distance measurement device and could be used as well for this task (though not based on ToF but rather structured light, as far as I know).

1
On

I'm afraid the solution is not that simple to describe it in a few lines of code. I think you can start from the face detection sample code in openCV, but, in order to detect people from top, you need a different classifier. You need to find such kind of classifier (I'm sure you can find it somewhere, or you can ask the guy that posted the video you mentioned), and in case you don't get it, you need to train such classifier your self.

An alternative could be subtracting from a background image reference, the current foreground frame, the result is objects passing in the screen, however you cannot distinguish between humans and other objects.