在使用openni2时报错
Traceback (most recent call last): File “C:/Users/asus/Desktop/相机标定/test.py”, line 142, in dev.set_depth_color_sync_enabled(True) File “C:\Users\asus\AppData\Roaming\Python\Python38\site-packages\openni\openni2.py”, line 352, in set_depth_color_sync_enabled c_api.oniDeviceEnableDepthColorSync(self._handle) File “C:\Users\asus\AppData\Roaming\Python\Python38\site-packages\openni_openni2.py”, line 2837, in wrapper raise OpenNIError(res, msg.strip(), logfile) openni.utils.OpenNIError: (OniStatus.ONI_STATUS_ERROR, ‘’, None)
原因: 在进行帧同步之前开启视频流的传输
dev.get_depth_color_sync_enabled()
dev.set_depth_color_sync_enabled(True)
dev.get_depth_color_sync_enabled()
这段代码要放在stream.start() 前面
import numpy as np
import cv2
from openni import openni2
from openni import _openni2 as c_api
openni2.initialize()
dev = openni2.Device.open_any()
dev.get_depth_color_sync_enabled()
dev.set_depth_color_sync_enabled(True)
dev.get_depth_color_sync_enabled()
depth_stream = dev.create_depth_stream()
depth_stream.start()
color_stream = dev.create_color_stream()
color_stream.start()
|