How to filter objects based on size using"bwareafilt()" ?

4 ビュー (過去 30 日間)
Dnyanesh Kanade
Dnyanesh Kanade 2015 年 7 月 5 日
コメント済み: Saptadeepa Kalita 2020 年 9 月 24 日
I want to remove only lung area shown in the image using function "bwareafilt"
The following code gives me error Undefined function 'bwareafilt' for input arguments of type 'double'.
fi=fopen('JPCLN001.img','r','b');
img=fread(fi,[2048 2048],'*uint16','b');
img1=mat2gray(img, [0,4096]);
img2=imrotate(img1,-90);
img2=flip(img2,2); %Horizantal Flip
%subplot(1,2,1);
figure,imshow(img2),title('Original');
img3=imcomplement(img2);
%subplot(1,2,2);
figure,imshow(img3),title('negative');
medf=medfilt2(img3,[3 3]);
%subplot(1,2,1);
figure,imshow(medf),title('Med_filtered');
img4=imadjust(medf);
%subplot(1,2,2);
figure,imshow(img4),title('Contrast1');
img5=histeq(img4);
%subplot(1,2,1);
figure,imshow(img5),title('Hist_Equa');
%level = graythresh(img5);
B = im2bw(img5,0.45);
figure,imshow(B);
%B1=logical(B);
BW2 = bwareafilt(B,2);
figure,imshow(BW2)

回答 (3 件)

KAE
KAE 2017 年 8 月 7 日
It sounds like you do not have the Image Processing Toolbox, which includes the function bwareafilt.

Image Analyst
Image Analyst 2017 年 8 月 7 日
You have the Image Processing Toolbox (otherwise imrotate would not have worked), but you have an antique version older than R2014b which is when bwareafilt() was introduced. Upgrade to the latest version or use bwareaopen() as an alternative.
By the way, your initial segmentation is really bad.
  1 件のコメント
Saptadeepa Kalita
Saptadeepa Kalita 2020 年 9 月 24 日
I am working on RVG dental xray. My aim is to detect the type of dental caries present. The problem i m facing is with the selecting region of interest from the xray( the only tooth which is affected). I would be glad if anyone can suggest me the way.

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


Mrutyunjaya Hiremath
Mrutyunjaya Hiremath 2020 年 4 月 24 日
in your code, there is a code part as show below
img3=imcomplement(img2);
don't use that.
code works fine in 2014b.
Here, ROI part is Lung only.
  1 件のコメント
Saptadeepa Kalita
Saptadeepa Kalita 2020 年 9 月 24 日
I am working on RVG dental xray. My aim is to detect the type of dental caries present. The problem i m facing is with the selecting region of interest from the xray( the only tooth which is affected). I would be glad if anyone can suggest me the way.

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

カテゴリ

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