crop a binary mask without other regions

1 回表示 (過去 30 日間)
Elysi Cochin
Elysi Cochin 2017 年 1 月 18 日
コメント済み: Elysi Cochin 2017 年 1 月 19 日
I have an image shown in image 1, in which i get two objects bw1 and bw2. But, when i crop the bounding box region of object1 (bw1), i get the left side region of bw2 also, and when i crop bw2 i get the right side of bw1... how can i get the two objects cropped separately from the original image, without the other region coming in the cropped image...

採用された回答

Ahmet Cecen
Ahmet Cecen 2017 年 1 月 18 日
If your images always contain 2 clearly separated entities, use `bwconncomp` or `bwlabel`. Many ways to do this.
For example:
L = bwlabel(BW)
BW1 = L == 1 % First Object
BW2 = L == 2 % Second Object
Now you can crop BW1 and BW2 like you cropped your previous image, but you won't have the second object anymore.
  1 件のコメント
Elysi Cochin
Elysi Cochin 2017 年 1 月 19 日
thank you sir...

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by