Go to the documentation of this file.
46 if (samples.
size() < 6)
50 return Init(samples[0], samples[1], samples[2]);
56 if (samples.
size() < 1)
62 size_t c = samples.
size() / 2;
64 for (intptr_t i = 0; i <
c; ++i)
89 for (
size_t j = 0; j < 3; ++j)
94 for (
size_t j = 0; j < 3; ++j)
105 for (
int i = 0; i < 3; i++)
108 m_pos[i] = array[i + 4];
128 template <
class WeightT>
147 template <
class IteratorT>
156 int size = end - begin;
157 #pragma omp parallel for schedule(static) reduction(+ : chi)
158 for (
int idx = 0; idx < size; ++idx)
160 temp[idx] = params[0] * begin[idx][0] + params[1] * begin[idx][1] +
161 params[2] * begin[idx][2] - params[3];
162 chi += (
values[idx] = WeightT::Weigh(temp[idx])) *
values[idx];
167 template <
class IteratorT>
176 int size = end - begin;
177 #pragma omp parallel for schedule(static)
178 for (
int idx = 0; idx < size; ++idx)
180 matrix[idx *
NumParams + 0] = begin[idx][0];
181 matrix[idx *
NumParams + 1] = begin[idx][1];
182 matrix[idx *
NumParams + 2] = begin[idx][2];
184 WeightT::template DerivWeigh<NumParams>(temp[idx], matrix + idx *
NumParams);
192 std::sqrt(params[0] * params[0] + params[1] * params[1] + params[2] * params[2]);
213 Vec3f normal(0, 0, 0);
214 Vec3f position(0, 0, 0);
215 for (
size_t i = 0; i < planes.
size(); ++i)
217 normal += weights[i] * planes[i].getNormal();
218 position += weights[i] * planes[i].getPosition();
221 *ip =
Plane(position, normal);
239 <<
"d " <<
m_dist << std::endl
241 for (
size_t i = 0; i < 3; ++i)
243 (*o) <<
m_pos[i] <<
" ";
250 for (
size_t i = 0; i < 3; ++i)
252 (*o) <<
m_pos[i] <<
" ";
261 return sizeof(
Vec3f) +
sizeof(
float) +
sizeof(
Vec3f);
273 for (
int i = 0; i < 3; i++)
276 array[i + 4] =
m_pos[i];
VectorXD< 3, float > Vec3f
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
VectorXD< 3, float > Vector3Df
bool InitAverage(const MiscLib::Vector< Vec3f > &samples)
static size_t SerializedSize()
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)
Point cross(const Point &x, const Point &y)
IndexedIterator< IndexIteratorT, IteratorT > IndexIterate(IndexIteratorT idxIt, IteratorT it)
static size_t SerializedFloatSize()
bool Init(Vec3f p1, Vec3f p2, Vec3f p3)
VectorXD< D, T > sqrt(const VectorXD< D, T > &a)
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
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)