find overlapping rectangles algorithm in matlab
显示 更早的评论

Hi
Is there an algorithm which can help in finding overlapping rectangles.
I use connected components for segmentation and hecne get a number of overlapping and independent rectangles. My aim is to remove the overlapping rectangles by checking the coordinates . If my current rectangle falls within the coordinate of outer rectangle then it will consider the outer rectangle and if my rectangle is bigger then it is considered.
i want to retain all bigger rectangles around a word and eliminate smaller rectangles.
is there a code for finding overlapping rectangles?
groupRect = [lv tv new_width new_height];
groupRects(groupRectsCt,:)=groupRect;
groupRectsCt=groupRectsCt+1;
end
id = id+1;
end
% display the segmented image
figure, imshow(SearchedImg);
for i=1:groupRectsCt-1
rectangle('Position', groupRects(i,:), 'EdgeColor', 'r');
end
%%%find and remove overlaping regions
for i=1:groupRectsCt-1
if(currentRect(1,1)>=cRect(1,1) & currentRect(1,1)+currentRect(1,3)<=cRect(1,1)+cRect(1,3))
flag =1; break;
end
if(currentRect(1,1)<=cRect(1,1) & currentRect(1,1)+currentRect(1,3)>=cRect(1,1)+cRect(1,3))
candiRect(j,:) = currentRect; flag =1; break;
end
if(flag) continue; end
candiRect(candiCt,:) = currentRect;
end
4 个评论
Image Analyst
2015-7-13
My advice is to attach an image or diagram so we can visualize what you're talking about.
A binary or labeled image cannot have overlapping regions. If regions in a binary image overlap, then they are considered the same region, not different ones. If regions in a labeled image overlap, then the "top" one overlaps/covers the "underneath" one and so not all of the underneath one will be used in measurements. So I really don't know what you're talking about without a diagram or image to help explain it.
Image Analyst
2015-7-13
Why do you need to find them? Something (I don't know what) created the rectangles, so you just need to go back to the function that made them in the first place to "find" them.
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Image Segmentation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!