unwrapPhaseMap() does not take ndarray in Python

asked 2020-09-29 02:47:58 -0600

yaor42 gravatar image

Hi there,

I'm doing some structured light and fringe analysis work and am trying to use the phase unwrapping function cv.phase_unwrapping_PhaseUnwrapping.unwrapPhaseMap in OpenCV (4.4.0) with Python (doc here)

unwrapPhaseMap() virtual void cv::phase_unwrapping::PhaseUnwrapping::unwrapPhaseMap ( InputArray wrappedPhaseMap, OutputArray unwrappedPhaseMap, InputArray shadowMask = noArray() ) pure virtual Python: unwrappedPhaseMap = cv.phase_unwrapping_PhaseUnwrapping.unwrapPhaseMap( wrappedPhaseMap[, unwrappedPhaseMap[, shadowMask]] )

However, when I tried to call the function in Python, the TypeError occured:

Exception has occurred: TypeError descriptor 'unwrapPhaseMap' for 'cv2.phase_unwrapping_PhaseUnwrapping' objects doesn't apply to a 'numpy.ndarray' object

Looks like the function doesn't take ndarray as an input. I'm assuming it takes cv::Mat. But after some version (3.0?), OpenCV removed the cv2.cv and the related fromarray() function that converts the ndarray to cv::Mat. It seems there is no way to use cv::Mat in the current version of OpenCV in Python. Anyone knows how to use the unwrapPhaseMap() function with Python and is this possibly a legacy issue?

Many thanks!

edit retag flag offensive close merge delete

Comments

can you show the resp. python snippet, please ?

(tests & python wrappers use cv::Mat here)

berak gravatar imageberak ( 2020-09-29 04:03:47 -0600 )edit