💻
Tutorial
  • INTRO
  • Part 0 (개요)
    • README
    • 3D 영상처리
    • [별첨] PCL & PCD란 (100%)
    • chapter02 : PCL 설치 (100%)
    • chapter03 : ROS 실습 준비(100%)
  • Part 1 (초급)
    • README
    • PCL 기반 로봇 비젼
    • [별첨] 파일 생성 및 입출력 (70%)
      • PCL-Cpp (70%)
      • PCL-Python (70%)
      • Open3D-Python (70%)
      • ROS 실습 (90%)
    • Filter
    • [별첨] 샘플링 (70%)
      • 다운샘플링-PCL-Cpp (70%)
      • 다운샘플링-PCL-Python (50%)
      • 업샘플링-PCL-Cpp (70%)
      • ROS 실습 (90%)
    • [별첨] 관심 영역 설정 (70%)
      • PCL-Cpp (70%)
      • PCL-Python (70%)
      • ROS 실습 (90%)
    • [별첨] 노이즈 제거 (70%)
      • PCL-Cpp (70%)
      • PCL-Python (50%)
      • ROS 실습 (90%)
  • Part 2 (중급)
    • README
    • Kd-Tree/Octree Search
    • Chapter03 : Sample Consensus
    • [별첨] 바닥제거 (RANSAC) (70%)
      • PCL-Cpp (70%)
      • PCL-Python (70%)
      • ROS 실습 (90%)
    • 군집화 (70%)
      • Euclidean-PCL-Cpp (70%)
      • Euclidean-PCL-Python (0%)
      • Conditional-Euclidean-PCL-Cpp (50%)
      • DBSCAN-PCL-Python (0%)
      • Region-Growing-PCL-Cpp (50%)
      • Region-Growing-RGB-PCL-Cpp (50%)
      • Min-Cut-PCL-Cpp (50%)
      • Model-Outlier-Removal-PCL-Cpp (50%)
      • Progressive-Morphological-Filter-PCL-Cpp (50%)
    • 포인트 탐색과 배경제거 (60%)
      • Search-Octree-PCL-Cpp (70%)
      • Search-Octree-PCL-Python (70%)
      • Search-Kdtree-PCL-Cpp (70%)
      • Search-Kdtree-PCL-Python (70%)
      • Compression-PCL-Cpp (70%)
      • DetectChanges-PCL-Cpp (50%)
      • DetectChanges-PCL-Python (50%)
    • 특징 찾기 (50%)
      • PFH-PCL-Cpp
      • FPFH-PCL-Cpp
      • Normal-PCL-Cpp (70%)
      • Normal-PCL-Python (80%)
      • Tmp
    • 분류/인식 (30%)
      • 인식-GeometricConsistencyGrouping
      • SVM-RGBD-PCL-Python (70%)
      • SVM-LIDAR-PCL-Python (0%)
      • SVM-ROS (0%)
    • 정합 (70%)
      • ICP-PCL-Cpp (70%)
      • ICP-ROS 실습 (10%)
    • 재구성 (30%)
      • Smoothig-PCL-Cpp (70%)
      • Smoothig-PCL-Python (70%)
      • Triangulation-PCL-Cpp (70%)
  • Part 3 (고급)
    • README
    • 딥러닝 기반 학습 데이터 생성 (0%)
      • PointGAN (90%)
      • AutoEncoder (0%)
    • 딥러닝 기반 샘플링 기법 (0%)
      • DenseLidarNet (50%)
      • Point Cloud Upsampling Network
      • Pseudo-LiDAR
    • 딥러닝 기반 자율주행 탐지 기술 (0%)
    • 딥러닝 기반 자율주행 분류 기술 (0%)
      • Multi3D
      • PointNet
      • VoxelNet (50%)
      • YOLO3D
      • SqueezeSeg
      • butNet
  • Snippets
    • PCL-Snippets
    • PCL-Python-Helper (10%)
    • Lidar Data Augmentation
  • Appendix
    • 시각화Code
    • 시각화툴
    • Annotation툴
    • Point Cloud Libraries (0%)
    • 데이터셋
    • Cling_PCL
    • 참고 자료
    • 작성 계획_Tips
    • 용어집
Powered by GitBook
On this page
  • SeartchPont 설정
  • Neighbors within voxel search
  • K nearest neighbor search
  • Neighbors within radius search

Was this helpful?

  1. Part 2 (중급)
  2. 포인트 탐색과 배경제거 (60%)

Search-Octree-PCL-Python (70%)

PreviousSearch-Octree-PCL-Cpp (70%)NextSearch-Kdtree-PCL-Cpp (70%)

Last updated 5 years ago

Was this helpful?

