Skip to content

Commit

Permalink
minor enhancement. use iota in maxconsensus and add a missing templat…
Browse files Browse the repository at this point in the history
…e alias in the two view kernel.
  • Loading branch information
pmoulon committed Apr 21, 2016
1 parent 3d3a75b commit 0a3d408
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 3 additions & 1 deletion src/openMVG/multiview/two_view_kernel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ class Kernel {
Kernel(const Mat &x1, const Mat &x2) : x1_(x1), x2_(x2) {}
typedef SolverArg Solver;
typedef ModelArg Model;
typedef ErrorArg ErrorT;

/// The minimal number of point required for the model estimation
enum { MINIMUM_SAMPLES = Solver::MINIMUM_SAMPLES };
/// The number of models that the minimal solver could return.
Expand All @@ -90,7 +92,7 @@ class Kernel {
size_t NumSamples() const {
return x1_.cols();
}
/// Compute a model on sampled point
/// Compute a model on sampled datum
static void Solve(const Mat &x1, const Mat &x2, vector<Model> *models) {
// By offering this, Kernel types can be passed to templates.
Solver::Solve(x1, x2, models);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,12 @@ typename Kernel::Model MaxConsensus(const Kernel &kernel,

// In this robust estimator, the scorer always works on all the data points
// at once. So precompute the list ahead of time.
std::vector<size_t> all_samples;
for (size_t i = 0; i < total_samples; ++i) {
all_samples.push_back(i);
}
std::vector<size_t> all_samples(total_samples);
std::iota(all_samples.begin(), all_samples.end(), 0);

std::vector<size_t> sample;
for (size_t iteration = 0; iteration < max_iteration; ++iteration) {
UniformSample(min_samples, total_samples, &sample);
UniformSample(min_samples, total_samples, &sample);

std::vector<typename Kernel::Model> models;
kernel.Fit(sample, &models);
Expand Down

0 comments on commit 0a3d408

Please sign in to comment.