boxOverlay

Overlay a bounding box

Contents

Syntax

Description

boxOverlay(bb, color, width, textString, textPos)

Example

Example 1

BW=[1 1 1 0 0 0 0 0;1 0 1 0 1 1 0 0;1 1 1 0 1 1 0 0;0 0 0 0 0 0 1 0;1 1 1 0 0 0 1 0;1 0 1 0 0 0 1 0;1 0 1 0 0 1 1 0;1 1 0 0 0 0 0 0];
objLabel=bwlabel(BW, 4);
stats=regionprops(objLabel);
figure;
subplot(121); imshow(BW);
subplot(122); imagesc(objLabel); axis image; colorbar
for i=1:length(stats)
	boxOverlay(stats(i).BoundingBox, getColor(i), 1, int2str(i), 'bottom');
end

Example 2

BW=imread('text.png');
objLabel=bwlabel(BW);
stats=regionprops(objLabel);
figure; imagesc(objLabel); axis image; colorbar
for i=1:length(stats)
	boxOverlay(stats(i).BoundingBox, getColor(i), 1, int2str(i), 'left');
end

Top page   Next: boxIntersect.m   Prev:toolboxInfo.m