I came to know the new Orbbec cameras are factory calibrated and that there is no need to do the calibration. I want to access the camera parameters. Is it an OpenNI2 Python to access camera parameter and Point cloud data? PLEASE give a code snippet that shows how to access camera parameter and Point cloud in Python.
def main():
try:
#openni2.initialize()
dev = openni2.Device.open_any()
depth_stream = dev.create_depth_stream()
depth_stream.start()
depth_stream.set_video_mode(c_api.OniVideoMode(pixelFormat = c_api.OniPixelFormat.ONI_PIXEL_FORMAT_DEPTH_1_MM, resolutionX = width, resolutionY = height, fps = frameRate))
color_stream = dev.create_color_stream()
color_stream.set_video_mode(c_api.OniVideoMode(pixelFormat = c_api.OniPixelFormat.ONI_PIXEL_FORMAT_RGB888, resolutionX = width, resolutionY = height, fps = frameRate))
color_stream.start()
# Register both streams so they're aligned
dev.set_image_registration_mode(c_api.OniImageRegistrationMode.ONI_IMAGE_REGISTRATION_DEPTH_TO_COLOR)
while True:
depth_framedata = depth_stream.read_frame()
color_frame = color_stream.read_frame()
# Display depth and color images
depth_frame = depth_framedata.get_buffer_as_uint16()
depth_image = np.frombuffer(depth_frame, dtype=np.uint16)
depth_image.shape = (1, height, width)
depth_image_display = np.concatenate((depth_image, depth_image, depth_image), axis=0)
depth_image_display = np.swapaxes(depth_image_display, 0, 2)
depth_image_display = np.swapaxes(depth_image_display, 0, 1)
depth_image_display = depth_image_display.astype(np.uint8)
color_image = np.frombuffer(color_frame.get_buffer_as_uint8(),dtype=np.uint8)
color_image.shape = (height, width, 3)
cv2.imshow("Depth Image", depth_image_display)
color_image_BGR = cv2.cvtColor(color_image, cv2.COLOR_RGB2BGR)
cv2.imshow("Color Image", color_image_BGR)
cv2.waitKey(1)