How can I accurately get the fringes of this profile.
조회 수: 8 (최근 30일)
이전 댓글 표시
I have the following profile and I want to get the fringes (peaks along the fringes) that are shown.

What I want is accurately get the sape of this fringes I did edge detection but I don't think it's rigorous for this type of calculations. I have attached the .mat file if you want to look. All I want to is accuratly follow the local maxima of these fringes as shown in the figure below:

Did someone encounter similar problem. Thank you very much for the help.
댓글 수: 2
Walter Roberson
2025년 2월 17일
I wonder if it would work to do a findpeaks() across each row of the image, and trace the evolution?
It might help to start from the middle row and track down until each peak disappears, and then go up and track upwards until each peak disappears.
채택된 답변
Mathieu NOE
2025년 2월 17일
hello
this is a very simple (simplistic ?) approach
I used peakseek for faster execution vs findpeaks but you can use your own prefered tool for this job
of course I suspect you would have prefered a solution where each line data is stored in a specific cell array
here it's just the whole points , not yet organized.

load('fringes.mat')
T = abs(P_resize);
figure,imagesc(T)
colorbar
hold on
minpeakdist = 3;
minpeakh = 3e-5;
for k = 20:size(T,1)
tex = T(k,:);
[locs{k}, pks{k}]=peakseek(tex,minpeakdist,minpeakh);
plot(locs{k},k*ones(size(locs{k})),'r*','markersize',2);
end
댓글 수: 6
Mathieu NOE
2025년 2월 18일
forgot to say : you will need the below and attached functions for the baseline correction
here I had to make a tiny modification in baseline to avoid sometimes an error :
% if A(i-1)<A(i-2) && A(i-1)<A(i) % original code
if (A(i-1)<A(i-2) && A(i-1)<A(i)) || n>=l % mod MN : added condition (n>=l) to avoid error
function [Base, Corrected_Spectrum]=baseline(Spectrum)
%Input
%-------
%Spectrum: vector of size (N*1)
%Output
%-------
%Base: Identified Baseline vector of size (N*1)
%Corrected_Spectrum: Corrected Spectrum vector of size (N*1)
l=length(Spectrum);
lp=ceil(0.5*l);
initial_Spectrum=[ones(lp,1)*Spectrum(1) ; Spectrum ; ones(lp,1)*Spectrum(l)];
l2=length(initial_Spectrum);
S=initial_Spectrum;
n=1;
flag1=0;
while flag1==0
n=n+2;
i=(n-1)/2;
[Baseline, stripping]=peak_stripping(S,n);
A(i)=trapz(S-Baseline);
Stripped_Spectrum{i}=Baseline;
S=Baseline;
if i>3
% if A(i-1)<A(i-2) && A(i-1)<A(i) % original code
if (A(i-1)<A(i-2) && A(i-1)<A(i)) || n>=l % mod MN : added condition (n>=l) to avoid error
i_min=i-1;
flag1=1;
end
end
end
Base=Stripped_Spectrum{i_min};
Corrected_Spectrum=initial_Spectrum-Base; Corrected_Spectrum=Corrected_Spectrum(lp+1:lp+l);
Base=Base(lp+1:lp+l);
end
Mathieu NOE
2025년 2월 18일
I don't have the Stats Toolbox, but if you have , you could try with Spectral Clustering
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!