C++ 코드는 에서 다운로드 가능합니다. 원본 코드는 을 참고 하였습니다. 샘플파일은 을 사용하였습니다. Jupyter 버젼은 에서 확인 가능 합니다.

!python --version 
!pip freeze | grep pcl
Python 2.7.15rc1
python-pcl==0.3
import pcl
import numpy as np
import random
cloud = pcl.load("cloud_cluster_0.pcd")
resolution = 0.2
octree = cloud.make_octreeSearch(resolution)
octree.add_points_from_input_cloud()

SeartchPont 설정

  • 3000번째 포인트

searchPoint = pcl.PointCloud()
searchPoints = np.zeros((1, 3), dtype=np.float32)
searchPoints[0][0] = cloud[3000][0]
searchPoints[0][1] = cloud[3000][1]
searchPoints[0][2] = cloud[3000][2]
#searchPoints = (cloud[3000][0], cloud[3000][1], cloud[3000][2])

searchPoint.from_array(searchPoints)

Neighbors within voxel search

ind = octree.VoxelSearch(searchPoint)
VoxelSearch at (0.0346005521715 -1.46636068821 0.975462853909)
print('Neighbors within voxel search at (' + str(searchPoint[0][0]) + ' ' + str(
    searchPoint[0][1]) + ' ' + str(searchPoint[0][2]) + ')')

for i in range(0, 5):#range(0, ind.size):
    print('index = ' + str(ind[i]))
    print('(' + str(cloud[ind[i]][0]) + ' ' +
          str(cloud[ind[i]][1]) + ' ' + str(cloud[ind[i]][2]))
Neighbors within voxel search at (0.0346005521715 -1.46636068821 0.975462853909)
index = 412
(-0.0524208694696 -1.53244829178 1.08694171906
index = 461
(-0.0523550510406 -1.5297921896 1.0849506855
index = 508
(-0.0461958646774 -1.51667225361 1.08676922321
index = 509
(-0.0491730645299 -1.52067470551 1.08531403542
index = 510
(-0.0522709041834 -1.52677381039 1.08309662342

K nearest neighbor search

K = 10
print('K nearest neighbor search at (' + str(searchPoint[0][0]) + ' ' + str(
        searchPoint[0][1]) + ' ' + str(searchPoint[0][2]) + ') with K=' + str(K))
K nearest neighbor search at (0.0346005521715 -1.46636068821 0.975462853909) with K=10
[ind, sqdist] = octree.nearest_k_search_for_cloud(searchPoint, K)
for i in range(0, ind.size):
    print('(' + str(cloud[ind[0][i]][0]) + ' ' + str(cloud[ind[0][i]][1]) + ' ' + str(
        cloud[ind[0][i]][2]) + ' (squared distance: ' + str(sqdist[0][i]) + ')')
(0.0346005521715 -1.46636068821 0.975462853909 (squared distance: 0.0)
(0.0317970663309 -1.46587443352 0.975684165955 (squared distance: 8.14496e-06)
(0.0374080836773 -1.46704232693 0.975152671337 (squared distance: 8.44308e-06)
(0.0345886982977 -1.46636962891 0.978524148464 (squared distance: 9.37174e-06)
(0.0346124246716 -1.46635174751 0.972395777702 (squared distance: 9.40718e-06)
(0.0373939499259 -1.46708440781 0.978200435638 (squared distance: 1.58212e-05)
(0.0318062528968 -1.46585941315 0.972620844841 (squared distance: 1.61364e-05)
(0.0317878909409 -1.46588945389 0.978741645813 (squared distance: 1.88836e-05)
(0.0374225899577 -1.46703207493 0.972084701061 (squared distance: 1.98266e-05)
(0.0289955306798 -1.4653942585 0.975902557373 (squared distance: 3.25436e-05)

Neighbors within radius search

radius = 0.02
print('Neighbors within radius search at (' + str(searchPoint[0][0]) + ' ' + str(
        searchPoint[0][1]) + ' ' + str(searchPoint[0][2]) + ') with radius=' + str(radius))
Neighbors within radius search at (0.0346005521715 -1.46636068821 0.975462853909) with radius=0.02
[ind, sqdist] = octree.radius_search(searchPoints, radius, 10)
Exception TypeError: 'only length-1 arrays can be converted to Python scalars' in 'pcl._pcl.to_point_t' ignored
for i in range(0, ind.size):
    print('(' + str(cloud[ind[0][i]][0]) + ' ' + str(cloud[ind[0][i]][1]) + ' ' + str(
        cloud[ind[0][i]][2]) + ' (squared distance: ' + str(sqdist[0][i]) + ')')
[이곳]
[이곳]
[cloud_cluster_0.pcd]
[이곳]