How can this code be modernized?
조회 수: 1 (최근 30일)
이전 댓글 표시
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?
댓글 수: 0
답변 (1개)
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
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!