MATLAB: How to create a mask for the image

image maskingImage Processing Toolbox

I want to generate a mask for my image.How can I generate it?
The mask image should be like the below picture.

Best Answer

Mask = (YourImage>threshold);