[Miscellaneous learning] Basic use of Open3D

tags: Photography measurement  study  Computer vision  Autopilot

Basic use of Open3D

Foreword

When processing point cloud data, the installation and getting started with the PCL library is more difficult. Intel's Open3D is excellent in performance and unpacking, it can read, process, and display various dot clouds, so this test is done.

Preparation

Install

Use Pychram under Window11 to configure the virtual environment of Python3.6 (PS: Open3D to blog writing date, temporarily only supports version 3.6-3.8), and setting of the virtual environment. Install Open3D, NUMPY, OpenCV (Optional).

Test data download

Loat the source code of Open3D on getHub, which contains the test data we need to be officially provided:

isl-org/Open3D: Open3D: A Modern Library for 3D Data Processing (github.com)

Test data is located in:

Open3D-master\\examples\\test_data\\

Preliminary use

Point cloud display

Simple use, display a colorful point cloud

import open3d as o3d
import numpy as np

print("Load a ply point cloud, print it, and render it")
#Read point cloud data
pcd = o3d.io.read_point_cloud("C:\\Document\\Open3D-master\\examples\\test_data\\fragment.ply")
print(pcd)
print(np.asarray(pcd.points))
#Show point cloud data
o3d.visualization.draw_geometries([pcd],
                                  zoom=0.3412,
                                  front=[0.4257, -0.2125, -0.8795],
                                  lookat=[2.6172, 2.0475, 1.532],
                                  up=[-0.0694, -0.9768, 0.2024])

The display effect is shown below:
Insert a picture description here

voxel sampling

Voxel sampling uses conventional virgin grids to create uniform sampling point clouds from the input point cloud. It is usually used for pre -processing steps for many cloud processing tasks. This algorithm is divided into two steps:

1. Points to be folded into Voxel.

2. Each occupied virus is exactly one point through all points within the average.

The code changed a little on the basis of just now:

import open3d as o3d
import numpy as np

print("Load a ply point cloud, print it, and render it")
pcd = o3d.io.read_point_cloud("C:\\Document\\Open3D-master\\examples\\test_data\\fragment.ply")
print("Downsample the point cloud with a voxel of 0.05")
downpcd = pcd.voxel_down_sample(voxel_size=0.05)
o3d.visualization.draw_geometries([downpcd],
                                  zoom=0.3412,
                                  front=[0.4257, -0.2125, -0.8795],
                                  lookat=[2.6172, 2.0475, 1.532],
                                  up=[-0.0694, -0.9768, 0.2024])

The dense point clouds in the previous step have become relatively sparse, and their uses need to be further learned.

The fixed -point method is estimated

Another basic operation of Dianyun is the dotted line estimate. Press the n key to check the point method. Bonded-and+can be used to control the length of the method.

import open3d as o3d
import numpy as np

print("Load a ply point cloud, print it, and render it")
pcd = o3d.io.read_point_cloud("C:\\Document\\Open3D-master\\examples\\test_data\\fragment.ply")
print("Downsample the point cloud with a voxel of 0.05")
downpcd = pcd.voxel_down_sample(voxel_size=0.05)
downpcd.estimate_normals(
    search_param=o3d.geometry.KDTreeSearchParamHybrid(radius=0.1, max_nn=30))
o3d.visualization.draw_geometries([downpcd],
                                  zoom=0.3412,
                                  front=[0.4257, -0.2125, -0.8795],
                                  lookat=[2.6172, 2.0475, 1.532],
                                  up=[-0.0694, -0.9768, 0.2024],
                                  point_show_normal=True)

-Effect

+Effect

PS: ESTIMATE_NORMALS calculates the method of each point. This function is used to find adjacent points, and uses a covariance analysis to calculate the main axis of the adjacent point.

This function uses instances of KDTREESEARCHPARAMHYBRID class as a parameter. Two key parameters Radius = 0.1 and max_nn = 30 Specify the search radius and the maximum nearest neighbor. Its search radius is 10cm, and only 30 neighbors are considered to save computing time.

Intelligent Recommendation

python learning ⑦ | Open3D

I. Introduction Install Open 3D Open3D is an open source code library that supports rapid development and processing 3D data. 2. Open3D library read the Ply model Create a point cloud map Draw a bunch...

Open3D preliminary learning

In 3D display or point cloud treatment, efficiency is important. Open3D is a 3D visual artifact. Install pip install open3d 1. Multifold point cloud stitching to form a whole point cloud operation res...

Open3D Learning Notes II

Open3D learning notes of notes 1. Supplement some small knowledge 1. Read the PLY file in a memory manner 2. Rotating matrix Second, the way to transform into a cloud 1. Convert to NUMPY array and the...

Open3D Learning Record 1

Dianyun model reading Dianyun model writing Point cloud model color Output point cloud quantity Dianyun model visualization...

Use Open3D to draw triangles

Use Open3D to draw three-dimensional three-dimensional triangles  ...

More Recommendation

OPEN3D visualization use

1. Self-built random points and display import open3d import numpy as np pcd = open3d.geometry.PointCloud() # First create a pcd type data (this is the data form in open3d) np_points = np.random.rand(...

Use of Open3D KDTree

One, the main function 1. Read the point cloud and build a KDTree. This is the preprocessing step of the nearest neighbor query 2. Select the query point, The code below takes the 200th point as the q...

Chapter 11: Use Open3D

Basics: installationpip3 install open3d        View installation package: PIP LIST one.Multi-angle point clouds are splicing together to generate the entire poi...

Python learning miscellaneous - basic grammar articles

Note: Single line comment # Multi line comment ''' or """ Python2 Chinese compatibility program: #coding=utf-8 Variable: age=100 # Define variable x is assigned to 100 Conditional state...

Miscellaneous: 0 basic learning method record

Article Directory Get messy information confirm target Get accurate information books Video tutorial paper Source code Development Get messy information First of all, I usually consciously contact mor...

Copyright  DMCA © 2018-2026 - All Rights Reserved - www.programmersought.com  User Notice

Top