How does matlab add transparent fonts to pictures?

42 ビュー (過去 30 日間)
cui,xingxing
cui,xingxing 2021 年 9 月 13 日
回答済み: cui,xingxing 2021 年 9 月 13 日
As far as I know, only "text", "insertText" function can add text to the picture, I prefer to use "insertText" to add font to the existing picture, but I want the font to be semi-transparent, the function lacks " transparent" property specified, where "BoxOpacity" is not the property I want, how do I do it?

採用された回答

cui,xingxing
cui,xingxing 2021 年 9 月 13 日
After trying to figure it out, I gave the answer , for example:
% your params
img = imread('printedtext.png');
Transparency = 0.6;
fontColor = [1,1,1]; % RGB,range [0,1]
position = [700,200];
%% add watermark
mask = zeros(size(img),'like',img);
outimg = insertText(mask,position,'china', ...
'BoxOpacity',0,...
'FontSize',200,...
'TextColor', 'white');
bwMask = imbinarize(rgb2gray(outimg));
finalImg = labeloverlay(img,bwMask,...
'Transparency',Transparency,...
'Colormap',fontColor);
imshow(finalImg)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeComputer Vision with Simulink についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by