Reputation: 117
How can I select a mask of irregular shape in an image in Matlab without using the imfreehand but automatically? The background of the image is black and I would like to select the entire image as mask just without the black background (everything without the black background).
Upvotes: 1
Views: 1265
Reputation: 26069
try this:
threshold=0; % or a different value if needed
mask=image>threshold;
given that the background is truly black, i.e. pixels values are 0, the set threshold to zero. Otherwise, select a value that captures the background (there are ways to do that automatically)
Upvotes: 1