Reputation: 141
Have anyone ever used vision.PeopleDetector function from Computer Vision System Toolbox in Matlab? I've installed it and tried to apply to images I have. Although it detects people on the training image, it detects nothing on real photos. Either it doesn't detect people at all or detects people at parts of the image where they are not presented.
Could anyone share the experience of using this function? Thanks a lot!
Here is a sample image:
Upvotes: 2
Views: 3580
Reputation: 39389
The vision.PeopleDetector
object does indeed detect upright standing people in images. However, like most computer vision algorithms it is not 100% accurate. Can you post a sample image where it fails?
There are several things you can try to improve performance.
ClassificationModel
parameter to 'UprightPeople_96x48'
. There are two models that come with the object, trained on different data sets. 'UprightPeople_128x64'
model, then you will not be able to detect a person smaller than 128x64 pixels. Similarly, for the 'UprightPeople_96x48'
model the smallest size person you can detect is 96x48. If the people in your image are smaller than that, you can up-sample the image using imresize
.ClassificationThreshold
parameter to get more detections.Edit: Some thoughts on your particular image. My guess would be that the people detector is not working well here, because it was not trained on this kind of images. The training sets for both models consist of natural images of pedestrians. Ironically, the fact that your image has a perfectly clean background may be throwing the detector off.
If this image is typical of what you have to deal with, then I have a few suggestions. One possibility is to use simple thresholding to segment out the people. The other is to use vision.CascadeObjectDetector
to detect the faces or the upper bodies, which happens to work perfectly on this image:
im = imread('postures.jpg');
detector = vision.CascadeObjectDetector('ClassificationModel', 'UpperBody');
bboxes = step(detector, im);
im2 = insertObjectAnnotation(im, 'rectangle', bboxes, 'person', 'Color', 'red');
imshow(im2);
Upvotes: 1