LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to unwrap a 2D phase map?

Solved!
Go to solution

Hello,

 

I am currently working on project that involves phase mapping. I have successfully created a Phase Map from four different images, however, I am having difficulty in unwrapping this phase map. The phase map is a 2D array of double [64 bit real (~15 bit precision)], with values ranging from 0 to pi. I have tried using the PhaseUnwrap.VI many times, but it doesn't seem to be working correctly. I would appreciate any input/help on solving this uwrapping issue.

Thanks,

 

Kate

 

 

0 Kudos
Message 1 of 10
(7,841 Views)

Hello Kate!

 

Here's a link on our forums to a similar post, maybe this can help you:

 

http://forums.ni.com/t5/LabVIEW/2d-unwrap/td-p/1613902

 

Typically 2D Phase Maps are unwrapped in one direction, then in the other successively--not in one step.  So you would need to call that vi for each direction.  

 

 

Mason M
Applications Engineer
National Instruments
0 Kudos
Message 2 of 10
(7,800 Views)

kloram333 wrote:

I have tried using the PhaseUnwrap.VI many times, but it doesn't seem to be working correctly. I would appreciate any input/help on solving this uwrapping issue.


Can you attach a typical data file?

Unless you show us what you tried, we cannot tell if you are doing something wrong. The term "doesn't work correctly" is too generic to be useful and could mean anything from broken wire, to wrong result, to no result. 😄 Programs are typically reproducible, so if it fails once, it will fail every time. Did you change the code every time of the "many times"? If so, what did you change?

0 Kudos
Message 3 of 10
(7,798 Views)
Solution
Accepted by topic author kloram333

Thanks for the input everyone, I actually solved the problem this morning. The issue turned out to be that I needed to use Arctan2 instead of just arctan on the array before sending it to the unwrapping stage. To sucessfully unwrap my 2D array I first unwrap a single collumn, then unwrap all the rows, unwrap all of the collumns, and then transpose the 2D array. I've been having difficulty attaching my VI to these posts, but if I'll try to attach it so that others may see my solution if needed.

0 Kudos
Message 4 of 10
(7,772 Views)

@kloram333 wrote:

To sucessfully unwrap my 2D array I first unwrap a single collumn, then unwrap all the rows, unwrap all of the collumns, and then transpose the 2D array.


This description is a bit ambiguous. Do you first pick a single column at random or a specific one? What's the point of the transposition at the end?

 

Yes, please feel free to attach your code. What kind of difficulties are you having with attaching?

0 Kudos
Message 5 of 10
(7,766 Views)

When I try to attach my VI, I get the error "file contents don't match file type".

 

I unwrapped the first collumn in the array (collumn index = 0) by indexing the array. Then I used the Unwrap Phase VI to unwrap the column. Next I replaced the first coloumn in the original array with the new unwrapped column (using the replace array subset VI). I used that array in a for loop and the index array VI. I unwrapped each row. I then used the out put array from the prior step (with colloumn 1 and all rows unwrapped) in same process to unwrap each collumn after that. When unwrapping each collumn, as the for loop is indexing values into the output array, it sends the colloumns as rows so the output array is transposed (i.e. an array of 70x30 instead of its original size of 30x70). To correct this I used the transpose 2D array VI. Hope thats a little more descriptive

0 Kudos
Message 6 of 10
(7,760 Views)

@kloram333 wrote:

When I try to attach my VI, I get the error "file contents don't match file type".


OK, it seems there is a problem with a new forum security feature. See also this thread. Could you tell us in that other discussion your LabVIEW version and OS, and the browser you are using? Thanks!

0 Kudos
Message 7 of 10
(7,754 Views)

kloram333 wrote:

I unwrapped the first collumn in the array (collumn index = 0) by indexing the array. Then I used the Unwrap Phase VI to unwrap the column. Next I replaced the first coloumn in the original array with the new unwrapped column (using the replace array subset VI). I used that array in a for loop and the index array VI. I unwrapped each row. I then used the out put array from the prior step (with colloumn 1 and all rows unwrapped) in same process to unwrap each collumn after that. When unwrapping each collumn, as the for loop is indexing values into the output array, it sends the colloumns as rows so the output array is transposed (i.e. an array of 70x30 instead of its original size of 30x70). To correct this I used the transpose 2D array VI. Hope thats a little more descriptive


OK. I still think you are doing too much. Can you attach a typical dataset?

 

Here's what I would do. If the data s relatively well behaved, unwrapping in a single dimension might be sufficient.

 

 

 

0 Kudos
Message 8 of 10
(7,744 Views)

I just came upon this thread. I wanted to add that there is a book "Two-Dimensional Phase Unwrapping: Theory, Algorithms and Software" which is the bible on this subject. I implemented the Goldstein algorithm in native LV and optimized it to the point where it runs almost as fast as the C code. In the attached zip there is a vi called PhaseGenerator to test it out. Goldstein's algorithm still gives a reasonable solution when there are some residuals in the image, unlike Itoh's algorithm which is the basic unwrap a column, unrwap all the rows discussed above. You can test this by changing the value of b which changes the amount of noise in the image. There are eight other algorithms in the book, with C code you can turn into a .dll, but I'm not going to post it due to potential copyright issues. If you buy the book, I could help you with the other algorithms, but in general this is the fastest and most useful.

Message 9 of 10
(7,549 Views)

Hi,

   Could you please upload the VI for your 2D unwrapping phase or even screen shots are also helpful. 

0 Kudos
Message 10 of 10
(6,233 Views)