File: bare_earth_172.txt

package info (click to toggle)
python-pcl 0.3.0~rc1%2Bdfsg-9
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 31,388 kB
  • sloc: python: 3,102; cpp: 283; makefile: 181; sh: 24; ansic: 12
file content (69 lines) | stat: -rw-r--r-- 2,289 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# -*- coding: utf-8 -*-
# Identifying ground returns using ProgressiveMorphologicalFilter segmentation
# http://pointclouds.org/documentation/tutorials/progressive_morphological_filtering.php#progressive-morphological-filtering

import pcl

# int main (int argc, char** argv)
# {
#   pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZ>);
#   pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_filtered (new pcl::PointCloud<pcl::PointXYZ>);
#   pcl::PointIndicesPtr ground (new pcl::PointIndices);
#
#   // Fill in the cloud data
#   pcl::PCDReader reader;
#   // Replace the path below with the path where you saved your file
#   reader.read<pcl::PointXYZ> ("samp11-utm.pcd", *cloud);
# 
#   std::cerr << "Cloud before filtering: " << std::endl;
#   std::cerr << *cloud << std::endl;
### 
cloud = pcl.load('samp11-utm.pcd')
# print("Cloud before filtering: ")

# // Create the filtering object
# pcl::ProgressiveMorphologicalFilter<pcl::PointXYZ> pmf;
# pmf.setInputCloud (cloud);
# pmf.setMaxWindowSize (20);
# pmf.setSlope (1.0f);
# pmf.setInitialDistance (0.5f);
# pmf.setMaxDistance (3.0f);
# pmf.extract (ground->indices);
###
pmf = cloud.make_ProgressiveMorphologicalFilter()
pmf.set_MaxWindowSize (20)
pmf.set_Slope (1.0)
pmf.set_InitialDistance (0.5)
pmf.set_MaxDistance (3.0)
ground_indices = pmf.extract()

# // Create the filtering object
# pcl::ExtractIndices<pcl::PointXYZ> extract;
# extract.setInputCloud (cloud);
# extract.setIndices (ground);
# extract.filter (*cloud_filtered);
###
extract = cloud_make_Extract()
extract.setIndices (ground);
cloud_filtered = extract.filter ()

# std::cerr << "Ground cloud after filtering: " << std::endl;
# std::cerr << *cloud_filtered << std::endl;
# pcl::PCDWriter writer;
# writer.write<pcl::PointXYZ> ("samp11-utm_ground.pcd", *cloud_filtered, false);
# 
# // Extract non-ground returns
# extract.setNegative (true);
# extract.filter (*cloud_filtered);
# 
# std::cerr << "Object cloud after filtering: " << std::endl;
# std::cerr << *cloud_filtered << std::endl;
# 
# writer.write<pcl::PointXYZ> ("samp11-utm_object.pcd", *cloud_filtered, false);
###
pcl.save(cloud_filtered, 'samp11-utm_ground.pcd')

extract.setNegative (True)
cloud_filtered = extract.filter ()

pcl.save(cloud_filtered, 'samp11-utm_object.pcd')