hi all, i'm Trying to use bwboundaries function to draw a boundary line around two object in binary image, but it applies only on the big one. how do i apply it on BOTH?

1 回表示 (過去 30 日間)
here's the code:
boundary2=bwboundaries(final);
cell_test = boundary2{1,1};
% plot and show boundary
figure(1);subplot(3,3,9), imshow(final); title('boundary2');
hold on; plot(cell_test(:,2),cell_test(:,1),'r','LineWidth',2); hold off;
as you can see, the boundary line circles only the left object, but not the right.
how do i apply this function on multpile object?
thanks all!

回答 (1 件)

Simon Chan
Simon Chan 2022 年 2 月 15 日
編集済み: Simon Chan 2022 年 2 月 15 日
Modify as follows:
boundary2=bwboundaries(final);
% plot and show boundary
figure(1);subplot(3,3,9), imshow(final); title('boundary2');
hold on;
cell_test = boundary2{1,1};
plot(cell_test(:,2),cell_test(:,1),'r','LineWidth',2);
cell_test2 = boundary2{2,1}; % Add the 2nd one
plot(cell_test2(:,2),cell_test2(:,1),'b','LineWidth',2);
hold off;

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by