Obtain trimap of the image

Most image matting algorithms need image and trimap of the image as input. My question is how to get the trimap of the image? Is their any matlab command for that or any code... Please help. Thanks

3 Comments

Hi,
Can you use some kind of edge detection first to create a mask?
I can use canny edge detector code to create the mask. But please guide how to get the trimap out of it
Which function are you using for image matting?

Sign in to comment.

Answers (1)

Image Analyst
Image Analyst on 8 Feb 2015
Edited: Image Analyst on 8 Feb 2015
I've never heard of that term before. I had to look it up and found this: "trimap--a pre-segmented image consisting of three regions of foreground (what you want to cut out), background and unknown. Partial opacity values are then computed only for pixels inside the unknown region."
Normally people just call that the segmentation, segmented image, or classified image. Anyway, as I would hope that you realize. That TOTALLY depends on your image and what you consider to be foreground and background. So the algorithm to produce the "trimap" of course will vary also. But you forgot to attach your image and I can't answer any more until you do. Usually people give us an image to look at if they want image processing advice - it only makes sense. Use the green and brown picture icon, when you fix your post, to insert an image.
In the meantime, several methods are shown in my File Exchange.

Categories

Find more on Image Processing and Computer Vision in Help Center and File Exchange

Asked:

on 8 Feb 2015

Edited:

on 8 Feb 2015

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!