Looking for the ways to categorize the black dots by the number of pixels...
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Dongwon Kim
am 31 Jul. 2019
Kommentiert: Dongwon Kim
am 31 Jul. 2019
Hello, I have another question from the image processing. This is the X-ray Diffraction image of metal sample and black dots are pores.
Yesterday, I successfully found the ratio of black and white pixel area in the circular area.
[rows colm]=size(BW);
white_pixels=sum(BW(:));
black_pixels=~BW;
black_pixels=sum(black_pixels(:));
result=bwareafilt(~BW,1,'Largest');
outer_black=sum(result(:));
% Area with respect to circle only
black_pixels_area=(black_pixels-outer_black)/((rows*colm)-outer_black);
fprintf('The Percentage of black pixels covered area is %.2f ',black_pixels_area);
fprintf('\n The ratio black/white is %.2f',black_pixels/white_pixels);
Now my senior wants me to find out the ways to categorize the pores by the number of dots in the picture. For example,
-number of pores with only one pixel = n1
-number of pores with two pixels = n2
-number of pores with three pixels = n3
and so on...
I guess I have to find out the ways to calculate the number of pixels for each pores, there are many qna about the total number of pixels in the area but could hardly find the ways to calculate the pixel number for each feature...
I would really appreciate your assistance.
0 Kommentare
Akzeptierte Antwort
Akira Agata
am 31 Jul. 2019
% Read image and binarize
I = imread('1bij.jpeg');
Igray = rgb2gray(I);
BW = imbinarize(Igray);
% Apply regionprops function
s = regionprops('table',~BW);
% Count number of pores (for size <= 10 pixel)
idx = s.Area <= 10;
figure
histogram(s.Area(idx))
xlabel('# of pixels per pore','FontSize',14)
ylabel('Number of pore','FontSize',14)
Weitere Antworten (0)
Siehe auch
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!