You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.6 KiB
C

/*!
* \file FitWeighted.h
* \date 2018/03/15
*
* \author Lin, Chi
* Contact: lin.chi@hzleaper.com
*
*
* \note
*/
#ifndef __FitWeighted_h_
#define __FitWeighted_h_
#include "CVUtils.h"
#include "CyclopsEnums.h"
#include "StdUtils.h"
#if defined(LITTLE_CPP11)
enum CalcWeightDistType
#else
enum class CalcWeightDistType
#endif
{
Binary = 0,
L1,
L2
};
void calcWeightL2(int count, float* dists, float* weights, float skipThreshold = -1);
void calcWeightL1(int count, float* dists, float* weights, float skipThreshold = -1);
void calcWeightThres(int count, float* dists, float* weights, float skipThreshold = -1);
typedef std::function<void(int, float*, float*, float)> CalcWeightFunc;
CalcWeightFunc getCalcWeightFunc(CalcWeightDistType distType, float skipThreshold);
// return@ here we will return the num of those points involved with fitting
// -1 means failure of detection
CYCLOPS_GEOM_DLLSPEC int fitLineWeighted(const vector<Vec3f>& points, Vec4f& line,
CalcWeightDistType distType,
float skipThreshold = -1, // -1 for none, positive value for the max distance of points contribute the iteration
int maxIterCount = 10,
float epsEach = 1.f, // final eps = epsEach * point_count
float termPrecision = 0.01f,
int minFitCount = 2
);
CYCLOPS_GEOM_DLLSPEC int fitCircleWeighted(const vector<Vec3f>& points, Vec3f& circle,
CircleFitAlgo algo,
CalcWeightDistType distType,
float skipThreshold = -1, // -1 for none, positive value for the max distance of points contribute the iteration
int maxIterCount = 10,
float epsEach = 1.f, // final eps = epsEach * point_count
int minFitCount = 3
);
#endif // __FitWeighted_h_