Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

cv2.projectPoints, error: (-215) npoints >= 0 && (depth == CV_32F || depth == CV_64F) in function projectPoints

Hi all

        I am trying to execute following piece of code.

def projectImgPlane(target, player, direction): target = np.float32(target) player = np.float32(player) calibMat = np.array([[ 1.20068095e+03, 0.00000000e+00, 8.13634941e+02], [ 0.00000000e+00, 6.76829040e+02, 2.64292817e+02], [ 0.00000000e+00, 0.00000000e+00, 1.00000000e+00]]) distortion = np.float32([ 0.12168904, 1.70231151, 0.04272291, 0.08605422, -3.63581666]) tvec = target - player rvec = np.float32(direction) print ('target:',target,'rvec:',rvec,'tvec:',tvec,'calibmat:',calibMat,'distortion:',distortion) print(type(target)) print(type(rvec)) print(type(tvec)) print(type(calibMat)) print(type(distortion))

imgCoords = cv2.projectPoints(target, rvec, tvec, calibMat, distortion)
return imgCoords

Following are the values of all variables in this code and types of variables:

target: [ 62.52583313 -59.98480225 -13.10193443] rvec: [ 0.14032656 0.99005985 -0.00950932] tvec: [-206.53077698 490.99945068 -55.8660965 ] calibmat: [[ 1.20068095e+03 0.00000000e+00 8.13634941e+02] [ 0.00000000e+00 6.76829040e+02 2.64292817e+02] [ 0.00000000e+00 0.00000000e+00 1.00000000e+00]]

distortion: [ 0.12168904 1.70231152 0.04272291 0.08605422 -3.63581657]

<class 'numpy.ndarray'=""> <class 'numpy.ndarray'=""> <class 'numpy.ndarray'=""> <class 'numpy.ndarray'=""> <class 'numpy.ndarray'="">

Following is the error message: imgCoords = cv2.projectPoints(target, rvec, tvec, calibMat, distortion) cv2.error: /io/opencv/modules/calib3d/src/calibration.cpp:3267: error: (-215) npoints >= 0 && (depth == CV_32F || depth == CV_64F) in function projectPoints

Can you please tell me what I am doing wrong in my code. Is there any argument or variable use is wrong. I tried to investigate most of the possibilities but failed to comprehend the error. Thank you in advance.

Regards SD

cv2.projectPoints, error: (-215) npoints >= 0 && (depth == CV_32F || depth == CV_64F) in function projectPoints

Hi all

        I am trying to execute following piece of code.

def projectImgPlane(target, player, direction): target = np.float32(target) player = np.float32(player) calibMat = np.array([[ 1.20068095e+03, 0.00000000e+00, 8.13634941e+02], [ 0.00000000e+00, 6.76829040e+02, 2.64292817e+02], [ 0.00000000e+00, 0.00000000e+00, 1.00000000e+00]]) distortion = np.float32([ 0.12168904, 1.70231151, 0.04272291, 0.08605422, -3.63581666]) tvec = target - player rvec = np.float32(direction) print ('target:',target,'rvec:',rvec,'tvec:',tvec,'calibmat:',calibMat,'distortion:',distortion) print(type(target)) print(type(rvec)) print(type(tvec)) print(type(calibMat)) print(type(distortion))

print(type(distortion))
imgCoords = cv2.projectPoints(target, rvec, tvec, calibMat, distortion)
return imgCoords

Following are the values of all variables in this code and types of variables:

target: [ 62.52583313 -59.98480225 -13.10193443] rvec: [ 0.14032656 0.99005985 -0.00950932] tvec: [-206.53077698 490.99945068 -55.8660965 ] calibmat: [[ 1.20068095e+03 0.00000000e+00 8.13634941e+02] [ 0.00000000e+00 6.76829040e+02 2.64292817e+02] [ 0.00000000e+00 0.00000000e+00 1.00000000e+00]]

1.00000000e+00]] distortion: [ 0.12168904 1.70231152 0.04272291 0.08605422 -3.63581657]

<class 'numpy.ndarray'=""> <class 'numpy.ndarray'=""> <class 'numpy.ndarray'=""> <class 'numpy.ndarray'=""> <class 'numpy.ndarray'="">

Following is the error message: message:

imgCoords = cv2.projectPoints(target, rvec, tvec, calibMat, distortion) cv2.error: /io/opencv/modules/calib3d/src/calibration.cpp:3267: error: (-215) npoints >= 0 && (depth == CV_32F || depth == CV_64F) in function projectPoints

Can you please tell me what I am doing wrong in my code. Is there any argument or variable use is wrong. I tried to investigate most of the possibilities but failed to comprehend the error. Thank you in advance.

Regards SD