How to replace a function vision.TextInserter() with a function insertText()?
2 次查看(过去 30 天)
显示 更早的评论
htextinsRed = vision.TextInserter('Text', 'Red : %2d', ... % Set text for number of blobs
'Location', [5 2], ...
'Color', [1 0 0], ... // red color
'Font', 'Courier New', ...
'FontSize', 14);
2 个评论
Santosh Fatale
2023-6-1
Hi Vitaliy,
Could you please share the MATLAB version that you are using for the above code snippet?
回答(1 个)
Shrey Tripathi
2023-6-1
Hello Vitaliy,
You can use the insertText() function as follows:
% Load image
img = imread('image_file.png');
% Define position for text
position = [5 5];
% Number of blobs
num_blobs = 10;
% Format text
text = sprintf('Red : %2d', num_blobs);
% Insert text
img = insertText(img, position, text, 'FontSize', 14, 'Font', 'Courier New', 'TextColor', 'red');
% Display image
imshow(img);
Where img is your image on which you need to insert the text.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Feature Detection and Extraction 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!