Skip to content

Commit

Permalink
fix capture.transformed_depth_point_cloud (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
lpasselin authored Oct 14, 2020
1 parent 0bb3e76 commit 3d66197
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 5 additions & 3 deletions pyk4a/capture.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,16 @@ def transformed_depth(self) -> Optional[np.ndarray]:
@property
def depth_point_cloud(self) -> Optional[np.ndarray]:
if self._depth_point_cloud is None and self.depth is not None:
self._depth_point_cloud = depth_image_to_point_cloud(self._depth, self._calibration, self.thread_safe)
self._depth_point_cloud = depth_image_to_point_cloud(
self._depth, self._calibration, self.thread_safe, calibration_type_depth=True,
)
return self._depth_point_cloud

@property
def transformed_depth_point_cloud(self) -> Optional[np.ndarray]:
if self._transformed_depth_point_cloud is None and self.transformed_depth is not None:
self._depth_point_cloud = depth_image_to_point_cloud(
self.transformed_depth, self._calibration, self.thread_safe
self._transformed_depth_point_cloud = depth_image_to_point_cloud(
self.transformed_depth, self._calibration, self.thread_safe, calibration_type_depth=False,
)
return self._transformed_depth_point_cloud

Expand Down
6 changes: 4 additions & 2 deletions pyk4a/transformation.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ def depth_image_to_color_camera(depth: np.ndarray, calibration: Calibration, thr
)


def depth_image_to_point_cloud(depth: np.ndarray, calibration: Calibration, thread_safe: bool) -> Optional[np.ndarray]:
def depth_image_to_point_cloud(
depth: np.ndarray, calibration: Calibration, thread_safe: bool, calibration_type_depth=True
) -> Optional[np.ndarray]:
"""
Transform depth color_image to point cloud
Return empty result if transformation failed
"""
return k4a_module.transformation_depth_image_to_point_cloud(
calibration.transformation_handle, thread_safe, depth, True
calibration.transformation_handle, thread_safe, depth, calibration_type_depth,
)


Expand Down

0 comments on commit 3d66197

Please sign in to comment.