I would like to use the OpenCV phase unwrapping functions presented here in Python, but I've been unable to find the function inside the cv2
namespace (this module). Has anyone else used this function outside of C++? I know there is an unwrap
function in Numpy, but my goal is to use the OpenCV algorithm inside our production code in C# via the OpenCVSharp Nuget package, so it would be preferable to use the same OpenCV function in Python and C# than to use the Numpy unwrap function and rewrite it in C#. Has anyone been able to successfully use the OpenCV phase unwrapping functions outside of C++?
Asked
Active
Viewed 1,176 times
1

Sam Jett
- 710
- 1
- 6
- 15
-
I ported the unwrapping code to C# and posted on Nuget for any interested parties - https://www.nuget.org/packages/UnwrapSharp – Sam Jett Jun 16 '20 at 06:15
2 Answers
1
I have used phase unwrapping module in C++. For Python, I have seen that this module is available in cv2 namespace in Ubuntu 20.04 and Fedora 31.
Which distribution are you using?

Sarthak Gupta
- 81
- 2
-
I'm using version 4.2.0 of OpenCV, installed via pip from the wheels [here](https://pypi.org/project/opencv-python/). I'm running on Windows 10 currently. – Sam Jett Mar 17 '20 at 22:11
-
I have compiled my own OpenCV 4.3 with phase unwrapping support in Python at my home. However, due to corona virus related lockdown, I do not have appropriate data to test the code. Can you provide some matrices that you wish to unwrap? I can try with those else I will get back to you as soon as lockdown lifts here. – Sarthak Gupta May 09 '20 at 11:31
-
I appreciate the help, however, I don't need to unwrap matrices, I need to have that *capability* in my software. We were able to figure out an alternative though, using the [Scikit Image phase unwrapping](https://scikit-image.org/docs/dev/auto_examples/filters/plot_phase_unwrap.html). Thanks for the help though. – Sam Jett May 26 '20 at 15:47
1
I discovered that if I pip install opencv-contrib-python
, then I have the following functions available, which were not available before I installed opencv contrib
cv2.phase_unwrapping_HistogramPhaseUnwrapping()
and
cv2.phase_unwrapping_PhaseUnwrapping()
I believe these were the ones I was looking for, so the reason I couldn't find them before is that they were/are still contrib modules. Note that I'm using version 4.2.0 of OpenCV.

Sam Jett
- 710
- 1
- 6
- 15