How to create a binary image

21 次查看(过去 30 天)
computing6
computing6 2015-4-12
"Make a mask" I need to choose an input image, which will just be a picture of me on a white wall, remove the background around me on the image, and then the output needs to be the binary image or "mask". What would the code be to have matlab iterate through all of the rows and columns to decide:
if its background to make it black
and if its me to make it white
So the resulting image will be a white blob (me) on a black background
I know that relevant functions I should be using are: imread(), size(), image(x,y,:), and then nested for loops to iterate through rows/columns.
I'm mostly just confused on where to begin/what the nested for loops should be...
Thank you!!
  1 个评论
Image Analyst
Image Analyst 2015-4-13
You forgot to post the photo. Is the background a uniform color or texture? How are we supposed to know what's you and what's background? We'll answer more once you post the photo.

请先登录,再进行评论。

回答(1 个)

Image Analyst
Image Analyst 2015-4-13
Until you post your image, see my Image Segmentation Tutorial in my File Exchange http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862. It takes an image of coins on a uniform background and finds the coins and measures some things about them. It's a good basic tutorial on image segmentation.

Community Treasure Hunt

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

Start Hunting!

Translated by