图像配准不适用于Primesense

时间:2018-09-11 13:00:58

标签: python primesense

我有1.09的原味胭脂红。我正在使用openni2。我正在尝试在深度图像上应用图像配准。

 def Depth(self):
    self.depth_stream = self.dev.create_depth_stream()
    self.dev.set_image_registration_mode(openni2.c_api.OniImageRegistrationMode.ONI_IMAGE_REGISTRATION_DEPTH_TO_COLOR)
    self.depth_stream.set_video_mode(
        c_api.OniVideoMode(pixelFormat=c_api.OniPixelFormat.ONI_PIXEL_FORMAT_DEPTH_1_MM, resolutionX=640, resolutionY=480,
                           fps=30))
    self.depth_stream.start()
    self.depthFrame = self.depth_stream.read_frame()
    self.depthData = self.depthFrame.get_buffer_as_uint16()
    self.imgDepth = np.frombuffer(self.depthData, dtype=np.uint16)
    self.depthMat = np.reshape(self.imgDepth, (480, 640))
    np.save("Regi_cam2_depth", self.depthMat)
    self.depth_stream.stop()


def Rgb(self):
    self.color_stream = self.dev.create_color_stream()
    self.color_stream.set_video_mode(
        c_api.OniVideoMode(pixelFormat=c_api.OniPixelFormat.ONI_PIXEL_FORMAT_RGB888, resolutionX=640, resolutionY=480,
                           fps=30))
    self.color_stream.start()
    self.rgbFrame = self.color_stream.read_frame()
    self.rgbData = self.rgbFrame.get_buffer_as_uint8()
    self.imgRgb = np.frombuffer(self.rgbData, dtype=np.uint8)
    self.rgbMat = np.reshape(self.imgRgb, (480, 640, 3))
    np.save("Regi_cam2_rgb_col", self.rgbMat)
    self.rgbFrame = self.rgbMat.copy()
    self.color_stream.stop()

当我应用上述代码时,带有配准图像和不配准图像的深度值(当我注释self.dev.set_image_registration_mode(openni2.c_api.OniImageRegistrationMode.ONI_IMAGE_REGISTRATION_DEPTH_TO_COLOR)时 )不一样。深度值按比例缩小。 有什么问题吗?

谢谢。

0 个答案:

没有答案