By mapetilan

2011-12-13 12:15:30 8 Comments

I would like to extract the silhouette of a human in a photo and remove the background. The photo could be taken of the full body, only the upper body or only the lower body.

What I have done so far is track the face using Haar Cascades, but the algorithm I use does a rectangle over the face and I would need the shape of all the body. I have tried HOG as well, but as well it gives me a rectangle and it doesn't work with all photos.

It would be great if somebody could help me. I'm using OpenCV and C++.


@Sam 2011-12-13 13:19:05

You can try the GrabCut or GraphCut algorithms (At least grabcut is present in OpenCV).

You tell them the rectangle (where the body is), and they do the best to cut the object inside. It's not fast, nor perfect, but you'll have a hard time trying to find something better.

This is an open research field, so if your images do not get cut as you want, prepare yourself for some years of post-PhD research to find better algorithms :)

@Ian Medeiros 2011-12-13 13:28:57

Just for completeness, GraphCut isn't a silhouete detection, but a background segmentation alghorithm. Instead of training the computer to find a person, what would be extremely difficult, it uses the background information to extract the foreground. It's not designed to classify the foreground as a person or any other object, but if you garantee that the foreground IS a person in your input data, you have detected it's silhouete.

@Sam 2011-12-13 13:33:28

Good addition, Ian!

@mapetilan 2011-12-13 19:04:16

Hi Ian, thanks for your help. I have already tried this algorithm. But the problem is when I use it, it does strange things. For example, if I select the person it does a segmentation tacking some parts of the body and some parts of the environment. Anyway I will try to change some of the parameters and see if I can get a better result.Thanks again. Miguel

@Ian Medeiros 2011-12-14 15:32:28

If you are going for the background segmentation aproach, I think that GraphCut is an overkill, it's not designed to be used on real time applications (maybe with a GPU implementation). I've never used this alghorithm, but saw a friend of mine performing a performance analysis on it and concluded that a simple background substraction plus some erode/dilation alghorithm suffices in most cases.

Related Questions

Sponsored Content

24 Answered Questions

[SOLVED] Image Processing: Algorithm Improvement for 'Coca-Cola Can' Recognition

3 Answered Questions

[SOLVED] Merging overlapping rectangle with OpenCV

1 Answered Questions

[SOLVED] Extract face rectangle from ID card

0 Answered Questions

Hand detection and tracking methods

3 Answered Questions

1 Answered Questions

2 Answered Questions

[SOLVED] Opencv transparent object detection

2 Answered Questions

[SOLVED] Haar Cascade vs Hog Detection

1 Answered Questions

Head (not face) detection and tracking in kinect depth maps

2 Answered Questions

[SOLVED] Detecting Specific Shapes with OpenCV

  • 2013-03-29 00:39:45
  • Peck
  • 1089 View
  • 0 Score
  • 2 Answer
  • Tags:   opencv

Sponsored Content