Add Text To Image

版本 1.2.0.0 (7.7 KB) 作者: Daniel Warren
Overlays rasterized text on an image matrix.
3.6K 次下载
更新时间 2013/4/18

查看许可证

Sometimes it's nice to be able to place text on an image and know precisely where it will render irrespective of the figure size and shape and other whims of the text() function. This submission achieves that by directly overwriting part of the image matrix with rasterized text generated using bitmapped fonts. It allows the use of any system font that text() will take. Text size, colour and position can also be controlled.

This code can undoubtedly be tweaked (or maybe just rewritten) to produce more aesthetically pleasing results. Feel free to build upon it!

引用格式

Daniel Warren (2024). Add Text To Image (https://www.mathworks.com/matlabcentral/fileexchange/40959-add-text-to-image), MATLAB Central File Exchange. 检索来源 .

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

启发作品: xic draw

Community Treasure Hunt

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

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

Included drawnow call in BitmapFont and removed dependency on Image Processing Toolbox as suggested by B Treeby. Also added a separate version which adds a border to the text with custom colour and thickness.

1.1.0.0

Wrote a demonstration script to produce the screenshot, which revealed a vertical clipping bug when using large fonts - this has been fixed. Also avoided some error conditions when requested position is almost or completely outside the image.

1.0.0.0