Go to the documentation of this file.
14 m_torus(torus), m_parametrization(m_torus)
21 m_parametrization.
Shape(m_torus);
52 m_torus.
Normal(p, &normal);
59 std::pair<float, float>* dn)
const
63 dn->second =
n.dot(normal);
86 return BasePrimitiveShape::ConfidenceTests<Torus>(
87 numTests, epsilon, normalThresh, rms,
pc,
indices);
93 std::ostringstream ostr;
110 m_parametrization.
Shape(m_torus);
122 std::pair<size_t, float>* score)
const
164 m_torus.
Init(binary, i);
165 m_parametrization.
Shape(m_torus);
184 visitor->
Visit(*
this);
202 for (
unsigned int i = 0; i < 5; ++i, u += uStep)
205 for (
unsigned int j = 0; j < 5; ++j,
v += vStep)
219 size_t c = samples.
size() / 2;
226 for (
size_t i = 0; i <
c; ++i)
227 if (cone.
Distance(samples[i]) > distThresh)
235 suggestions->back()->Release();
243 for (
size_t i = 0; i <
c; ++i)
244 if (cylinder.
Distance(samples[i]) > distThresh)
252 suggestions->back()->Release();
256 if (sphere.
Init(samples))
260 for (
size_t i = 0; i <
c; ++i)
261 if (sphere.
Distance(samples[i]) > distThresh)
269 suggestions->back()->Release();
276 for (
size_t i = 0; i <
c; ++i)
277 if (plane.
Distance(samples[i]) > distThresh)
285 suggestions->back()->Release();
385 ParametersImpl(begin, end, bmpParams);
394 ParametersImpl(begin, end, bmpParams);
400 return m_parametrization.
InSpace(u,
v, p,
n);
410 *uextent = std::ceil((bbox->
Max()[0] - bbox->
Min()[0]) / epsilon);
411 *vextent = std::ceil((bbox->
Max()[1] - bbox->
Min()[1]) / epsilon);
420 std::pair<int, int>* inBmp)
const
422 inBmp->first = std::floor((param.first - bbox.
Min()[0]) / epsilon);
423 inBmp->second = std::floor((param.second - bbox.
Min()[1]) / epsilon);
432 m_parametrization.
WrapBitmap(bbox, epsilon, uwrap, vwrap);
443 m_parametrization.
WrapComponents(bbox, epsilon, uextent, vextent, componentImg, labels);
466 return m_parametrization.
InSpace(
467 (u + .5f) * epsilon + bbox.
Min()[0], (
v + .5f) * epsilon + bbox.
Min()[1], p,
n);
float SignedDistance(const Vec3f &p) const
virtual void Visit(const PlanePrimitiveShape &plane)=0
void Visit(PrimitiveShapeVisitor *visitor) const
size_t SerializedSize() const
const float MinorRadius() const
void Normal(const Vec3f &p, Vec3f *n) const
void SuggestSimplifications(const PointCloud &pc, MiscLib::Vector< size_t >::const_iterator begin, MiscLib::Vector< size_t >::const_iterator end, float distThresh, MiscLib::Vector< MiscLib::RefCountPtr< PrimitiveShape >> *suggestions) const
float Distance(const Vec3f &p) const
float NormalDeviation(const Vec3f &p, const Vec3f &n) const
float Distance(const Vec3f &p) const
float SignedDistance(const Vec3f &p) const
bool LeastSquaresFit(const PointCloud &pc, MiscLib::Vector< size_t >::const_iterator begin, MiscLib::Vector< size_t >::const_iterator end)
bool LeastSquaresFit(const PointCloud &pc, MiscLib::Vector< size_t >::const_iterator begin, MiscLib::Vector< size_t >::const_iterator end)
void WrapComponents(const GfxTL::AABox< GfxTL::Vector2Df > &bbox, float epsilon, size_t uextent, size_t vextent, MiscLib::Vector< int > *componentImg, MiscLib::Vector< std::pair< int, size_t >> *labels) const
bool Fit(const PointCloud &pc, float epsilon, float normalThresh, MiscLib::Vector< size_t >::const_iterator begin, MiscLib::Vector< size_t >::const_iterator end)
PrimtiveShape is a shape primitive in conjunction with a parametrization.
bool InSpace(float u, float v, Vec3f *p) const
void Parameters(const Vec3f &p, std::pair< float, float > *param) const
void Optimize(IteratorT begin, IteratorT end, float epsilon)
void WrapBitmap(const GfxTL::AABox< GfxTL::Vector2Df > &bbox, float epsilon, bool *uwrap, bool *vwrap) const
constexpr auto n() noexcept
void Project(const Vec3f &p, Vec3f *pp) const
void Deserialize(std::istream *i, bool binary)
LevMarFunc< float > * SignedDistanceFunc() const
void Normal(const Vec3f &p, Vec3f *n) const
float Distance(const Vec3f &p) const
class DLL_LINKAGE ConePrimitiveShape
float Distance(const Vec3f &p) const
const typedef Point * const_iterator
class DLL_LINKAGE CylinderPrimitiveShape
void Transform(float scale, const Vec3f &translate)
pcl::PointIndices::Ptr indices(const PCG &g)
Retrieve the indices of the points of the point cloud stored in a point cloud graph that actually bel...
float Distance(const Vec3f &pos) const
bool LeastSquaresFit(const PointCloud &pc, MiscLib::Vector< size_t >::const_iterator begin, MiscLib::Vector< size_t >::const_iterator end)
float DistanceAndNormal(const Vec3f &p, Vec3f *n) const
bool InitAverage(const MiscLib::Vector< Vec3f > &samples)
class DLL_LINKAGE SpherePrimitiveShape
void Deserialize(std::istream *i, bool binary)
void WrapComponents(const GfxTL::AABox< GfxTL::Vector2Df > &bbox, float epsilon, size_t uextent, size_t vextent, MiscLib::Vector< int > *componentImg, MiscLib::Vector< std::pair< int, size_t >> *labels) const
IndexedIterator< IndexIteratorT, IteratorT > IndexIterate(IndexIteratorT idxIt, IteratorT it)
GfxTL::AABox< GfxTL::Vector2Df > m_extBbox
void Serialize(bool binary, std::ostream *o) const
void Description(std::string *s) const
void Serialize(std::ostream *o, bool binary) const
bool InitAverage(const MiscLib::Vector< Vec3f > &samples)
void DistanceAndNormalDeviation(const Vec3f &p, const Vec3f &n, std::pair< float, float > *dn) const
float Distance(const Vec3f &p) const
static size_t SerializedSize()
void BitmapExtent(float epsilon, GfxTL::AABox< GfxTL::Vector2Df > *bbox, MiscLib::Vector< std::pair< float, float >> *params, size_t *uextent, size_t *vextent)
bool Init(const MiscLib::Vector< Vec3f > &samples)
PrimitiveShape * LSFit(const PointCloud &pc, float epsilon, float normalThresh, MiscLib::Vector< size_t >::const_iterator begin, MiscLib::Vector< size_t >::const_iterator end, std::pair< size_t, float > *score) const
void InBitmap(const std::pair< float, float > ¶m, float epsilon, const GfxTL::AABox< GfxTL::Vector2Df > &bbox, size_t uextent, size_t vextent, std::pair< int, int > *inBmp) const
void Transform(float scale, const Vec3f &translate)
void Project(const Vec3f &p, Vec3f *pp) const
double v(double t, double v0, double a0, double j)
bool InSpace(float u, float v, Vec3f *p, Vec3f *n) const
bool Init(const MiscLib::Vector< Vec3f > &samples)
void WrapBitmap(const GfxTL::AABox< GfxTL::Vector2Df > &bbox, float epsilon, bool *uwrap, bool *vwrap) const
PrimitiveShape * Clone() const
static size_t SerializedSize()
unsigned int ConfidenceTests(unsigned int numTests, float epsilon, float normalThresh, float rms, const PointCloud &pc, const MiscLib::Vector< size_t > &indices) const
bool Similar(float tolerance, const TorusPrimitiveShape &shape) const
void Parameters(const Vec3f &p, std::pair< float, float > *param) const
const float MajorRadius() const
MiscLib::performance_t totalTime_torusConnected
bool LeastSquaresFit(const PointCloud &pc, MiscLib::Vector< size_t >::const_iterator begin, MiscLib::Vector< size_t >::const_iterator end)
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
void OptimizeParametrization(const PointCloud &pc, size_t begin, size_t end, float epsilon)
size_t Identifier() const
double s(double t, double s0, double v0, double a0, double j)
class DLL_LINKAGE PlanePrimitiveShape
void SetExtent(const GfxTL::AABox< GfxTL::Vector2Df > &bbox, const MiscLib::Vector< int > &componentsImg, size_t uextent, size_t vextent, float epsilon, int label)
void Serialize(std::ostream *o, bool binary=true) const
This is the one and only serialization function It stores all the parameters of the shape as well as ...
bool LeastSquaresFit(const PointCloud &pc, MiscLib::Vector< size_t >::const_iterator begin, MiscLib::Vector< size_t >::const_iterator end)
void Shape(const Torus &torus)