isl-org / Open3D

Open3D: A Modern Library for 3D Data Processing
http://www.open3d.org
Other
11.17k stars 2.27k forks source link

normals all the same after estimate_normals of .las data point cloud #6670

Open justinsavage35 opened 6 months ago

justinsavage35 commented 6 months ago

Checklist

Describe the issue

When using estimate_normals with a point cloud from .las data, all the normals are the same and incorrect e.g. [0,0,1]. las_data.zip normal_histogram

Steps to reproduce the bug

import laspy
import open3d as o3d
import numpy as np
from pathlib import Path
import matplotlib.pyplot as plt

las_file_example_path = Path(r"las_data\NEONDSSampleLiDARPointCloud_crop.las")

print(f"File exist: {las_file_example_path.exists()}")

las = laspy.read(las_file_example_path)

print(f"Las data: {las}")

print(f"Dimensions: {list(las.point_format.dimension_names)}")

point_data = np.stack([las.X, las.Y, las.Z], axis=0).transpose((1, 0))

geom = o3d.geometry.PointCloud()
geom.points = o3d.utility.Vector3dVector(point_data)

geom.estimate_normals(
    search_param=o3d.geometry.KDTreeSearchParamHybrid(radius=0.1, max_nn=30))

o3d.visualization.draw_geometries([geom])

print(f"Normal vectors of the first 10 points: {np.asarray(geom.normals)[:10]}")

plt.hist(np.asarray(geom.normals)[:, :])
plt.title("Histogram of the Normals values")
plt.show()

Error message

No error messages

Expected behavior

A range of different normals values to match the point cloud

Open3D, Python and System information

- Operating system: Windows 10 64-bit
- Python version: 3.9.6
- Open3D version: output from python: 0.18.0
- System architecture: x86 / arm64
- Is this a remote workstation?: no
- How did you install Open3D?: pip

Additional information

No response

nicolaloi commented 3 months ago

It is not a bug, you have to scale down the xyz dimensions of your LAS dataset, because now the point cloud has a size of 44225m x 37373m x 6376m. Your radius argument of KDTreeSearchParamHybrid has a value of 0.1 m, which is too small for your current point cloud. Increase radius, or scale down the xyz data of the point cloud.