Generating a mask from scratch
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Salad Box
am 3 Okt. 2022
Kommentiert: Salad Box
am 4 Okt. 2022
Hi
I would like to generate a simple mask image from scratch in Matlab if it is possible.
It has the following criteria:
- the size of the image needs to be 500 x 500 pixels.
- the center of the mask image needs to be a number, say 8. This area is white [255 255 255].
- the size of the number is best to be adjustable by fontsize?.
- 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?
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 3 Okt. 2022
Bearbeitet: Image Analyst
am 3 Okt. 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.
5 Kommentare
Image Analyst
am 4 Okt. 2022
Thanks. You can use imbinarize to force it to have no "noise" or gray levels, which are probably used to anti-alias (smooth) the character. Also, if you save the image(s) make sure you use the PNG extension, for lossless compression, rather than JPG which will change and add gray levels due to it being lossy compression.
Weitere Antworten (0)
Siehe auch
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!