%%%%
% OCR example

I = imread('Connections.png');
img = im2gray(I);
result = ocr(img);

result.Text

result.TextLines

result.Words

% Word Confidence
wordConf = insertObjectAnnotation(img,"rectangle", ...
                           result.WordBoundingBoxes, ...
                           result.WordConfidences);
figure
imshow(wordConf)

% Line Confidence
lineConf = insertObjectAnnotation(img,"rectangle", ...
                           result.TextLineBoundingBoxes, ...
                           result.TextLineConfidences);
figure
imshow(lineConf)

% Character Confidence
charConf = insertObjectAnnotation(img,"rectangle", ...
                           result.CharacterBoundingBoxes, ...
                           1.0*(result.CharacterConfidences >= 0.8));
figure
imshow(charConf)