Go to the documentation of this file.
13 , m_parametrization(m_torus)
18 , m_torus(tps.m_torus)
19 , m_parametrization(tps.m_parametrization)
21 m_parametrization.
Shape(m_torus);
48 m_torus.
Normal(p, &normal);
53 const Vec3f& n, std::pair< float, float >* dn)
const
57 dn->second = n.
dot(normal);
71 float epsilon,
float normalThresh,
float rms,
const PointCloud&
pc,
74 return BasePrimitiveShape::ConfidenceTests< Torus >(numTests, epsilon,
80 std::ostringstream ostr;
96 m_parametrization.
Shape(m_torus);
105 std::pair< size_t, float >* score)
const
143 m_torus.
Init(binary, i);
144 m_parametrization.
Shape(m_torus);
160 visitor->
Visit(*
this);
175 for (
unsigned int i = 0; i < 5; ++i, u += uStep)
178 for (
unsigned int j = 0; j < 5; ++j,
v += vStep)
190 &samples[i * 5 + j + 25]);
193 size_t c = samples.
size() / 2;
200 for (
size_t i = 0; i <
c; ++i)
201 if (cone.
Distance(samples[i]) > distThresh)
209 suggestions->back()->Release();
217 for (
size_t i = 0; i <
c; ++i)
218 if (cylinder.
Distance(samples[i]) > distThresh)
226 suggestions->back()->Release();
230 if (sphere.
Init(samples))
234 for (
size_t i = 0; i <
c; ++i)
235 if (sphere.
Distance(samples[i]) > distThresh)
243 suggestions->back()->Release();
250 for (
size_t i = 0; i <
c; ++i)
251 if (plane.
Distance(samples[i]) > distThresh)
259 suggestions->back()->Release();
328 size_t begin,
size_t end,
float epsilon)
344 std::pair< float, float >* param)
const
356 ParametersImpl(begin, end, bmpParams);
366 ParametersImpl(begin, end, bmpParams);
371 return m_parametrization.
InSpace(u,
v, p, n);
377 size_t* uextent,
size_t* vextent)
379 *uextent = std::ceil((bbox->
Max()[0] - bbox->
Min()[0]) / epsilon);
380 *vextent = std::ceil((bbox->
Max()[1] - bbox->
Min()[1]) / epsilon);
385 size_t uextent,
size_t vextent,
386 std::pair< int, int >* inBmp)
const
388 inBmp->first = std::floor((param.first - bbox.
Min()[0]) / epsilon);
389 inBmp->second = std::floor((param.second - bbox.
Min()[1]) / epsilon);
394 float epsilon,
bool* uwrap,
bool* vwrap)
const
396 m_parametrization.
WrapBitmap(bbox, epsilon, uwrap, vwrap);
400 float epsilon,
size_t uextent,
size_t vextent,
405 componentImg, labels);
411 size_t vextent,
float epsilon,
int label)
418 return m_parametrization.
InSpace((u + .5f) * epsilon + bbox.
Min()[0],
419 (
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
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)
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 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
void Optimize(IteratorT begin, IteratorT end, float epsilon)
void WrapBitmap(const GfxTL::AABox< GfxTL::Vector2Df > &bbox, float epsilon, bool *uwrap, bool *vwrap) const
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
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
class DLL_LINKAGE CylinderPrimitiveShape
void Transform(float scale, const Vec3f &translate)
void BitmapExtent(float epsilon, GfxTL::AABox< GfxTL::Vector2Df > *bbox, MiscLib::Vector< std::pair< float, float > > *params, size_t *uextent, size_t *vextent)
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
IndexedIterator< IndexIteratorT, IteratorT > IndexIterate(IndexIteratorT idxIt, IteratorT it)
void Deserialize(std::istream *i, bool binary)
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()
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)
float dot(const Vec3f &v) const
bool InSpace(float u, float v, Vec3f *p, Vec3f *n) const
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 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)