%使用vision.TextInserter
number_text=vision.TextInserter(num2str(number));
%设定相关属性
number_text.FontSize=90;
number_text.Color=[round(1+(rand(1)*(255-1))) round(1+(rand(1)*(255-1))) round(1+(rand(1)*(255-1)))];
number_text.Location=[number_text_location_X 0];
%将文字添加到图片上
imgBgWithNumber=step(number_text,imgBgNumberCrop);
%这里所得到的imgBgWithNumber是可以保存下来的
具体看vision.TextInserter的文档

本文介绍如何使用Matlab中的vision.TextInserter函数为图像添加指定大小及颜色的数字,并提供了设置字体大小、颜色及位置的具体步骤。
2093

被折叠的 条评论
为什么被折叠?



