File: MinCutSegmentation_172.txt

package info (click to toggle)
python-pcl 0.3.0~rc1%2Bdfsg-14
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 31,828 kB
  • sloc: python: 3,094; cpp: 283; makefile: 181; sh: 24; ansic: 12
file content (56 lines) | stat: -rw-r--r-- 1,732 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
# -*- coding: utf-8 -*-
# http://pointclouds.org/documentation/tutorials/min_cut_segmentation.php

#pcl::PointCloud <pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud <pcl::PointXYZ>);
#  if ( pcl::io::loadPCDFile <pcl::PointXYZ> ("min_cut_segmentation_tutorial.pcd", *cloud) == -1 )
#  {
#    std::cout << "Cloud reading failed." << std::endl;
#    return (-1);
#  }
cloud = pcl.load('./examples/pcldata/tutorials/min_cut_segmentation_tutorial.pcd')

# pcl::IndicesPtr indices (new std::vector <int>);
# pcl::PassThrough<pcl::PointXYZ> pass;
# pass.setInputCloud (cloud);
# pass.setFilterFieldName ("z");
# pass.setFilterLimits (0.0, 1.0);
# pass.filter (*indices);
pass = cloud.make_passthrough_filter()
pass.set_filter_field_name('z')
pass.set_filter_limits(0.0, 1.0)
indices = pass.filter()

# pcl::MinCutSegmentation<pcl::PointXYZ> seg;
# seg.setInputCloud (cloud);
# seg.setIndices (indices);
seg = cloud.make_MinCutSegmentation()

# pcl::PointCloud<pcl::PointXYZ>::Ptr foreground_points(new pcl::PointCloud<pcl::PointXYZ> ());
foreground_points = pcl.PointCloud()

# pcl::PointXYZ point;
# point.x = 68.97;
# point.y = -18.55;
# point.z = 0.57;
# foreground_points->points.push_back(point)


# seg.setForegroundPoints (foreground_points);
# seg.setSigma (0.25);
# seg.setRadius (3.0433856);
# seg.setNumberOfNeighbours (14);
# seg.setSourceWeight (0.8);

# std::vector <pcl::PointIndices> clusters;
# seg.extract (clusters);
# std::cout << "Maximum flow is " << seg.getMaxFlow () << std::endl;

  pcl::PointCloud <pcl::PointXYZRGB>::Ptr colored_cloud = seg.getColoredCloud ();

# pcl::visualization::CloudViewer viewer ("Cluster viewer");
# viewer.showCloud(colored_cloud);
# while (!viewer.wasStopped ())
# {
# }

  return (0);