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.
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");
[sfMaskBurn_new] = add_text_to_image(I_celeg_BW, "This is the text, and could be numbers: ", 1234);
[sfMaskBurn_new] = add_text_to_image(I_celeg_BW, "This is the text, and could be numbers: ", "", 2);
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.