The code does not return the unwrapped phase. Why?
4 ビュー (過去 30 日間)
古いコメントを表示
if true
% code
phi=zeros(512,512);
I=zeros(512,512);
R=ones(512); %reference beam with all ones
for i=1:512
for k=1:512
phi(i,k)=0.0005*(((i-256)^2)+((k-256)^2));
end
end
m=1.28; % radians per pixel
Y=zeros(512,512);
for i=1:512
for k=1:512
Y(i,k)=m*k;
end
end
I=1+0.5*cos(phi +Y); %ZERO PHASE
J=1+0.5*cos(phi+ Y +(pi/2)); %PI/2 PHASE
K=1+0.5*cos(phi+ Y +(pi)); %PI PHASE
L=1+0.5*cos(phi+ Y +(3*pi/2)); %3PI/2 PHASE
P=(L-J)./(I-K); %in order to calculate the phase
ophi=atan2((P-tan(Y)),(1+P.*tan(Y))); %ophi is the calculated phase which lies between -pi/2 and pi/2
end
%in order to unwrap the phase,I use the Itoh algorithm
%by first sequentially unwrapping the all rows,one at a time.
ophi_unwrapped=zeros(512,512);
i=1;
for i=1:512
ophi_unwrapped(i,:) = unwrap(ophi(i,:));
end
%Then sequentially unwrap all the columns one at a time
i=1;
for i=1:512
ophi_unwrapped(:,i) = unwrap(ophi(:,i));
end
surf(ophi_unwrapped);
2 件のコメント
回答 (1 件)
Daniel kiracofe
2016 年 11 月 27 日
Not 100% sure I have the whole answer, but here's part of it. Look at these two lines side by side:
%by first sequentially unwrapping the all rows,one at a time.
ophi_unwrapped(i,:) = unwrap(ophi(i,:));
%Then sequentially unwrap all the columns one at a time
ophi_unwrapped(:,i) = unwrap(ophi(:,i));
The second line overwrites the results of the first line. Just blows them away. Its as if the first line had never been executed. Perhaps what you wanted was more like this:
%by first sequentially unwrapping the all rows,one at a time.
ophi_unwrapped_rows(i,:) = unwrap(ophi(i,:));
%Then sequentially unwrap all the columns one at a time
ophi_unwrapped(:,i) = unwrap( ophi_unwrapped_rows(:,i));
That gives you an intermediate variable to store the results of the row unwrapping, which you can then subsequently process for the columns.
2 件のコメント
Daniel kiracofe
2016 年 11 月 27 日
well, there I don't know if I can help you. Presumably you have an error in P or Y or some other variable. I don't know what all of the intermediate things are supposed to be. I would suggest to just plot surf(P) and surf(Y) and surf(phi), etc, etc, and check all of your variables.
参考
カテゴリ
Help Center および File Exchange で Transforms についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!