How to trace the minimum and maximum lines of the image of the moiré franges?
2 ビュー (過去 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
0 件のコメント
採用された回答
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
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.
参考
カテゴリ
Help Center および File Exchange で Image Segmentation and Analysis についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!