Assertion failed calling motionFromEssentialChooseSolution in python

asked 2020-02-17 04:20:50 -0500

updated 2020-02-17 04:31:31 -0500

berak gravatar image

Dear all,

i'm running OpenCV 4.2.0 and trying to call motionFromEssentialChooseSolution from python bindings.

I get this error:

error: OpenCV(4.2.0) /mnt/data/Software/opencv/modules/core/src/matrix_wrap.cpp:1349: error: (-215:Assertion failed) mtype == type0 || (CV_MAT_CN(mtype) == 1 && ((1 << type0) & fixedDepthMask) != 0) in function 'create'

So i guess something is wrong with my inputs.

I call

index = cv.sfm.motionFromEssentialChooseSolution(Rs, Ts, K, pts1_inliers[0], K, pts2_inliers[0])

where

Rs = []

Ts = []

Rs, Ts = cv.sfm.motionFromEssential(E, Rs, Ts)

Here Rs and Ts are float64, i also tried converting to float32 but the error is the same.

K = np.array([[f_in_pixels, 0, ppx_in_pixels], [0, f_in_pixels, ppy_in_pixels], [0, 0, 1]], np.float32)

and pts1(2)_inliers is like

array([[ 13.94107342, 1091.24169922], [ 14.09116268, 1403.55883789], [ 17.41397285, 1127.81994629], ..., [ 4866.76660156, 1855.08557129], [ 4866.76660156, 1855.08557129], [ 4872.23876953, 1580.00622559]], dtype=float32)

Any hint ? Many thanks in advance.

Best Regards, Massimiliano.

edit retag flag offensive close merge delete