🐍 Geometric Computer Vision Library for Spatial AI
Python artificial-intelligencecomputer-visiondeep-learninghacktoberfestimage-processingmachine-learningneural-networkpythonpytorchroboticsspatial-ai
GPU support for `create_meshgrid` inside `depth_to_3d` function (#3362)
Uroš Isakovićd66cb7b87e64
diff --git a/kornia/geometry/depth.py b/kornia/geometry/depth.pyindex 1242a3d74..9650b91d6 100644--- a/kornia/geometry/depth.py+++ b/kornia/geometry/depth.py@@ -171,8 +171,9 @@ def depth_to_3d(depth: Tensor, camera_matrix: Tensor, normalize_points: bool = F# create base coordinates grid_, _, height, width = depth.shape- points_2d: Tensor = create_meshgrid(height, width, normalized_coordinates=False) # 1xHxWx2- points_2d = points_2d.to(depth.device).to(depth.dtype)+ points_2d: Tensor = create_meshgrid(+ height, width, normalized_coordinates=False, device=depth.device, dtype=depth.dtype+ ) # 1xHxWx2# depth should come in Bx1xHxWpoints_depth: Tensor = depth.permute(0, 2, 3, 1) # 1xHxWx1