Reputation: 1040
I'm looking for a bit of guidance... I have a single image of a passport photo. What I would like to do is separate the person and the background. I will then analyse the background colour, pattern, etc.
I've done some research into segmentation and most of what I'm finding uses multiple frames. Unfortunately I only have one frame and do not have the luxury to take a picture of the background without a person.
I have also looked at GrabCut, but I do not want the user to have to manually select background/foreground parts of the image. Is there an automated version of this, possibly?
I was thinking about using contour/edge (canny?) detection?...
Thank you in advance!
Edit: Sample set of images can be found here: https://i.sstatic.net/FvRgF.jpg
So I followed Froyo's advice and so far have the following result: https://i.sstatic.net/yQpdx.png
Some of the edges are cut off because of the face detection rectangle, so I'll need to increase the size of the rect when a face is detected.
Upvotes: 0
Views: 3968
Reputation: 18477
You could use GrabCut and wouldn't need to get manual input. You should detect the face using Haar Cascades and pass the bounding box to GrabCut. I think this would work.
I have some experience in segmenting foreground and background, but I also had a disparity map, so it was sort of easier. I used superpixels and clustered them to get separate foreground and background extracted.
SLIC and SLICO are the state of the art algorithms for superpixels segmentation. Here is some of the work done in this field.
https://cvhci.anthropomatik.kit.edu/~baeuml/downloads/Schick2012.pdf
http://www.cs.huji.ac.il/~daphna/papers/Rosenfeld_ICCV2011.pdf
You could also try Saliency Maps. They are used to extract salient objects from the image and in your case the foreground that you are looking for.
Upvotes: 4