filtering single pixel defects
6 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Processing Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!