How to replace a function vision.TextInserter() with a function insertText()?
2 views (last 30 days)
Show older comments
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 Comments
Santosh Fatale
on 1 Jun 2023
Hi Vitaliy,
Could you please share the MATLAB version that you are using for the above code snippet?
Answers (1)
Shrey Tripathi
on 1 Jun 2023
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.
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!