How to group rectangles on an image regarding certain distances (width and height)
1 view (last 30 days)
Show older comments
Hello,
I have a binary image on wich I detect rectangles that have the sieze of 164*20 pix each one and should be full of '1' (no black pixel inside).
I have the cordinates (x,y) of the top left corner of each rectangle.
I want to group my rectangles so that the distance on the width should be less than 82px and on the heigh should be less than 10px.
Please find example below:
Here my full image with all the detected rectangles:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1089130/image.png)
Here a part of my image:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1089135/image.png)
Here what I expected (in blue) when groupin the rectangles in this part
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1089140/image.png)
Remark:
When grouping, there is no problem if some black pixels are taken.
Regards,
Mehdi
0 Comments
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!