How I create a image mask?

25 次查看(过去 30 天)
Samyak Raj Mehta
Samyak Raj Mehta 2015-11-29
I want to cut a complete face image in fixed face, without ears. Like we doing in photoshop. I have to create a mask from that i'll cut existing face images.
  2 个评论
Jan
Jan 2015-11-29
You forgot to explain any details. Do you want to determine the shape automatically or does the user define it with the mouse? Do you need a hard edge or some smoothing? Do you have the image processing toolbox?
In addition "provide me matlab code" is a command, not a polite question. This reduces the motivation to post an answer or provide a solution. So take the chance to edit the question, provide enough details to give us a chance to post a matching answer, and be polite.
Samyak Raj Mehta
Samyak Raj Mehta 2015-12-2
编辑:Samyak Raj Mehta 2015-12-2
Thank's for your suggestion. I want to make mask, from this mask i'll cut different kind of face which are from faceGen Modeller. I need Edge of image are smooth.
I attached a sample face cut image.
Thank's...

请先登录,再进行评论。

回答(2 个)

Image Analyst
Image Analyst 2015-11-29
See my attached demo of imfreehand.
  3 个评论
W.Khan
W.Khan 2017-10-20
Hello Image Analyst, I have two questions: for the selecting tool we can select only one object. What if I want to select more than one area. How to amend it?
Another question is: When I select the masked region, the mask is white (Masked white inside region). What if I want to fill this white area with some color, say blue, yellow etc? Please comment.
Thanks
Image Analyst
Image Analyst 2017-10-20
Put imfreehand in a loop.
Do the mask replacement on each color channel individually.

请先登录,再进行评论。


Image Analyst
Image Analyst 2015-12-2
For the face image, in your comment....
This image is already masked, so you must already have a mask, so I'm not sure what additional you need. If you don't have the mask, just take the max of the image and find zeros.
maxImage = max(rgbIMage, [], 3);
mask = maxImage ~= 0; % Inside of face, OR
mask = maxImage == 0; % Outside face - whichever you want.
  2 个评论
Samyak Raj Mehta
Samyak Raj Mehta 2015-12-2
I have used photoshop to cut this face and 24 images are still there to shape up. So can you please provide me solution from that my work will reduce. Or other wise any way to make outline of this face., from that I use outline of that face as a mask and cut rest of images.
Image Analyst
Image Analyst 2015-12-2
编辑:Image Analyst 2015-12-2
How can I know how to do that when you have not given the original, pre-mask image and only supplied the post-mask image? What is outside the part you masked that made you decide not to include that in the mask?
Anyway, if you have only 24 images to mask, you might get it done faster in Photoshop than if you have to write and debug a MATLAB program.

请先登录,再进行评论。

标签

Community Treasure Hunt

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

Start Hunting!

Translated by