leapmotion / leapuvc

Examples in Python, Matlab, and C for interpreting data from UVC-Enabled Leap Motion Peripherals
Other
110 stars 24 forks source link

leap_uvc python scripts return identity camera parameters #16

Open HyperLethalVector opened 4 years ago

HyperLethalVector commented 4 years ago

As issue describes, the leapuvc python scripts return identity camera paremeters,

they shouldn't be? image

JurajVincur commented 4 years ago

In order to get the calibration data on Win it is necessary to use DSHOW backend. However, it looks like using DSHOW backend currently breaks other things so after you get the calibration data create new MSMF capture in regular way. Following should work.

import cv2
import leapuvc

capResolution = (640, 480)
cam = cv2.VideoCapture(0 + cv2.CAP_DSHOW)
cam.set(cv2.CAP_PROP_FRAME_WIDTH, capResolution[0])
cam.set(cv2.CAP_PROP_FRAME_HEIGHT, capResolution[1])
calibration = leapuvc.retrieveLeapCalibration(cam, capResolution)
cam.release()

print(calibration)