filtering single pixel defects

조회 수: 6 (최근 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 CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by