You're not passing in a bounding box. boxes(idx,:) is a bounding box for idx = 1, 5, 9, etc. (every 4) but not for 2,3,4,6,7,8, etc. Just look at what boxes is. It's [x1,y1,w1,h1,x2,y2,w2,h2,x3,y3,w3,h3,.....] So when idx = 3, say, boxes(idx,:) = w1. Since boxes is a 1-D array, the ,: does nothing - it's just looking at the idx value. You'd have to skip by 4 and take just 3 of them:
for idx = 1 : 4 : m
thisBoundingBox = boxes(idx:idx+3);
if (bboxOverlapRatio(thisBoundingBox, bbox) > 0)
or better yet , don't concatenate the boxes and loop over them at all , but just loop over the regions:
for r = 1 : length(lframelabel)
thisBoundingBox = lframelabel(r).BoundingBox;
if (bboxOverlapRatio(thisBoundingBox, bbox) > 0)
Best Answer