1 | initial version |
ok, that's a bit tricky ;)
fourierDescriptor() expects a list of points, that would be a rank 1, 2 channel array.
if you started like this:
a = np.array([[12, 11], [10, 9]])
you'll have to reshape it:
b = a.reshape(3,1,2)
also, it needs float or double type, not int currently (that's a bug), so, another conversion:
c = np.asarray(b, np.float32)
now you can calculate proper fourierDescriptors:
cv2.ximgproc.fourierDescriptor(c)
array([[[11., 10.]],
[[ 1., 1.]]], dtype=float32)
2 | No.2 Revision |
ok, that's a bit tricky ;)
fourierDescriptor() expects a list of points, that would be a rank 1, 2 channel array.
if you started like this:
a = np.array([[12, 11], [10, 9]])
you'll have to reshape it:
b = a.reshape(3,1,2)
a.reshape(2,1,2)
also, it needs float or double type, not int currently (that's a bug), so, another conversion:
c = np.asarray(b, np.float32)
now you can calculate proper fourierDescriptors:
cv2.ximgproc.fourierDescriptor(c)
array([[[11., 10.]],
[[ 1., 1.]]], dtype=float32)