Ask Your Question
0

ValueError: too many values to unpack

asked 2017-06-22 09:06:17 -0600

hommsy gravatar image

working with opencv-python for a tracking project. i get this error when calling the estiamte single marker

Traceback (most recent call last):
File "test_aruco_detect.py", line 53, in <module>
rvecs , tvecs = aruco.estimatePoseSingleMarkers(corners, 0.1765, cameraMatrix, distCoeffs)
ValueError: too many values to unpack

the code:

import numpy as np
import cv2
import cv2.aruco as aruco

with np.load('/home/odroid/camera_calibration/testfile.npz') as X:
    cameraMatrix,distCoeffs = [X[i] for i in ('arr_0','arr_1')]


cap = cv2.VideoCapture(0)

while(True):
    # Capture frame-by-frame
    ret, frame = cap.read()
   #print(frame.shape) #480x640
    # Our operations on the frame come here
    gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
    aruco_dict = aruco.Dictionary_get(aruco.DICT_6X6_250)
    parameters =  aruco.DetectorParameters_create()


    #lists of ids and the corners beloning to each id
corners, ids, rejectedImgPoints = aruco.detectMarkers(gray, aruco_dict, parameters=parameters)


if ids != None: #if atleast one id is detected
    gray = aruco.drawDetectedMarkers(gray, corners,ids)
    rvecs , tvecs = aruco.estimatePoseSingleMarkers(corners, 0.1765, cameraMatrix, distCoeffs)
    aruco.drawAxis(gray, cameraMatrix, distCoeffs, rvecs, tvecs)


    cv2.imshow('frame',gray)
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break


cap.release()
cv2.destroyAllWindows()
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2017-06-22 09:12:00 -0600

berak gravatar image

updated 2017-06-22 09:12:19 -0600

looking here , it might be:

  rvecs , tvecs, _objPoints = aruco.estimatePoseSingleMarkers(...)
edit flag offensive delete link more

Comments

yes! that solved it! thanks

hommsy gravatar imagehommsy ( 2017-06-22 10:02:55 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2017-06-22 09:06:17 -0600

Seen: 1,755 times

Last updated: Jun 22 '17