Add text to an image

版本 1.0.1 (9.0 KB) 作者: Josep Llobet
Put text into the corner of an image in order to make their presentation better.
42.0 次下载
更新时间 2023/7/11

查看许可证

Hi there,
convert_text_to_image is a function that put text into the corner of an image in order to makes their presentation better.
The main idea is put a text plus a data in the corner of the image, with the option of tuneate their scale. Inputs:
imatge_ficar_text - the main image. This can be in different formats
text_introduir - the text to introduce. If you don't want to put text, just put "".
dades_introduir - the data to introduce. If you don't want to put numbers, just put "".
escala_opci - if you want to scale the dimensions of the letters. Eye with do not put a too-much scale.
As ouput is the image.
This function works with the neat function text2im.m, Convert text to an image, developed by Tobias Kiessling(Tboias Kiessling 2021). This function I modificate just the first part because gave me an error.
Reference
Tobias Kiessling (2021). Convert Text to an image (https://www.mathworks.com/matlabcentral/fileexchange/19896-convert-text-to-an-image), MATLAB Central File Exchange. Retrieved August 6, 2021.
As code example:
I_celeg_raw = imread('http://www.news.wisc.edu/newsphotos/images/Kimble_worm_c_elegans2_02.jpg');
I_celeg_BW = rangefilt(I_celeg); I_celeg_BW = imbinarize(I_celeg_BW); SE = strel("disk", 8); I_celeg_BW = imclose(I_celeg_BW, SE); I_celeg_BW = imfill(I_celeg_BW, "holes");
imshow(I_celeg_BW)
[sfMaskBurn_new] = add_text_to_image(I_celeg_BW, "This is the text, and could be numbers: ", 1234);
imshow(sfMaskBurn_new)
[sfMaskBurn_new] = add_text_to_image(I_celeg_BW, "This is the text, and could be numbers: ", "", 2);
imshow(sfMaskBurn_new)
Thank you for reading, I hope it will be useful.
PS: I am working in image process of C.elegans, if anyone would like to share content in private I would be glad of discuss that.

引用格式

Josep Llobet (2024). Add text to an image (https://www.mathworks.com/matlabcentral/fileexchange/97207-add-text-to-an-image), MATLAB Central File Exchange. 检索时间: .

MATLAB 版本兼容性
创建方式 R2021a
兼容任何版本
平台兼容性
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
1.0.1

asdf

1.0.0