フィルターのクリア

How to detecct specific circle and set values inside to 0

4 ビュー (過去 30 日間)
Itzhak Mamistvalov
Itzhak Mamistvalov 2021 年 5 月 11 日
コメント済み: Itzhak Mamistvalov 2021 年 5 月 11 日
Hey everyone,
I have a set of ultra-sound images. Each image have a circle which can be in different positions (this circle is actually the transducer which take those images).
I would like to remove non-zero pixels inside those circles (set the whole circle area to 0). I've tried to use imfindcircles but the radius range of the circles is dynamic.
How can I find those circles and set the whole area inside them to 0?
here are some examples to the images.

採用された回答

DGM
DGM 2021 年 5 月 11 日
編集済み: DGM 2021 年 5 月 11 日
There are probably other ways to do this, but this is what I rolled:
inpict = rgb2gray(imread('us2.bmp'));
% generate a mask
bb = inpict>5; % some threshold
bb = despeckle(bb,100); % remove small spots/holes
bb = bwpropfilt(~bb,'solidity',1); % find most solid circle
% apply the mask
inpict(bb) = 0;
If you need the mask to trim off some of the very inner content, you can dilate it after the bwpropfilt() call. This example uses despeckle() from MIMT, but you can do the same with bwareaopen()
bb = ~bwareaopen(~bwareaopen(bb,100),100);
  3 件のコメント
DGM
DGM 2021 年 5 月 11 日
As I mentioned, despeckle is part of MIMT. You'd have to download it.
Otherwise, you can use bwareaopen() as described.
Itzhak Mamistvalov
Itzhak Mamistvalov 2021 年 5 月 11 日
Thanks! works wonderful

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Segmentation and Analysis についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by