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

    %% Recognize Text in Regions of Interest (ROI)
%
%% 
% Read image.
I = imread('handicapSign.jpg');
%% 
% Define one or more rectangular regions of interest within I.
roi = [360 118 384 560];
%% 
% You may also use IMRECT to select a region using a mouse:
%    figure; imshow(I); roi = round(getPosition(imrect))
ocrResults = ocr(I, roi);   
%% 
% Insert recognized text into original image
Iocr = insertText(I,roi(1:2),ocrResults.Text,'AnchorPoint',...
    'RightTop','FontSize',16);
figure; imshow(Iocr);