필터 지우기
필터 지우기

How can this code be modernized?

조회 수: 1 (최근 30일)
Francisco Sanchez
Francisco Sanchez 2018년 4월 5일
답변: Prajit T R 2018년 4월 9일
So currently I came across a really interesting code which I want to implement in a school project.
While running it, I have come across the issue with vision.TextInserter. I know that the modern way to insert text is to use the function insertText but I cannot seem to figure out how to correctly execute that function. Can someone help me solve that issue?

답변 (1개)

Prajit T R
Prajit T R 2018년 4월 9일
Hi Francisco
Here is an example of how you can modify the code to incorporate 'insertText':
%rgbFrame = step(vidDevice);
text_str= 'Red'
position = [5 2];
box_color = 'red'
htextinsRed = insertText(rgbFrame,position,text_str,'FontSize',18,'BoxColor',box_color,'BoxOpacity',0.4,'TextColor','white');
imshow(htextinsRed);
text_str= 'Green'
position = [5 18];
box_color = 'green'
htextinsGreen = insertText(rgbFrame,position,text_str,'FontSize',18,'BoxColor',box_color,'BoxOpacity',0.4,'TextColor','white');
imshow(htextinsGreen);
text_str= 'Blue'
position = [5 34];
box_color = 'blue'
htextinsBlue = insertText(rgbFrame,position,text_str,'FontSize',18,'BoxColor',box_color,'BoxOpacity',0.4,'TextColor','white');
For more details, you check out the folowing documentation link: https://www.mathworks.com/help/releases/R2017b/vision/ref/inserttext.html If any further changes are to be made, you can refer the above link for syntax and other information.
Hope this helps
Cheers

카테고리

Help CenterFile Exchange에서 Geometric Transformation and Image Registration에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by