Fringe spacing and frequency from image

조회 수: 5 (최근 30일)
MechenG
MechenG 2025년 4월 18일
댓글: MechenG 2025년 4월 18일
Hi,
I am trying to calculate the fringe spacing and numbers from the attached image. However, the noise that appears in the dark spot of the fringe causing the error in the frequency estimation using fft function. Could someone please help me with this.
load matlab; whos
Name Size Bytes Class Attributes ans 1x34 68 char x1 1280x720 921600 int8
imshow(x1',[])
  댓글 수: 2
Matt J
Matt J 2025년 4월 18일
편집: Matt J 2025년 4월 18일
Do the bands have a known orientation with respect to the heptagon? Can we assume they are perfectly vertical in the above image?
MechenG
MechenG 2025년 4월 18일
Hi Matt,
Yes, one can assume they are vertical. Thanks!!

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

채택된 답변

Mathieu NOE
Mathieu NOE 2025년 4월 18일
편집: Mathieu NOE 2025년 4월 18일
hello
this is maybe a bit oversimplified but I assumed that I would not make a big error by considering that the fringes are parallel to the horizontal axis
my logic is just to take the mean of the x1 array , smooth a bit the result and pick the peaks (then you get a period in pixel units => up to you to convert in the freq units)
load('matlab.mat')
x1 = double(x1);
% x1(x1>1.5) = NaN; % not really needed , just to remove some large
% amplitude isolated spots
figure,
imagesc(x1)
s1 = mean(x1,2,'omitnan');
s1 = smoothdata(s1,'gaussian',25);
figure,
plot(s1)
hold on
[PKS,LOCS] = findpeaks(s1,'MinPeakHeight',max(s1)/5);
plot(LOCS,PKS,'dr')
spatial_period_pixels = diff(LOCS)
spatial_period_pixels = 5×1
42 39 40 36 34
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
  댓글 수: 5
Mathieu NOE
Mathieu NOE 2025년 4월 18일
fyi , I tried two methods , results are very similar
load('matlab.mat')
x1 = double(x1);
% x1(x1>1.5) = NaN;
figure,
imagesc(x1)
s1 = mean(x1,2,'omitnan');
%% findpeaks period counting
s1 = smoothdata(s1,'gaussian',25);
[PKS,LOCS] = findpeaks(s1,'MinPeakHeight',max(s1)/5);
figure,
plot(s1)
hold on
plot(LOCS,PKS,'dr')
hold off
spatial_period_pixels1 = mean(diff(LOCS))
spatial_period_pixels1 = 38.2000
%% zero crossing period counting
% first some high pass filtering
[b,a] = butter(1,0.1,'high');
s1 = filtfilt(b,a,s1);
threshold = 0.1*max(s1);
x = (1:numel(s1))';
t0_pos1 = find_zc(x,s1,threshold);
spatial_period_pixels2 = mean(diff(t0_pos1))
spatial_period_pixels2 = 38.3318
figure
plot(x,s1,'b',t0_pos1,threshold*ones(size(t0_pos1)),'*r','linewidth',2,'markersize',6);grid on
legend('signal','signal positive slope crossing points');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [Zx] = find_zc(x,y,threshold)
% positive slope "zero" crossing detection, using linear interpolation
y = y - threshold;
zci = @(data) find(diff(sign(data))>0); %define function: returns indices of +ZCs
ix=zci(y); %find indices of + zero crossings of x
ZeroX = @(x0,y0,x1,y1) x0 - (y0.*(x0 - x1))./(y0 - y1); % Interpolated x value for Zero-Crossing
Zx = ZeroX(x(ix),y(ix),x(ix+1),y(ix+1));
end
MechenG
MechenG 2025년 4월 18일
Yes!!. I tried with some other better quality images, where the spacing is more uniform.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Denoising and Compression에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by