Example #1
0
def generate_points(subset=0.02):
    """A helper to make a 3D NumPy array of points (n_points by 3)"""
    dataset = examples.download_lidar()
    ids = np.random.randint(low=0,
                            high=dataset.n_points - 1,
                            size=int(dataset.n_points * subset))
    return dataset.points[ids]
def get_example_point_cloud(decimateFactor = 0.05):
    """ Create numpy array of points from PyVista LiDAR example """
    
    # Get PyVista Lidar Example Data
    print("Downloading PyVista LiDAR Example data ...")
    dataset = examples.download_lidar()
    print(f"Downloading complete. Downloaded {dataset.n_points} points")
    print(f"Data type {type(dataset)}")
    # Get random points from the dataset
    pointIds = np.random.randint(low=0, high=dataset.n_points-1, size=int(dataset.n_points * decimateFactor) )
    print(f"Number of points after decimation: {len(pointIds)}")

    return dataset.points[pointIds]
Example #3
0
 def test_download_lidar():
     data = examples.download_lidar()
     assert data.n_cells
Example #4
0
def lidar():
    return mesh.load_mesh(examples.download_lidar())
Example #5
0
# No eye-dome lighting
p.subplot(0, 1)
p.add_mesh(nefertiti, color=True)
p.add_text("No Eye-Dome Lighting", font_size=24)
p.camera_position = [-1, -1, 0.2]

p.show()

###############################################################################
# Point Cloud
# +++++++++++
#
# When plotting a simple point cloud, it can be difficult to perceive depth.
# Take this Lidar point cloud for example:

point_cloud = examples.download_lidar()

###############################################################################
# And now plot this point cloud as-is:

# Plot a typical point cloud with no EDL
p = pv.Plotter()
p.add_mesh(point_cloud, color="tan", point_size=5)
p.show()

###############################################################################
# We can improve the depth mapping by enabling eye dome lighting on the
# renderer. Reference :func:`pyvista.Renderer.enable_eye_dome_lighting`.

# Plot with EDL
p = pv.Plotter()
Example #6
0
 def __init__(self):
     self._example_data = examples.download_lidar()
     _ExampleLoader.__init__(self)
Example #7
0
import dash
import dash_vtk
import dash_html_components as html
import dash_core_components as dcc
from dash.dependencies import Input, Output, State

import numpy as np
import pyvista as pv
from pyvista import examples

np.random.seed(42)

# Get point cloud data from PyVista
dataset = examples.download_lidar()
subset = 0.2
selection = np.random.randint(low=0,
                              high=dataset.n_points - 1,
                              size=int(dataset.n_points * subset))
points = dataset.points[selection]
xyz = points.ravel()
elevation = points[:, -1].ravel()
min_elevation = np.amin(elevation)
max_elevation = np.amax(elevation)
print(f"Number of points: {points.shape}")
print(f"Elevation range: [{min_elevation}, {max_elevation}]")

# Setup VTK rendering of PointCloud
app = dash.Dash(__name__)
server = app.server

vtk_view = dash_vtk.View([