Detect the vertical dark layers in greysacale image

조회 수: 2 (최근 30일)
Aon
Aon 2020년 1월 25일
댓글: Aon 2020년 2월 4일
Hi!
I have a grayscale image with dark vertical layers. I want to know the average pixel-width of the dark layers in the following image:
årsringsbild2.PNG
What I found problematic is that the image also contains noise which can be seen when I use the canny edge detection:
årsringsbildCanny.PNG
Any sugestions which method can be used in this case?
Thanks in advance

답변 (1개)

Akira Agata
Akira Agata 2020년 1월 25일
By applying findpeaks function (with appropriate option settings) to the average intensity profile, you can detect locations of dark bands.
I'm not sure what is the definition of the "average pixel-width" of dark band, but I believe one possible (and simple) solution would be detectiong width at the half-prominence point for each nitch in the the average intensity profile.
% Read the image
I = imread('arsringsbild2.png');
I = rgb2gray(I);
% Calculate average intensity and dark positions
avgIntensity = mean(double(I));
[val,pos] = findpeaks(-1*avgIntensity,...
'MinPeakProminence', 40,...
'MinPeakHeight', -100);
val = -1*val;
% Visualize the result
figure
subplot('Position',[0.1 0.8 0.8 0.15])
imshow(I)
subplot('Position',[0.1 0.1 0.8 0.7])
plot(avgIntensity)
hold on
scatter(pos,val,'^','filled')
legend({'Avg. Intensity','Detected dark position'},'FontSize',12)
xlim([1 size(I,2)])
ylabel('Average intensity for each horizontal position')
dark.png
  댓글 수: 1
Aon
Aon 2020년 2월 4일
Thank you for a great answer!
Do you know a way to also measure the pixel-width of the light bands?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Feature Detection and Extraction에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by