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.
참고 항목
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!