How to replace a function vision.TextInserter() with a function insertText()?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Santosh Fatale
am 1 Jun. 2023
Hi Vitaliy,
Could you please share the MATLAB version that you are using for the above code snippet?
Antworten (1)
Shrey Tripathi
am 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.
1 Kommentar
Siehe auch
Kategorien
Mehr zu Feature Detection and Extraction finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!