How to replace a function vision.TextInserter() with a function insertText()?
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Santosh Fatale
il 1 Giu 2023
Hi Vitaliy,
Could you please share the MATLAB version that you are using for the above code snippet?
Risposte (1)
Shrey Tripathi
il 1 Giu 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.
Vedere anche
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!