Go to the documentation of this file.
44 if (samples.
size() < 6)
48 return Init(samples[0], samples[1], samples[2]);
53 if (samples.
size() < 1)
59 size_t c = samples.
size() / 2;
61 for (intptr_t i = 0; i <
c; ++i)
85 for (
size_t j = 0; j < 3; ++j)
90 for (
size_t j = 0; j < 3; ++j)
100 for (
int i = 0; i < 3; i++)
103 m_pos[i] = array[i + 4];
121 template<
class WeightT >
135 template<
class IteratorT >
140 int size = end - begin;
141 #pragma omp parallel for schedule(static) reduction(+:chi)
142 for (
int idx = 0; idx < size; ++idx)
144 temp[idx] = params[0] * begin[idx][0] + params[1] * begin[idx][1]
145 + params[2] * begin[idx][2] - params[3];
146 chi += (
values[idx] = WeightT::Weigh(temp[idx]))
152 template<
class IteratorT >
156 int size = end - begin;
157 #pragma omp parallel for schedule(static)
158 for (
int idx = 0; idx < size; ++idx)
160 matrix[idx *
NumParams + 0] = begin[idx][0];
161 matrix[idx *
NumParams + 1] = begin[idx][1];
162 matrix[idx *
NumParams + 2] = begin[idx][2];
164 WeightT::template DerivWeigh< NumParams >(temp[idx],
172 + params[1] * params[1] + params[2] * params[2]);
191 Vec3f normal(0, 0, 0);
192 Vec3f position(0, 0, 0);
193 for (
size_t i = 0; i < planes.
size(); ++i)
195 normal += weights[i] * planes[i].getNormal();
196 position += weights[i] * planes[i].getPosition();
199 *ip =
Plane(position, normal);
216 <<
"d " <<
m_dist << std::endl
218 for (
size_t i = 0; i < 3; ++i)
220 (*o) <<
m_pos[i] <<
" ";
228 for (
size_t i = 0; i < 3; ++i)
230 (*o) <<
m_pos[i] <<
" ";
250 for (
int i = 0; i < 3; i++)
253 array[i + 4] =
m_pos[i];
VectorXD< D, T > sqrt(const VectorXD< D, T > &a)
ScalarType Chi(const ScalarType *params, IteratorT begin, IteratorT end, ScalarType *values, ScalarType *temp) const
bool LeastSquaresFit(const PointCloud &pc, MiscLib::Vector< size_t >::const_iterator begin, MiscLib::Vector< size_t >::const_iterator end)
static bool Interpolate(const MiscLib::Vector< Plane > &planes, const MiscLib::Vector< float > &weights, Plane *ip)
void Transform(float scale, const Vec3f &translate)
void Derivatives(const ScalarType *params, IteratorT begin, IteratorT end, const ScalarType *values, const ScalarType *temp, ScalarType *matrix) const
bool InitAverage(const MiscLib::Vector< Vec3f > &samples)
static size_t SerializedSize()
VectorXD< 3, float > Vector3Df
const Vec3f & getPosition() const
void Mean(PointsForwardIt begin, PointsForwardIt end, WeightsForwardIt weights, PointT *mean)
std::optional< float > mean(const boost::circular_buffer< NameValueMap > &buffer, const std::string &key)
IndexedIterator< IndexIteratorT, IteratorT > IndexIterate(IndexIteratorT idxIt, IteratorT it)
Point cross(const Point &x, const Point &y)
static size_t SerializedFloatSize()
bool Init(Vec3f p1, Vec3f p2, Vec3f p3)
float Intersect(const Vec3f &p, const Vec3f &r) const
float dot(const Vec3f &v) const
float SignedDistance(const Vec3f &pos) const
const Vec3f & getNormal() const
void Serialize(bool binary, std::ostream *o) const
void Normalize(ScalarType *params) const
VectorXD< 3, float > Vec3f
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
float getDistance(const Vec3f &pos) const
bool MeanOfNormals(NormalsItT begin, NormalsItT end, WeightsItT weights, MeanT *mean)