filtering single pixel defects

3 ビュー (過去 30 日間)
Sasan Shadpour
Sasan Shadpour 2021 年 2 月 18 日
編集済み: Sasan Shadpour 2021 年 2 月 19 日
Hello
I am trying to sort different bins of defect after thresholding. What I want to is to get rid of single pixel defects and count the others. What I have is:
%% image= after thresholding
CC = bwconncomp(ima2, 8);
numPixels = cellfun(@numel,CC.PixelIdxList);
which here by ploting "numPixels", I can tell I have different bins and mostly single pixels. By a simple loop I can change single pixel in "numPixels" to zero. However, I want to map the defect on the image by this:
Stats_1 = regionprops(CC,'Centroid');
centroids = cat(1,Stats_1.Centroid);
imshow(image);
hold on;
plot(centroids(:,1),centroids(:,2),'bo');
hold off
Here, I used "CC" to extract the location of the defects which has a single defects included.
I was trying to use "strel(nhood)" to define single pixel with others after thresholding. But, I was not able to do it correctly. Any help would be apprecited or any other approches to do this sorting.
Thanks in advance.

回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by