www.gusucode.com > vision 源码程序 matlab案例代码 > vision/ComputeTheOverlapRatioBetweenTwoBoundingBoxesExample.m
%% Compute the Overlap Ratio Between Two Bounding Boxes % Define two bounding boxes in the format [x y width height]. % Copyright 2015 The MathWorks, Inc. bboxA = [150,80,100,100]; bboxB = bboxA + 50; %% % Display the bounding boxes on an image. I = imread('peppers.png'); RGB = insertShape(I,'FilledRectangle',bboxA,'Color','green'); RGB = insertShape(RGB,'FilledRectangle',bboxB,'Color','yellow'); imshow(RGB) %% % Compute the overlap ratio between the two bounding boxes. overlapRatio = bboxOverlapRatio(bboxA,bboxB)