Extrude multiple rectangles to a specific thickness

2 views (last 30 days)
Hello All
I used a code to draw rectangle around each brick in the image, as shown in the figure. Now I want to leverage from these rectangles in 3D modeling. So, I want to develope the code to convert each rectangle to object/mesh and extrude them to a specific thickness. Does anyone know how can I do that?
This is the used code:
clc; clear; close;
I = imread ('1.png');
figure, imshow(I);
IBW = imbinarize(rgb2gray(I));
%I2 = imfill(IBW, 'holes');
% figure, imshow (I2);
[L, num ] = bwlabel(IBW);
bboxes = regionprops(L, 'BoundingBox');
figure, imshow(IBW);
hold on
for k=1 : length(bboxes)
curbb = bboxes(k). BoundingBox;
x = rectangle('Position',[curbb(1),curbb(2),curbb(3),curbb(4)], 'EdgeColor','g', 'LineWidth', 1);
end
hold off

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!