transform mask from circle to ring

5 ビュー (過去 30 日間)
abdelillah douhi
abdelillah douhi 2021 年 8 月 14 日
コメント済み: abdelillah douhi 2021 年 8 月 16 日
hello all,
i have a number of ROIs made with roipoly and i want to transform them to a ROI ring shape when i can set the thickness of the ring manually, the i dea is to keep the original ROI make a small dupliicate and place it inside and get the ring shape, if someone can help with that or have a better way to do it. image modified to clarify the final ROIs wanted.
regards

採用された回答

Image Analyst
Image Analyst 2021 年 8 月 14 日
Once you have the first mask, you can erode it by some then erase that from the original:
radius = 2; % Thickness of ring.
se = strel('disk', radius, 0);
smallerMask = imerode(mask, se);
% Erase it from original.
mask = mask & ~smallerMask;
% Or alternative way to do it that gives the same result:
% mask(smallerMask) = false;
If the thickness is known to be just one pixel, then you can use bwperim()
ringMask = bwperim(mask);
  1 件のコメント
abdelillah douhi
abdelillah douhi 2021 年 8 月 16 日
thank you very much @Image Analyst works like a charm

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

その他の回答 (0 件)

製品


リリース

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by