필터 지우기
필터 지우기

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

조회 수: 1 (최근 30일)
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

채택된 답변

Catalytic
Catalytic 2023년 9월 30일
편집: Catalytic 2023년 9월 30일
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

추가 답변 (1개)

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

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

Community Treasure Hunt

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

Start Hunting!

Translated by