Generating a mask from scratch

6 views (last 30 days)
Salad Box
Salad Box on 3 Oct 2022
Commented: Salad Box on 4 Oct 2022
Hi
I would like to generate a simple mask image from scratch in Matlab if it is possible.
It has the following criteria:
  1. the size of the image needs to be 500 x 500 pixels.
  2. the center of the mask image needs to be a number, say 8. This area is white [255 255 255].
  3. the size of the number is best to be adjustable by fontsize?.
  4. the rest of the areas in the mask image needs to be black [0 0 0].
See the sample image below which is NOT done in Matlab. Is this achievable in Matlab?

Accepted Answer

Image Analyst
Image Analyst on 3 Oct 2022
Edited: Image Analyst on 3 Oct 2022
It's a trivial modification of the code in the FAQ that draws a ring. Just make two rings with different centers and radii.
You could also use insertText if you have the Computer Vision Toolbox.
  5 Comments
Salad Box
Salad Box on 4 Oct 2022
Thank you very much for your advices. I will try the imbinarize.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!