unwrapl - Unwraps phased images linearly
Phased images are obtained in various interferometry domains. The phase (coded in gray levels) is represented as the altitude of each pixel. Because the phase is modulo (2*pi or 1 when working with gray levels), the absolute altitude is not known.
This function unwraps a phased image (gray levels) in the simplest manner: linearly. It works this way:
Very simple and quite fast algorithm. But very noise sensitive. Images to treat should be of excellent quality.
For those not familiar with phase unwrapping, I tried to write a very detailed example.
stacksize(1e7); // images are memory-expensive pw=gray_imread(SIPDIR+'images/photonics/pyramide_wrapped.jpg'); //phase wrapped xset("window",0); //create a 1st window to display the original image xbasc();xselect();imshow(pw); xtitle("original wrapped phase") //we try to show the object in 3D: //because of phase jumps, it's not very good xset("window",1);//the best of all: in a 3rd window, show the object in 3D xbasc();xselect(); //we take 1 point on 4 to draw the object (faster and more beautifull than //drawing all the points) plot3d1(1:4:size(pw,'r'),1:4:size(pw,'c'),pw(1:4:$,1:4:$)); xtitle("original wrapped phase in 3D") //now we unwrap the phase linearly: //In this example we don't need any additionnal parameters //because the image is of good quality. //be a little patient for this operation puw=unwrapl(pw);//phase unwrapped //and we show the result xset("window",2);//show the unwrapped phase in 2D: we have to put it in the 0-1 range //to display it properly xbasc();xselect();imshow(normal(puw)); xtitle("unwrapped phase"); xset("window",3);//we can now show the original object in 3D xbasc();xselect(); // Again, we take 1 point on 4 to draw the object plot3d1(1:4:size(puw,'r'),1:4:size(puw,'c'),puw(1:4:$,1:4:$)); xtitle("unwrapped phase in 3D");
An easy introduction to these problems can be found in "Methods for 2-D phase unwrapping in Matlab" by Jiri Novak.
A more complete one: "Phase unwrapping algorithms for radar interferometry: residue-cut, least-squares, and synthesis algorithms" by Zebker and Lu (Journal of Optical Society America, vol 15, n3, march 98)
http://siptoolbox.sourceforge.net