Ejemplo n.º 1
0
 def test_2d_to_3d_without_target_camera(self, calibration: Calibration):
     point = 250.0, 300.0
     depth = 250.0
     point3d = -154.5365753173828, -26.12171173095703, 250.0
     converted = calibration.convert_2d_to_3d(point, depth,
                                              CalibrationType.COLOR)
     assert np.allclose(converted, point3d)
Ejemplo n.º 2
0
 def test_3d_to_2d_with_target_camera(self, calibration: Calibration):
     point3d = -122.29087829589844, -45.17741394042969, 243.19528198242188
     point = 250.0, 300.0
     converted = calibration.convert_3d_to_2d(point3d,
                                              CalibrationType.DEPTH,
                                              CalibrationType.COLOR)
     assert np.allclose(converted, point)
Ejemplo n.º 3
0
 def test_properties(calibration_raw):
     calibration = Calibration.from_raw(
         calibration_raw,
         depth_mode=DepthMode.NFOV_2X2BINNED,
         color_resolution=ColorResolution.RES_1536P)
     assert calibration.depth_mode == DepthMode.NFOV_2X2BINNED
     assert calibration.color_resolution == ColorResolution.RES_1536P
Ejemplo n.º 4
0
 def device_get_calibration(
         self, depth_mode: int,
         color_resolution: int) -> Tuple[int, Optional[object]]:
     assert self._opened is True
     calibration = Calibration.from_raw(calibration_raw,
                                        DepthMode.NFOV_UNBINNED,
                                        ColorResolution.RES_720P)
     return Result.Success.value, calibration._calibration_handle
Ejemplo n.º 5
0
def calibration(calibration_raw) -> Calibration:
    return Calibration.from_raw(calibration_raw,
                                depth_mode=DepthMode.NFOV_UNBINNED,
                                color_resolution=ColorResolution.RES_720P)
Ejemplo n.º 6
0
 def test_depth_to_color_3d(self, calibration: Calibration):
     point_color = 1000.0, 1500.0, 2000.0
     point_depth = 1031.4664306640625, 1325.8529052734375, 2117.6611328125
     converted = calibration.depth_to_color_3d(point_depth)
     assert np.allclose(converted, point_color)
Ejemplo n.º 7
0
 def test_from_raw(calibration_raw):
     calibration = Calibration.from_raw(
         calibration_raw, depth_mode=DepthMode.NFOV_UNBINNED, color_resolution=ColorResolution.OFF
     )
     assert calibration
Ejemplo n.º 8
0
 def test_from_raw_incorrect_data(calibration_raw):
     with pytest.raises(K4AException):
         Calibration.from_raw(
             "none-calibration-json-string", depth_mode=DepthMode.NFOV_UNBINNED, color_resolution=ColorResolution.OFF
         )