-
Notifications
You must be signed in to change notification settings - Fork 703
Better constructor for Segmentation #39
base: master
Are you sure you want to change the base?
Conversation
All of these can throw C++ exceptions when running out of memory.
Inheritance isn't very important in Python anyway, because of duck-typing.
It took me a while to figure out that the SAC* constants go with Segmentation. They're now coupled explicitly.
Hi Lars, Just letting you know I have visitors and holidays for the next 2 weeks, so One approach I sometimes use to maintain some backward compatibility is to Other than that I agree that getting to a simpler more pythonic api is a John
|
seg = p.make_segmenter() | ||
seg.set_model_type(pcl.SACMODEL_PLANE) | ||
seg.set_method_type(pcl.SAC_RANSAC) | ||
seg = pcl.Segmentation(p, model='plane', method='ransac') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this really an improvment? using string as identifiers is bug prone and deacreses readability.
Would be better to put the model names in an enum og simply a class
In the spirit of dea63de, here's an (IMHO) cleaner and more Pythonic way to construct a
Segmentation
object: a proper constructor instead of a factory function on a different class and a bunch of setters (ugh). Introducing a factory function onPointCloud
for each and every other class is introducing so much coupling that in the long run it's just not going to work.I'm doing my best to preserve compatibility with these changes, but the factory functions are tying down our implementation choices. I'd love to split off
Segmentation
into a separate module and implement the constructor in Python to keep build times and object sizes down, i.e.... but currently that would lead to circular dependencies because
PointCloud.make_segmenter
needs to know aboutSegmentation
, and vice-versaSegmentation
needs to know aboutPointCloud
.This change is![Reviewable](https://camo.githubusercontent.com/1541c4039185914e83657d3683ec25920c672c6c5c7ab4240ee7bff601adec0b/68747470733a2f2f72657669657761626c652e696f2f7265766965775f627574746f6e2e737667)