Filter löschen
Filter löschen

How to trace the minimum and maximum lines of the image of the moiré franges?

1 Ansicht (letzte 30 Tage)
I have a photo of the stripes that I am posting as an example (orginal moire). How can you find the middle points of these light and dark lines by MATLAB and connect these lines with a line? I have also included an example of this image (moire with lines).
The pixel coordinates of these found lines should be stored in the matrix.
The second photo ( moire with lines) that is attached contains dark + light lines + the border between dark and light lines

Akzeptierte Antwort

Catalytic
Catalytic am 30 Sep. 2023
Bearbeitet: Catalytic am 30 Sep. 2023
Something like this might also work -
A=load('Image').Image;
T=findEdges(A,'top',10);
B=findEdges(A,'bottom',10);
C=findCenter(T,B);
imshow(A,[]);
hold on
for i=1:numel(T)
h=plot(T(i).x,T(i).y,'LineWidth',2);
plot(B(i).x,B(i).y,'LineWidth',2,'Color',h.Color);
plot(C(i).x,C(i).y,'--','LineWidth',2,'Color',h.Color);
end
hold off
function Line=findEdges(A,sense,n)
outside=imerode(~bwconvhull(A>150),strel('disk',5));
[~,S]=gradient(sgolayfilt(A,2,21,[],1));
if strcmp(sense,'bottom'), S=-S; end
B=(movmax(S,11,1)==S);
B(outside)=0;
B=imclose(B>0,strel('disk',4));
B=bwareafilt(B,n);
B=bwmorph(B,'thin');
rp=regionprops(B,'PixelList');
for i=numel(rp):-1:1
x=rp(i).PixelList(:,1);
y=rp(i).PixelList(:,2);
p=polyfit(x,y,4);
x=linspace(min(x),max(x),size(A,2));
y=polyval(p,x);
Line(i).x=x;
Line(i).y=y;
Line(i).ym=mean(y);
end
[~,reorder]=sort([Line.ym]);
Line=Line(reorder);
end
function Line=findCenter(T,B)
for i=numel(T):-1:1
Line(i).x=(T(i).x+B(i).x)/2;
Line(i).y=(T(i).y+B(i).y)/2;
Line(i).ym=[];
end
end

Weitere Antworten (1)

Image Analyst
Image Analyst am 2 Okt. 2023
To see published algorithms on the topic, see
9.5.3 Optical Interferometry, Moire Patterns
Pick a paper and code up their algorithm.
  1 Kommentar
ali alizadeh
ali alizadeh am 3 Okt. 2023
Thank you for your suggestion. There are valuable articles in this link that will definitely help me.

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

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

Start Hunting!

Translated by