www.gusucode.com > vision 源码程序 matlab案例代码 > vision/AnnotateImageWithNumbersAndStringsExample.m
%% Annotate Image with Numbers and Strings % %% % Read image. I = imread('board.tif'); %% % Create labels of floating point numbers. The floating point numbers % relate to confidence value labels. label_str = cell(3,1); conf_val = [85.212 98.76 78.342]; for ii=1:3 label_str{ii} = ['Confidence: ' num2str(conf_val(ii),'%0.2f') '%']; end %% % Set the position for the rectangles as [x y width height]. position = [23 373 60 66;35 185 77 81;77 107 59 26]; %% % Insert the labels. RGB = insertObjectAnnotation(I,'rectangle',position,label_str,... 'TextBoxOpacity',0.9,'FontSize',18); %% % Display the annotated image. figure imshow(RGB) title('Annotated chips');