EfficientRANSACPrimitiveExtractor.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * ArmarX is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation.
7  *
8  * ArmarX is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * @package VisionX::ArmarXObjects::EfficientRANSACPrimitiveExtractor
17  * @author Raphael Grimm ( raphael dot grimm at kit dot edu )
18  * @date 2020
19  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  */
22 
23 #include <pcl/filters/statistical_outlier_removal.h>
24 #include <pcl/common/transforms.h>
25 
27 
29 
31 
32 #include <VisionX/interface/components/Calibration.h>
33 #include <SimoxUtility/meta/type_name.h>
34 
36 
37 //gui
38 namespace armarx
39 {
41  {
42  const auto& buf = _cfgBuf.getWriteBuffer();
45 
46  .addTextLabel("outlierMeanK")
47  .addChild(RemoteGui::makeIntSpinBox("outlierMeanK")
48  .value(buf.outlierMeanK).min(1).max(1000))
49 
50  .addTextLabel("outlierStddevMulThresh")
51  .addChild(RemoteGui::makeFloatSpinBox("outlierStddevMulThresh")
52  .value(buf.outlierStddevMulThresh).min(0).max(10))
53 
56 
57  .addTextLabel("ransacEpsilon")
58  .addChild(RemoteGui::makeFloatSpinBox("ransacEpsilon")
59  .value(buf.ransacEpsilon).min(1).max(1000))
60 
61  .addTextLabel("ransacBitmapEpsilon")
62  .addChild(RemoteGui::makeFloatSpinBox("ransacBitmapEpsilon")
63  .value(buf.ransacBitmapEpsilon).min(1).max(10000))
64 
65  .addTextLabel("ransacNormalThresh")
66  .addChild(RemoteGui::makeFloatSpinBox("ransacNormalThresh")
67  .value(buf.ransacNormalThresh).min(0).max(1).decimals(3))
68 
69  .addTextLabel("ransacProbability")
70  .addChild(RemoteGui::makeFloatSpinBox("ransacProbability")
71  .value(buf.ransacProbability).min(0).max(1).decimals(3))
72 
73  .addTextLabel("ransacMinSupport")
74  .addChild(RemoteGui::makeIntSpinBox("ransacMinSupport")
75  .value(buf.ransacMinSupport).min(1).max(1000))
76 
77  .addTextLabel("ransacMaxruntimeMs")
78  .addChild(RemoteGui::makeIntSpinBox("ransacMaxruntimeMs")
79  .value(buf.ransacMaxruntimeMs).min(1).max(10000));
80  }
81 
83  {
85  prx.receiveUpdates();
86 
87  auto& buf = _cfgBuf.getWriteBuffer();
88  prx.getValue(buf.outlierMeanK, "outlierMeanK");
89  prx.getValue(buf.outlierStddevMulThresh, "outlierStddevMulThresh");
90 
91  prx.getValue(buf.ransacEpsilon, "ransacEpsilon");
92  prx.getValue(buf.ransacNormalThresh, "ransacNormalThresh");
93  prx.getValue(buf.ransacMinSupport, "ransacMinSupport");
94  prx.getValue(buf.ransacBitmapEpsilon, "ransacBitmapEpsilon");
95  prx.getValue(buf.ransacProbability, "ransacProbability");
96  prx.getValue(buf.ransacMaxruntimeMs, "ransacMaxruntimeMs");
97  _cfgBuf.commitWrite();
98  prx.sendUpdates();
99  }
100 }
101 
102 #define result_name_transformed getName() + "_Transformed"
103 #define result_name_filtered getName() + "_Filtered"
104 
105 namespace armarx
106 {
108  visionx::PointCloudProcessorPropertyDefinitions(prefix)
109  {
110  defineOptionalProperty<std::string>("ProviderReferenceFrame", "", "Name of the point cloud refence frame (empty = autodetect)");
111 
112  }
113 
115  {
116  return "EfficientRANSACPrimitiveExtractor";
117  }
118 
120  {
121  _pointCloudProviderName = getProperty<std::string>("ProviderName");
122  usingPointCloudProvider(_pointCloudProviderName);
123  }
125  {
126  //provider
127  {
128  enableResultPointClouds<pcl::PointXYZ>(result_name_transformed);
129  enableResultPointClouds<pcl::PointXYZ>(result_name_filtered);
130 
131  _pointCloudProviderInfo = getPointCloudProvider(_pointCloudProviderName, true);
132  _pointCloudProvider = _pointCloudProviderInfo.proxy;
133  _pointCloudProviderRefFrame = getProperty<std::string>("ProviderReferenceFrame");
134  if (_pointCloudProviderRefFrame.empty())
135  {
136  _pointCloudProviderRefFrame = "root";
137  auto frameprov = visionx::ReferenceFrameInterfacePrx::checkedCast(_pointCloudProvider);
138  if (frameprov)
139  {
140  _pointCloudProviderRefFrame = frameprov->getReferenceFrame();
141  }
142  }
143  ARMARX_INFO << VAROUT(_pointCloudProviderRefFrame);
144  }
145  //robot
146  {
147  addRobot("_localRobot", VirtualRobot::RobotIO::eStructure);
148  _localRobot = getRobotData("_localRobot");
149  }
150  //gui
152  {
153  processGui(prx);
154  });
156  }
158  {
159 
160  }
162  {
163 
164  }
166  {
167 
168 #define call_template_function(F) \
169  switch(_pointCloudProviderInfo.pointCloudFormat->type) \
170  { \
171  case visionx::PointContentType::ePoints : F<pcl::PointXYZ>(); break; \
172  case visionx::PointContentType::eColoredPoints : F<pcl::PointXYZRGBA>(); break; \
173  case visionx::PointContentType::eColoredOrientedPoints : F<pcl::PointXYZRGBNormal>(); break; \
174  case visionx::PointContentType::eLabeledPoints : F<pcl::PointXYZL>(); break; \
175  case visionx::PointContentType::eColoredLabeledPoints : F<pcl::PointXYZRGBL>(); break; \
176  case visionx::PointContentType::eIntensity : F<pcl::PointXYZI>(); break; \
177  case visionx::PointContentType::eOrientedPoints : \
178  ARMARX_ERROR << "eOrientedPoints NOT HANDLED IN VISIONX"; \
179  [[fallthrough]]; default: \
180  ARMARX_ERROR << "Could not process point cloud, because format '" \
181  << _pointCloudProviderInfo.pointCloudFormat->type << "' is unknown"; \
182  } do{}while(false)
184  }
185 
186 
188  {
191  }
192 
193 }
194 
197 
203 
209 
210 namespace armarx
211 {
212  template<class PointType>
214  {
215  const auto& buf = _cfgBuf.getUpToDateReadBuffer();
216  using cloud_t = pcl::PointCloud<PointType>;
217  using cloud_ptr_t = typename cloud_t::Ptr;
218  const auto now = [] {return std::chrono::high_resolution_clock::now();};
219  const auto timeBeg = now();
221  {
222  const auto dt = now() - timeBeg;
223  const int us = std::chrono::duration_cast<std::chrono::microseconds>(dt).count();
224  setDebugObserverDatafield("time_full_process_call_s", us / 1e6f);
226  };
227  //get cloud + transform to global
228  cloud_ptr_t transformedCloud;
229  {
230  if (!waitForPointClouds(_pointCloudProviderName, 100))
231  {
232  ARMARX_INFO << deactivateSpam(10, _pointCloudProviderName)
233  << "Timeout or error while waiting for point cloud data of provider "
234  << _pointCloudProviderName;
235  return;
236  }
237  cloud_ptr_t inputCloud(new cloud_t);
238  getPointClouds(_pointCloudProviderName, inputCloud);
239  setDebugObserverDatafield("size_cloud_in", inputCloud->size());
240  synchronizeLocalClone(_localRobot);
241 
242  const Eigen::Matrix4f providerInRootFrame = [&]() -> Eigen::Matrix4f
243  {
244  FramedPose fp {Eigen::Matrix4f::Identity(), _pointCloudProviderRefFrame, _localRobot.robot->getName()};
245  //fp.changeFrame(_localRobot.robot, _localRobot.robot->getRootNode()->getName());
246  fp.changeFrame(_localRobot.robot, "Global");
247  return fp.toEigen();
248  }();
249 
250  transformedCloud = cloud_ptr_t(new cloud_t);
251  pcl::transformPointCloud(*inputCloud, *transformedCloud, providerInRootFrame);
252 
254  }
255 
256  //remove outliers
257  {
258  cloud_ptr_t filtered(new cloud_t);
259  pcl::StatisticalOutlierRemoval<PointType> sor;
260  sor.setInputCloud(transformedCloud);
261  sor.setMeanK(buf.outlierMeanK);
262  sor.setStddevMulThresh(buf.outlierStddevMulThresh);
263  sor.filter(*filtered);
264  setDebugObserverDatafield("size_cloud_filtered", filtered->size());
266  std::swap(filtered, transformedCloud);
267  }
268 
269  //ransac stuff
270  {
271  ARMARX_INFO << "creating point vec";
272  std::vector<Point> points;
273  points.reserve(transformedCloud->size());
274  static constexpr float inf = std::numeric_limits<float>::infinity();
275  float minX = inf;
276  float minY = inf;
277  float minZ = inf;
278  float maxX = -inf;
279  float maxY = -inf;
280  float maxZ = -inf;
281  for (const auto& p : *transformedCloud)
282  {
283  points.emplace_back(Vec3f(p.x, p.y, p.z));
284  std::tie(minX, maxX) = std::minmax({minX, maxX, p.x});
285  std::tie(minY, maxY) = std::minmax({minY, maxY, p.y});
286  std::tie(minZ, maxZ) = std::minmax({minZ, maxZ, p.z});
287  }
288  ARMARX_INFO << "creating cloud";
289  PointCloud pc(points.data(), points.size());
290  pc.setBBox({minX, minY, minZ}, {maxX, maxY, maxZ});
291  ARMARX_INFO << "calc cloud normals";
292  pc.calcNormals(100);
293  ARMARX_INFO << VAROUT(pc.getScale());
294 
295  ARMARX_INFO << "configure ransac";
297  {
298  ransacOptions.m_epsilon = buf.ransacEpsilon; // set distance threshold to .01f of bounding box width
299  // NOTE: Internally the distance threshold is taken as 3 * ransacOptions.m_epsilon!!!
300  ransacOptions.m_bitmapEpsilon = buf.ransacBitmapEpsilon; // set bitmap resolution to .02f of bounding box width
301  // NOTE: This threshold is NOT multiplied internally!
302  ransacOptions.m_normalThresh = buf.ransacNormalThresh; // this is the cos of the maximal normal deviation
303  ransacOptions.m_minSupport = buf.ransacMinSupport; // this is the minimal numer of points required for a primitive
304  ransacOptions.m_probability = buf.ransacProbability; // this is the "probability" with which a primitive is overlooked
305  ransacOptions.m_maxruntime = std::chrono::milliseconds{buf.ransacMaxruntimeMs};
306  }
307 
308  RansacShapeDetector detector(ransacOptions); // the detector object
309  {
310  // set which primitives are to be detected by adding the respective constructors
314  //detector.Add(new ConePrimitiveShapeConstructor());
315  //detector.Add(new TorusPrimitiveShapeConstructor());
316  }
317 
318 
319  ARMARX_INFO << "run ransac";
320  MiscLib::Vector< std::pair< MiscLib::RefCountPtr< PrimitiveShape >, size_t > > shapes; // stores the detected shapes
321  size_t remaining = detector.Detect(pc, 0, pc.size(), &shapes); // run detection
322  // returns number of unassigned points
323  // the array shapes is filled with pointers to the detected shapes
324  // the second element per shapes gives the number of points assigned to that primitive (the support)
325  // the points belonging to the first shape (shapes[0]) have been sorted to the end of pc,
326  // i.e. into the range [ pc.size() - shapes[0].second, pc.size() )
327  // the points of shape i are found in the range
328  // [ pc.size() - \sum_{j=0..i} shapes[j].second, pc.size() - \sum_{j=0..i-1} shapes[j].second )
329 
330  ARMARX_INFO << "remaining unassigned points " << remaining << std::endl;
331 
332  setDebugObserverDatafield("ransac_num_remaining_points", remaining);
333  setDebugObserverDatafield("ransac_num_shapes", shapes.size());
334 
335 
336  viz::Layer cloudLayer = arviz.layer("Cloud");
337  {
338  cloudLayer.add(viz::PointCloud("points")
339  .position(Eigen::Vector3f::Zero())
340  .transparency(0.0f)
341  .pointSizeInPixels(8)
342  .pointCloud(*transformedCloud));
343  }
344  viz::Layer ransacLayer = arviz.layer("Ransac");
345  //draw shapes and cloud
346  std::size_t numCyl = 0;
347  std::size_t numSph = 0;
348  std::size_t numPla = 0;
349  std::size_t numUnk = 0;
350 
351  static int maxnum = 0;
352  int i = 0;
353  int idx = 0;
354 
355  const auto draw_cloud = [&](std::size_t num, std::string desc)
356  {
357  viz::Layer cloudLayer = arviz.layer("Cloud " + std::to_string(i) + " " + desc);
358  viz::PointCloud cloud("points");
359  cloud.position(Eigen::Vector3f::Zero());
360  cloud.transparency(0.0f);
361  cloud.pointSizeInPixels(8);
362 
363  for (std::size_t i2 = 0; i2 < num; ++i2, ++idx)
364  {
365  const auto& pt = pc.at(pc.size() - 1 - idx);
366  cloud.addPoint(pt.pos.getValue()[0], pt.pos.getValue()[1], pt.pos.getValue()[2], i);
367  }
368  cloud.colorGlasbeyLUT(i);
369  cloudLayer.add(cloud);
370  arviz.commit({cloudLayer});
371  };
372 
373  for (; i < shapes.size(); ++i)
374  {
375  using plane_t = const PlanePrimitiveShape;
376  using sphere_t = const SpherePrimitiveShape;
377  using cylinder_t = const CylinderPrimitiveShape;
378 
379  const auto& [s, sz] = shapes.at(i);
380  const std::string name = std::to_string(i);
381 
382  if (plane_t* ptr = dynamic_cast<plane_t*>(s.Ptr()); ptr)
383  {
384  ++numPla;
385  Eigen::Vector3f c;
386  ptr->Internal().getPosition().getValue(c.x(), c.y(), c.z());
387 
388  Eigen::Vector3f n;
389  ptr->Internal().getNormal().getValue(n.x(), n.y(), n.z());
390 
391  ransacLayer.add(viz::Polygon(name)
392  .colorGlasbeyLUT(i)
393  .lineColorGlasbeyLUT(i)
394  .lineWidth(1.0f)
395  .circle(c, n, 200, 64));
396  }
397  else if (sphere_t* ptr = dynamic_cast<sphere_t*>(s.Ptr()); ptr)
398  {
399  ++numSph;
400  Eigen::Vector3f c;
401  ptr->Internal().Center().getValue(c.x(), c.y(), c.z());
402 
403  ransacLayer.add(viz::Sphere(name)
404  .colorGlasbeyLUT(i)
405  .position(c)
406  .radius(ptr->Internal().Radius()));
407  }
408  else if (cylinder_t* ptr = dynamic_cast<cylinder_t*>(s.Ptr()); ptr)
409  {
410  ++numCyl;
411  Eigen::Vector3f c;
412  ptr->Internal().AxisPosition().getValue(c.x(), c.y(), c.z());
413 
414  ransacLayer.add(viz::Cylinder(name)
415  .colorGlasbeyLUT(i)
416  .position(c)
417  .color(viz::Color::green())
418  .radius(ptr->Internal().Radius())
419  .height(ptr->Height()));
420  }
421  else
422  {
423  ++numUnk;
424  ARMARX_WARNING << "UNKNOWN shape " << simox::meta::get_type_name(s.Ptr());
425  }
426  //std::string desc;
427  //s->Description(&desc);
428  draw_cloud(sz, "dummy");
429  }
430  draw_cloud(remaining, "dummy");
431  for (; i < maxnum; ++i)
432  {
433  draw_cloud(0, "dummy");
434  }
435 
436  setDebugObserverDatafield("ransac_num_cylinders", numCyl);
437  setDebugObserverDatafield("ransac_num_spheres", numSph);
438  setDebugObserverDatafield("ransac_num_planes", numPla);
439  setDebugObserverDatafield("ransac_num_unknown", numUnk);
440  arviz.commit({cloudLayer, ransacLayer});
441  }
442  }
443 }
result_name_transformed
#define result_name_transformed
Definition: EfficientRANSACPrimitiveExtractor.cpp:102
SpherePrimitiveShapeConstructor
Definition: SpherePrimitiveShapeConstructor.h:10
armarx::EfficientRANSACPrimitiveExtractor::process
void process() override
Process the vision component.
Definition: EfficientRANSACPrimitiveExtractor.cpp:165
armarx::viz::Client::commit
CommitResult commit(StagedCommit const &commit)
Definition: Client.cpp:80
CylinderPrimitiveShapeConstructor.h
SpherePrimitiveShape.h
armarx::TripleBuffer::getWriteBuffer
T & getWriteBuffer()
Definition: TripleBuffer.h:90
armarx::RemoteGui::detail::SimpleGridLayoutBuilder::addEmptyWidget
SimpleGridLayoutBuilder & addEmptyWidget(int colspan)
Definition: LayoutWidgets.h:148
armarx::plugins::RobotStateComponentPlugin::RobotData::robot
VirtualRobot::RobotPtr robot
Definition: RobotStateComponentPlugin.h:138
PlanePrimitiveShape.h
visionx
ArmarX headers.
Definition: OpenPoseStressTest.h:38
OnScopeExit.h
call_template_function
#define call_template_function(F)
TorusPrimitiveShape.h
RansacShapeDetector.h
armarx::FramedPose
The FramedPose class.
Definition: FramedPose.h:258
armarx::TripleBuffer::commitWrite
void commitWrite()
Definition: TripleBuffer.h:146
armarx::RobotStateComponentPluginUser::getRobotData
RobotStateComponentPlugin::RobotData getRobotData(const std::string &id) const
Definition: RobotStateComponentPlugin.cpp:356
RansacShapeDetector::Detect
size_t Detect(PointCloud &pc, size_t begin, size_t end, MiscLib::Vector< std::pair< MiscLib::RefCountPtr< PrimitiveShape >, size_t > > *shapes)
Definition: RansacShapeDetector.cpp:484
visionx::PointCloudProviderInfo::proxy
PointCloudProviderInterfacePrx proxy
Proxy to PointCloud provider.
Definition: PointCloudProcessor.h:87
armarx::EfficientRANSACPrimitiveExtractor::onConnectPointCloudProcessor
void onConnectPointCloudProcessor() override
Implement this method in the PointCloudProcessor in order execute parts when the component is fully i...
Definition: EfficientRANSACPrimitiveExtractor.cpp:124
armarx::RemoteGui::detail::SimpleGridLayoutBuilder::addChild
SimpleGridLayoutBuilder & addChild(WidgetPtr const &child, int colspan)
Definition: LayoutWidgets.h:121
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:43
PlanePrimitiveShapeConstructor.h
ARMARX_ON_SCOPE_EXIT
#define ARMARX_ON_SCOPE_EXIT
Executes given code when the enclosing scope is left.
Definition: OnScopeExit.h:112
RansacShapeDetector::Options::m_bitmapEpsilon
float m_bitmapEpsilon
Definition: RansacShapeDetector.h:37
armarx::viz::Cylinder::height
Cylinder & height(float h)
Definition: Elements.h:85
armarx::viz::Layer::add
void add(ElementT const &element)
Definition: Layer.h:29
MiscLib::Vector
Definition: Vector.h:19
armarx::viz::ElementOps::colorGlasbeyLUT
DerivedT & colorGlasbeyLUT(std::size_t id, int alpha=255)
Definition: ElementOps.h:208
armarx::RemoteGui::makeSimpleGridLayout
detail::SimpleGridLayoutBuilder makeSimpleGridLayout(std::string const &name="")
Definition: LayoutWidgets.h:235
armarx::viz::Sphere
Definition: Elements.h:134
armarx::RobotStateComponentPluginUser::addRobot
VirtualRobot::RobotPtr addRobot(const std::string &id, const VirtualRobot::RobotPtr &robot, const VirtualRobot::RobotNodeSetPtr &rns={}, const VirtualRobot::RobotNodePtr &node={})
Definition: RobotStateComponentPlugin.cpp:331
armarx::RobotStateComponentPluginUser::synchronizeLocalClone
bool synchronizeLocalClone(const VirtualRobot::RobotPtr &robot) const
Definition: RobotStateComponentPlugin.cpp:371
armarx::EfficientRANSACPrimitiveExtractor::getDefaultName
std::string getDefaultName() const override
Definition: EfficientRANSACPrimitiveExtractor.cpp:114
armarx::viz::ElementOps::position
DerivedT & position(float x, float y, float z)
Definition: ElementOps.h:127
RansacShapeDetector::Options::m_normalThresh
float m_normalThresh
Definition: RansacShapeDetector.h:35
armarx::armem::client::util::swap
void swap(SubscriptionHandle &first, SubscriptionHandle &second)
Definition: SubscriptionHandle.cpp:66
CylinderPrimitiveShape
class DLL_LINKAGE CylinderPrimitiveShape
Definition: PrimitiveShapeVisitor.h:10
armarx::RemoteGui::TabProxy
Definition: WidgetProxy.h:17
RansacShapeDetector
Definition: RansacShapeDetector.h:19
ARMARX_TRACE
#define ARMARX_TRACE
Definition: trace.h:69
GfxTL::Identity
void Identity(MatrixXX< N, N, T > *a)
Definition: MatrixXX.h:523
armarx::EfficientRANSACPrimitiveExtractor::onDisconnectPointCloudProcessor
void onDisconnectPointCloudProcessor() override
Implement this method in the PointCloudProcessor in order execute parts when the component looses net...
Definition: EfficientRANSACPrimitiveExtractor.cpp:157
cxxopts::value
std::shared_ptr< Value > value()
Definition: cxxopts.hpp:926
armarx::RemoteGui::TabProxy::receiveUpdates
void receiveUpdates()
Definition: WidgetProxy.h:131
armarx::RemoteGui::makeIntSpinBox
detail::IntSpinBoxBuilder makeIntSpinBox(std::string const &name)
Definition: IntegerWidgets.h:38
visionx::PointCloudProcessor::provideResultPointClouds
void provideResultPointClouds(const PointCloudPtrT &pointClouds, std::string providerName="")
sends result PointClouds for visualization
Definition: PointCloudProcessor.h:286
armarx::EfficientRANSACPrimitiveExtractorPropertyDefinitions
Property definitions of EfficientRANSACPrimitiveExtractor.
Definition: EfficientRANSACPrimitiveExtractor.h:45
FramedPose.h
armarx::viz::PointCloud::pointSizeInPixels
PointCloud & pointSizeInPixels(float s)
Definition: PointCloud.h:55
armarx::EfficientRANSACPrimitiveExtractor::onInitPointCloudProcessor
void onInitPointCloudProcessor() override
Setup the vision component.
Definition: EfficientRANSACPrimitiveExtractor.cpp:119
armarx::viz::Cylinder
Definition: Elements.h:74
RemoteGui.h
RansacShapeDetector::Options
Definition: RansacShapeDetector.h:22
visionx::PointCloudProcessor::waitForPointClouds
bool waitForPointClouds(int milliseconds=1000)
Wait for new PointClouds.
Definition: PointCloudProcessor.cpp:433
CylinderPrimitiveShape.h
result_name_filtered
#define result_name_filtered
Definition: EfficientRANSACPrimitiveExtractor.cpp:103
SpherePrimitiveShape
class DLL_LINKAGE SpherePrimitiveShape
Definition: PrimitiveShapeVisitor.h:9
armarx::viz::PointCloud
Definition: PointCloud.h:21
armarx::viz::Polygon
Definition: Elements.h:258
PlanePrimitiveShapeConstructor
Definition: PlanePrimitiveShapeConstructor.h:9
armarx::RemoteGui::detail::SimpleGridLayoutBuilder::addTextLabel
SimpleGridLayoutBuilder & addTextLabel(std::string const &text, int colspan)
Definition: LayoutWidgets.h:130
visionx::PointCloudProcessor::getPointClouds
int getPointClouds(const PointCloudPtrT &pointCloudPtr)
Poll PointClouds from provider.
Definition: PointCloudProcessor.h:373
SpherePrimitiveShapeConstructor.h
armarx::EfficientRANSACPrimitiveExtractor::createPropertyDefinitions
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: EfficientRANSACPrimitiveExtractor.cpp:187
armarx::to_string
const std::string & to_string(const std::string &s)
Definition: StringHelpers.h:40
armarx::WidgetDescription::WidgetPtr
::IceInternal::Handle<::armarx::WidgetDescription::Widget > WidgetPtr
Definition: NJointControllerBase.h:66
armarx::EfficientRANSACPrimitiveExtractorPropertyDefinitions::EfficientRANSACPrimitiveExtractorPropertyDefinitions
EfficientRANSACPrimitiveExtractorPropertyDefinitions(std::string prefix)
Definition: EfficientRANSACPrimitiveExtractor.cpp:107
armarx::RemoteGui::TabProxy::getValue
ValueProxy< T > getValue(std::string const &name)
Definition: WidgetProxy.h:161
RansacShapeDetector::Options::m_probability
float m_probability
Definition: RansacShapeDetector.h:39
PointCloud
Definition: PointCloud.h:69
RansacShapeDetector::Options::m_minSupport
unsigned int m_minSupport
Definition: RansacShapeDetector.h:36
armarx::Component::getConfigIdentifier
std::string getConfigIdentifier()
Retrieve config identifier for this component as set in constructor.
Definition: Component.cpp:74
armarx::EfficientRANSACPrimitiveExtractor::buildGui
RemoteGui::WidgetPtr buildGui()
Definition: EfficientRANSACPrimitiveExtractor.cpp:40
GfxTL::Matrix4f
MatrixXX< 4, 4, float > Matrix4f
Definition: MatrixXX.h:601
armarx::EfficientRANSACPrimitiveExtractor::processGui
void processGui(RemoteGui::TabProxy &prx)
Definition: EfficientRANSACPrimitiveExtractor.cpp:82
ARMARX_INFO
#define ARMARX_INFO
Definition: Logging.h:174
RansacShapeDetector::Options::m_maxruntime
std::chrono::milliseconds m_maxruntime
Definition: RansacShapeDetector.h:40
armarx::EfficientRANSACPrimitiveExtractor::onExitPointCloudProcessor
void onExitPointCloudProcessor() override
Exit the ImapeProcessor component.
Definition: EfficientRANSACPrimitiveExtractor.cpp:161
armarx::ArVizComponentPluginUser::arviz
armarx::viz::Client arviz
Definition: ArVizComponentPlugin.h:43
RansacShapeDetector::Options::m_epsilon
float m_epsilon
Definition: RansacShapeDetector.h:34
VAROUT
#define VAROUT(x)
Definition: StringHelpers.h:182
ConePrimitiveShapeConstructor.h
armarx::DebugObserverComponentPluginUser::sendDebugObserverBatch
void sendDebugObserverBatch()
Definition: DebugObserverComponentPlugin.cpp:122
IceUtil::Handle< class PropertyDefinitionContainer >
armarx::RemoteGui::detail::SimpleGridLayoutBuilder::cols
SimpleGridLayoutBuilder & cols(int n)
Definition: LayoutWidgets.h:108
visionx::PointCloudProcessor::usingPointCloudProvider
void usingPointCloudProvider(std::string providerName)
Registers a delayed topic subscription and a delayed provider proxy retrieval which will be available...
Definition: PointCloudProcessor.cpp:261
PointCloud.h
armarx::RemoteGui::TabProxy::sendUpdates
void sendUpdates()
Definition: WidgetProxy.h:146
armarx::Logging::deactivateSpam
SpamFilterDataPtr deactivateSpam(float deactivationDurationSec=10.0f, const std::string &identifier="", bool deactivate=true) const
disables the logging for the current line for the given amount of seconds.
Definition: Logging.cpp:92
visionx::PointCloudProcessor::getPointCloudProvider
PointCloudProviderInfo getPointCloudProvider(std::string name, bool waitForProxy=false)
Select an PointCloudProvider.
Definition: PointCloudProcessor.cpp:304
GfxTL::Vec3f
VectorXD< 3, float > Vec3f
Definition: VectorXD.h:691
EfficientRANSACPrimitiveExtractor.h
armarx::RemoteGuiComponentPluginUser::createOrUpdateRemoteGuiTab
void createOrUpdateRemoteGuiTab(Ts &&...ts)
Definition: RemoteGuiComponentPlugin.h:255
pc
Introduction Thank you for taking interest in our work and downloading this software This library implements the algorithm described in the paper R R R Klein Efficient RANSAC for Point Cloud Shape in Computer Graphics Blackwell June If you use this software you should cite the aforementioned paper in any resulting publication Please send comments or bug reports to Ruwen Roland BUT NOT LIMITED THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY OR CONSEQUENTIAL WHETHER IN STRICT OR EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE Example usage This section shows how to use the library to detect the shapes in a point cloud PointCloud pc
Definition: ReadMe.txt:68
armarx::viz::Color::green
static Color green(int g=255, int a=255)
Definition: Color.h:84
armarx::viz::PointCloud::addPoint
PointCloud & addPoint(ColoredPoint const &p)
Definition: PointCloud.h:83
armarx::TripleBuffer::getUpToDateReadBuffer
const T & getUpToDateReadBuffer() const
Definition: TripleBuffer.h:108
ARMARX_WARNING
#define ARMARX_WARNING
Definition: Logging.h:186
armarx::viz::Client::layer
Layer layer(std::string const &name) const
Definition: Client.cpp:73
ConePrimitiveShape.h
armarx::PropertyDefinitionsPtr
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
Definition: forward_declarations.h:34
armarx::ArVizComponentPluginUser::createArVizClient
armarx::viz::Client createArVizClient()
Definition: ArVizComponentPlugin.cpp:79
remaining
size_t remaining
Definition: ReadMe.txt:93
armarx::viz::Layer
Definition: Layer.h:12
detector
RansacShapeDetector detector(ransacOptions)
armarx::RemoteGui::makeFloatSpinBox
detail::FloatSpinBoxBuilder makeFloatSpinBox(std::string const &name)
Definition: FloatWidgets.h:52
shapes
MiscLib::Vector< std::pair< MiscLib::RefCountPtr< PrimitiveShape >, size_t > > shapes
Definition: ReadMe.txt:92
armarx::ctrlutil::s
double s(double t, double s0, double v0, double a0, double j)
Definition: CtrlUtil.h:33
CylinderPrimitiveShapeConstructor
Definition: CylinderPrimitiveShapeConstructor.h:10
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
PlanePrimitiveShape
class DLL_LINKAGE PlanePrimitiveShape
Definition: PrimitiveShapeVisitor.h:8
dt
constexpr T dt
Definition: UnscentedKalmanFilterTest.cpp:42
TorusPrimitiveShapeConstructor.h
armarx::DebugObserverComponentPluginUser::setDebugObserverDatafield
void setDebugObserverDatafield(Ts &&...ts) const
Definition: DebugObserverComponentPlugin.h:97
armarx::viz::PointCloud::transparency
PointCloud & transparency(float t)
Definition: PointCloud.h:48
ransacOptions
RansacShapeDetector::Options ransacOptions
Definition: ReadMe.txt:74
RansacShapeDetector::Add
void Add(PrimitiveShapeConstructor *c)
Definition: RansacShapeDetector.cpp:46