Poles (or residues) detection in a wrapped phase image
poles = poledetection(image[,threshold])
Ideally, phase unwrapping should not depend on the path followed to unwrapp. So we consider a small loop of 4 adjacents pixels. We decide that there's a phase jump if the difference between 2 neighbours is superior to a threshold (=0.5 by default). We count the number of jumps when we follow the loop clockwise and anticlockwise. Because of noise, we observe that these numbers are differents in certain locations of the image. The phase is called "inconsistent" in these points. Unwrapping process is very uncertain there. These poles (or residues) can be marked so that the unwrapping process ignores them, or can be used to create branches in residue-cut tree algorithms.
stacksize(4e7); pw=gray_imread(SIPDIR+'images/photonics/pyramide_noisy.jpg'); //phase wrapped xset("window",0);clf;imshow(pw); poles=abs(poledetection(pw));//locate residues, no matter of the sign xset("window",1);clf;imshow(poles,);//bright pixels // show places where phase jumps are very uncertains //Avoid unwrapping these points: mf=imvariance(pw);//calculate a "merit function" //mark bad pixels as visited (merit function=3000): //you can comment this line if you want to compare results with and without //poledetection mf(find(poles>0))=3000; //phase unwrapping: puw=unwrapp(pw,mf); xset("window",2);clf;imshow(puw,);
"Phase unwrapping algorithms for radar interferometry: residue-cut, least-squares, and synthesis algorithms" by Zebker and Lu, Journal of Optical Society Am. A, vol 15, N.3, March 1998
"Satellite radar interferometry: two-dimensional phase unwrapping" by Goldstein, Zebker, Werner in Radio Science, vol 23, number 4, pages 713-720, july-august 1988