61 template<
class DataPo
int=std::vector<
float>,
62 class Model=std::vector<
float> >
121 static inline bool find_in(
const std::vector<int> &v,
int i,
int n){
122 return std::find(v.data(), v.data()+n, i) != v.data()+n;
128 std::vector<int> &usedIndices){
130 currConsensusSet, usedIndices);
155 int minClosePointsForGoodModel,
186 for(
int j=0;j<(int)allPoints.size();++j){
187 if(
find_in(usedIndices, j, usedIndices.size()))
continue;
189 consensusSet.push_back(allPoints[j]);
197 for(
unsigned int j=0;j<consensusSet.size();++j){
200 error /= consensusSet.size();
PointError m_err
point-model error function
Definition: RansacFitter.h:91
DataSet consensusSet
consensus set of best match (i.e. inliers)
Definition: RansacFitter.h:107
icl64f m_maxModelDistance
maximum distance of a point to the model to become an inlier
Definition: RansacFitter.h:82
undocument this line if you encounter any issues!
Definition: Any.h:37
Model model
model (zero sized if no model was found)
Definition: RansacFitter.h:103
bool found() const
returns whether any model was found
Definition: RansacFitter.h:113
std::vector< T > get_random_subset(const std::vector< T > &s, int subsetSize)
Definition: Random.h:223
int iterationCount
number of iterations needed
Definition: RansacFitter.h:110
int m_iterations
number of iterations
Definition: RansacFitter.h:79
RansacFitter()
empty constructor (creates a dummy instance)
Definition: RansacFitter.h:145
std::vector< DataPoint > DataSet
DataSet type (just a set of DataPoint instances)
Definition: RansacFitter.h:66
utils::Function< Model, const DataSet & > ModelFitting
Function for the fitting module (gets a dataset and returns the fitted model)
Definition: RansacFitter.h:69
icl64f error
reached error
Definition: RansacFitter.h:100
icl64f m_minErrorExit
min error criterion for early exit
Definition: RansacFitter.h:94
Ipp64f icl64f
64Bit floating point type for the ICL
Definition: BasicTypes.h:52
int m_minClosePointsForGoodModel
minimum amount of inliers for a 'good' model
Definition: RansacFitter.h:85
ICLCV_API void error(const char *msg)
Display error message and terminate program.
ModelFitting m_fitting
fitting function
Definition: RansacFitter.h:88
result structure
Definition: RansacFitter.h:98
int m_minPointsForModel
minimum points that are used to create a coarse model
Definition: RansacFitter.h:76
const Result & fit(const DataSet &allPoints)
fitting function (actual RANSAC algorithm)
Definition: RansacFitter.h:166
RansacFitter(int minPointsForModel, int iterations, ModelFitting fitting, PointError err, icl64f maxModelDistance, int minClosePointsForGoodModel, icl64f minErrorExit=0)
constructor with given parameters
Definition: RansacFitter.h:150
static bool find_in(const std::vector< int > &v, int i, int n)
internal utility method
Definition: RansacFitter.h:121
void find_random_consensus_set(DataSet &currConsensusSet, const DataSet &allPoints, std::vector< int > &usedIndices)
internal utility method
Definition: RansacFitter.h:126
utils::Function< icl64f, const Model &, const DataPoint & > PointError
Error function for single points.
Definition: RansacFitter.h:72
Generic RANSAC (RAndom SAmpling Consensus) Implementation.
Definition: RansacFitter.h:63
Result m_result
internal result buffer
Definition: RansacFitter.h:118