How to create a binary image

20 views (last 30 days)
computing6
computing6 on 12 Apr 2015
Answered: Image Analyst on 13 Apr 2015
"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 Comment
Image Analyst
Image Analyst on 13 Apr 2015
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.

Sign in to comment.

Answers (1)

Image Analyst
Image Analyst on 13 Apr 2015
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!