www.gusucode.com > vision 源码程序 matlab案例代码 > vision/DisplayFourNumericValuesOnAnImageAtDifferentLocationsExample.m

    %% Display Four Numeric Values on an Image at Different Locations
%% Set up the text using the text inserter object.

% Copyright 2015 The MathWorks, Inc.

textInserter = vision.TextInserter('%d', 'LocationSource', 'Input port', 'Color',  [255, 255, 255], 'FontSize', 24);
%% Read the image.
I = imread('peppers.png');
%% Insert the text.
J = step(textInserter, I, int32([1 2 3 4]), int32([1 1; 500 1; 1 350; 500 350]));
%% Display the image containing the numeric values.
imshow(J);