Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to use opencv-contrib-python fourierDescriptor()

The question: For a python3 script I'd like some sequence of fourier descriptors from input values (please), hopefully from a rank 2 numpy array. It's unclear how to use this function, I can't find documentation on its intended use.

The 'however' fourierDescriptor() throws {error}/io/opencv_contrib/modules/ximgproc/src/fourier_descriptors.cpp:214: error: (-215) _src.empty() || (_src.channels() == 2 && (_src.depth() == 4 || _src.depth() == 5 || _src.depth() == 6)) in function fourierDescriptor

Steps to reproduce

On ubuntu 16.04: pip3 install opencv-contrib-python opencv-contrib-python in ./venv/lib/python3.5/site-packages (3.4.0.12)

from cv2.ximgproc import fourierDescriptor

Feeding some dummy values:

fourierDescriptor([12, 11])
{TypeError}src is not a numpy array, neither a scalar

Fair enough...

Feeding a scalar:

fourierDescriptor(12)
{error}/io/opencv_contrib/modules/ximgproc/src/fourier_descriptors.cpp:214: error: (-215) _src.empty() || (_src.channels() == 2 && (_src.depth() == 4 || _src.depth() == 5 || _src.depth() == 6)) in function fourierDescriptor

Feeding a rank 1 numpy array:

fourierDescriptor(np.array([12]))
{error}/io/opencv_contrib/modules/ximgproc/src/fourier_descriptors.cpp:214: error: (-215) _src.empty() || (_src.channels() == 2 && (_src.depth() == 4 || _src.depth() == 5 || _src.depth() == 6)) in function fourierDescriptor

Feeding a rank 2 numpy array:

fourierDescriptor(np.array([[12, 11], [10, 9]]))
{error}/io/opencv_contrib/modules/ximgproc/src/fourier_descriptors.cpp:214: error: (-215) _src.empty() || (_src.channels() == 2 && (_src.depth() == 4 || _src.depth() == 5 || _src.depth() == 6)) in function fourierDescriptor

Many thanks for any pointers, help greatly appreciated!