isl-org / isl-org/Open3D

Point cloud construction

Open
#3,448 0 comments 0 reactions 1 assignee Claimed by @reyanshsolis View on GitHub
feature request reconstruction
Dominant language
C++
Stars
14k
Forks
2.6k
Avg merge
5d 18h
Merged PRs (30d)
6

Description

Hey there,

My goal is to create separate point clouds out of pedestrians' masks, an image, and a depth. Before I've been masking both images and depth based on each mask, creating rgbd from them, and creating a point cloud in the end. But this is too expensive in terms of time.

This is an example of a point cloud I get with the abovementioned approach:

![Screenshot from 2021-05-15 21-48-32](https://user-images.githubusercontent.com/12258972/118376325-a669c100-b5c7-11eb-843e-7916ccce9728.png)

I've tried to write the projection myself using the exact formulas that were described in the docstring, but my point cloud is tilted i.e. every straight line is not really straight anymore. Is there something special when creating a point cloud from rgb in open3d that I'm missing?

```
def create_cloud(image, depth, intrinsics):
"""Creates a point cloud from the whole image and depth map
Args:
image (ndarray): color image
depth (ndarray): depth map
intrinsics (ndarray): intrinsic parameters
Returns:
pt_clouds (PointCloud): resulting point clouds
"""
fx, fy = intrinsics[0][0], intrinsics[1][1]
cx, cy = intrinsics[0][2], intrinsics[1][2]
image = (image - image.min()) / (image.max() - image.min())
u, v = np.where(depth != 0)
z = depth[depth != 0]
x = (u - cx) / fx * z
y = (v - cy) / fy * z
pts = np.vstack((y, x, z)).T
pt_cloud = o3d.geometry.PointCloud()
pt_cloud.points = o3d.utility.Vector3dVector(pts)
pt_cloud.colors = o3d.utility.Vector3dVector(image[u, v, ...])
return pt_cloud
```

Resulting point cloud:
![Screenshot from 2021-05-15 21-52-31](https://user-images.githubusercontent.com/12258972/118376367-dfa23100-b5c7-11eb-9e52-a261f7a41787.png)

Another option I've been considering is to create the general point cloud and then get points from it based on a mask, but it looks like it's not implemented yet.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.