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!