Loading...
Searching...
No Matches
AbsolutePoseSacProblem.hpp
Go to the documentation of this file.
/******************************************************************************
* Author: Laurent Kneip *
* Contact: kneip.laurent@gmail.com *
* License: Copyright (c) 2013 Laurent Kneip, ANU. All rights reserved. *
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* * Redistributions of source code must retain the above copyright *
* notice, this list of conditions and the following disclaimer. *
* * Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* * Neither the name of ANU nor the names of its contributors may be *
* used to endorse or promote products derived from this software without *
* specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"*
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE *
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE *
* ARE DISCLAIMED. IN NO EVENT SHALL ANU OR THE CONTRIBUTORS BE LIABLE *
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL *
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR *
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER *
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT *
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY *
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF *
* SUCH DAMAGE. *
******************************************************************************/
#ifndef OPENGV_SAC_PROBLEMS_ABSOLUTE_POSE_ABSOLUTEPOSESACPROBLEM_HPP_
#define OPENGV_SAC_PROBLEMS_ABSOLUTE_POSE_ABSOLUTEPOSESACPROBLEM_HPP_
#include <opengv/sac/SampleConsensusProblem.hpp>
#include <opengv/types.hpp>
#include <opengv/absolute_pose/AbsoluteAdapterBase.hpp>
namespace opengv
{
namespace sac_problems
{
namespace absolute_pose
{
class AbsolutePoseSacProblem :
public sac::SampleConsensusProblem<transformation_t>
{
public:
typedef transformation_t model_t;
typedef opengv::absolute_pose::AbsoluteAdapterBase adapter_t;
typedef enum Algorithm
{
TWOPT = 0, // central, with rotation prior
KNEIP = 1, // central [1]
GAO = 2, // central [2]
EPNP = 3, // central [4]
GP3P = 4 // non-central [3]
} algorithm_t;
AbsolutePoseSacProblem(adapter_t & adapter, algorithm_t algorithm,
bool randomSeed = true) :
sac::SampleConsensusProblem<model_t> (randomSeed),
_adapter(adapter),
_algorithm(algorithm)
{
setUniformIndices(adapter.getNumberCorrespondences());
};
AbsolutePoseSacProblem(
adapter_t & adapter,
algorithm_t algorithm,
const std::vector<int> & indices,
bool randomSeed = true) :
sac::SampleConsensusProblem<model_t> (randomSeed),
_adapter(adapter),
_algorithm(algorithm)
{
setIndices(indices);
};
virtual ~AbsolutePoseSacProblem() {};
virtual bool computeModelCoefficients(
const std::vector<int> & indices,
model_t & outModel) const;
virtual void getSelectedDistancesToModel(
const model_t & model,
const std::vector<int> & indices,
std::vector<double> & scores) const;
virtual void optimizeModelCoefficients(
const std::vector<int> & inliers,
const model_t & model,
model_t & optimized_model);
virtual int getSampleSize() const;
protected:
adapter_t & _adapter;
algorithm_t _algorithm;
};
}
}
}
#endif //#ifndef OPENGV_SAC_PROBLEMS_ABSOLUTE_POSE_ABSOLUTEPOSESACPROBLEM_HPP_
AbsoluteAdapterBase.hpp
Adapter-class for passing bearing-vector-to-point correspondences to the absolute-pose algorithms.
SampleConsensusProblem.hpp
Basis-class for Sample-consensus problems. Contains declarations for the three basic functions of a s...
opengv::absolute_pose::AbsoluteAdapterBase
Definition AbsoluteAdapterBase.hpp:64
opengv::absolute_pose::AbsoluteAdapterBase::getNumberCorrespondences
virtual size_t getNumberCorrespondences() const =0
Retrieve the number of correspondences.
opengv::sac::SampleConsensusProblem
Definition SampleConsensusProblem.hpp:68
opengv::sac::SampleConsensusProblem< transformation_t >::setIndices
void setIndices(const std::vector< int > &indices)
opengv::sac::SampleConsensusProblem< transformation_t >::setUniformIndices
void setUniformIndices(int N)
opengv::sac::SampleConsensusProblem< transformation_t >::SampleConsensusProblem
SampleConsensusProblem(bool randomSeed=true)
opengv::sac_problems::absolute_pose::AbsolutePoseSacProblem::optimizeModelCoefficients
virtual void optimizeModelCoefficients(const std::vector< int > &inliers, const model_t &model, model_t &optimized_model)
See parent-class.
opengv::sac_problems::absolute_pose::AbsolutePoseSacProblem::AbsolutePoseSacProblem
AbsolutePoseSacProblem(adapter_t &adapter, algorithm_t algorithm, bool randomSeed=true)
Constructor.
Definition AbsolutePoseSacProblem.hpp:94
opengv::sac_problems::absolute_pose::AbsolutePoseSacProblem::computeModelCoefficients
virtual bool computeModelCoefficients(const std::vector< int > &indices, model_t &outModel) const
See parent-class.
opengv::sac_problems::absolute_pose::AbsolutePoseSacProblem::model_t
transformation_t model_t
Definition AbsolutePoseSacProblem.hpp:73
opengv::sac_problems::absolute_pose::AbsolutePoseSacProblem::algorithm_t
enum opengv::sac_problems::absolute_pose::AbsolutePoseSacProblem::Algorithm algorithm_t
opengv::sac_problems::absolute_pose::AbsolutePoseSacProblem::_algorithm
algorithm_t _algorithm
Definition AbsolutePoseSacProblem.hpp:161
opengv::sac_problems::absolute_pose::AbsolutePoseSacProblem::AbsolutePoseSacProblem
AbsolutePoseSacProblem(adapter_t &adapter, algorithm_t algorithm, const std::vector< int > &indices, bool randomSeed=true)
Constructor.
Definition AbsolutePoseSacProblem.hpp:112
opengv::sac_problems::absolute_pose::AbsolutePoseSacProblem::Algorithm
Algorithm
Definition AbsolutePoseSacProblem.hpp:79
opengv::sac_problems::absolute_pose::AbsolutePoseSacProblem::getSampleSize
virtual int getSampleSize() const
See parent-class.
opengv::sac_problems::absolute_pose::AbsolutePoseSacProblem::adapter_t
opengv::absolute_pose::AbsoluteAdapterBase adapter_t
Definition AbsolutePoseSacProblem.hpp:75
opengv::sac_problems::absolute_pose::AbsolutePoseSacProblem::_adapter
adapter_t & _adapter
Definition AbsolutePoseSacProblem.hpp:159
opengv::sac_problems::absolute_pose::AbsolutePoseSacProblem::getSelectedDistancesToModel
virtual void getSelectedDistancesToModel(const model_t &model, const std::vector< int > &indices, std::vector< double > &scores) const
See parent-class.
opengv::sac_problems::absolute_pose::AbsolutePoseSacProblem::~AbsolutePoseSacProblem
virtual ~AbsolutePoseSacProblem()
Definition AbsolutePoseSacProblem.hpp:127
opengv::sac_problems::absolute_pose
The namespace for the absolute pose methods.
Definition AbsolutePoseSacProblem.hpp:60
opengv::sac_problems
The namespace for the sample consensus problems.
Definition AbsolutePoseSacProblem.hpp:55
opengv::sac
The namespace for the sample consensus methods.
Definition Lmeds.hpp:53
opengv
The namespace of this library.
Definition AbsoluteAdapterBase.hpp:48
opengv::transformation_t
Eigen::Matrix< double, 3, 4 > transformation_t
Definition types.hpp:82
types.hpp
A collection of variables used in geometric vision for the computation of calibrated absolute and rel...