Loading...
Searching...
No Matches
MultiNoncentralRelativePoseSacProblem.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_RELATIVE_POSE_MULTINONCENTRALRELATIVEPOSESACPROBLEM_HPP_
#define OPENGV_SAC_PROBLEMS_RELATIVE_POSE_MULTINONCENTRALRELATIVEPOSESACPROBLEM_HPP_
#include <opengv/sac/MultiSampleConsensusProblem.hpp>
#include <opengv/types.hpp>
#include <opengv/relative_pose/RelativeMultiAdapterBase.hpp>
namespace opengv
{
namespace sac_problems
{
namespace relative_pose
{
class MultiNoncentralRelativePoseSacProblem :
public sac::MultiSampleConsensusProblem< transformation_t >
{
public:
typedef transformation_t model_t;
typedef opengv::relative_pose::RelativeMultiAdapterBase adapter_t;
typedef enum Algorithm
{
SIXPT = 0, // [16]
GE = 1, // []
SEVENTEENPT = 2 // [12]
} algorithm_t;
MultiNoncentralRelativePoseSacProblem(
adapter_t & adapter, algorithm_t algorithm, bool asCentral = false,
bool randomSeed = true) :
sac::MultiSampleConsensusProblem<model_t> (randomSeed),
_adapter(adapter),
_algorithm(algorithm),
_asCentral(asCentral)
{
std::vector<int> numberCorrespondences;
for(size_t i = 0; i < adapter.getNumberPairs(); i++)
numberCorrespondences.push_back(adapter.getNumberCorrespondences(i));
setUniformIndices(numberCorrespondences);
};
MultiNoncentralRelativePoseSacProblem(
adapter_t & adapter,
algorithm_t algorithm,
const std::vector<std::vector<int> > & indices,
bool asCentral = false,
bool randomSeed = true) :
sac::MultiSampleConsensusProblem<model_t> (randomSeed),
_adapter(adapter),
_algorithm(algorithm),
_asCentral(asCentral)
{
setIndices(indices);
};
virtual ~MultiNoncentralRelativePoseSacProblem() {};
virtual bool computeModelCoefficients(
const std::vector< std::vector<int> > & indices,
model_t & outModel) const;
virtual void getSelectedDistancesToModel(
const model_t & model,
const std::vector<std::vector<int> > & indices,
std::vector<std::vector<double> > & scores) const;
virtual void optimizeModelCoefficients(
const std::vector<std::vector<int> > & inliers,
const model_t & model,
model_t & optimized_model);
virtual std::vector<int> getSampleSizes() const;
protected:
adapter_t & _adapter;
algorithm_t _algorithm;
bool _asCentral;
};
}
}
}
#endif //#ifndef OPENGV_SAC_PROBLEMS_RELATIVE_POSE_MULTINONCENTRALRELATIVEPOSESACPROBLEM_HPP_
MultiSampleConsensusProblem.hpp
Basis-class for Sample-consensus problems. Contains declarations for the three basic functions of a s...
RelativeMultiAdapterBase.hpp
Adapter-class for passing bearing-vector correspondences to the relative-pose algorithms....
opengv::relative_pose::RelativeMultiAdapterBase
Definition RelativeMultiAdapterBase.hpp:68
opengv::relative_pose::RelativeMultiAdapterBase::getNumberCorrespondences
virtual size_t getNumberCorrespondences(size_t pairIndex) const =0
Retrieve the number of correspondences for a camera-pair.
opengv::relative_pose::RelativeMultiAdapterBase::getNumberPairs
virtual size_t getNumberPairs() const =0
Retrieve the number of camera-pairs.
opengv::sac::MultiSampleConsensusProblem
Definition MultiSampleConsensusProblem.hpp:71
opengv::sac::MultiSampleConsensusProblem< transformation_t >::setIndices
void setIndices(const std::vector< std::vector< int > > &indices)
opengv::sac::MultiSampleConsensusProblem< transformation_t >::MultiSampleConsensusProblem
MultiSampleConsensusProblem(bool randomSeed=true)
opengv::sac::MultiSampleConsensusProblem< transformation_t >::setUniformIndices
void setUniformIndices(std::vector< int > N)
opengv::sac_problems::relative_pose::MultiNoncentralRelativePoseSacProblem::_asCentral
bool _asCentral
Definition MultiNoncentralRelativePoseSacProblem.hpp:176
opengv::sac_problems::relative_pose::MultiNoncentralRelativePoseSacProblem::algorithm_t
enum opengv::sac_problems::relative_pose::MultiNoncentralRelativePoseSacProblem::Algorithm algorithm_t
opengv::sac_problems::relative_pose::MultiNoncentralRelativePoseSacProblem::MultiNoncentralRelativePoseSacProblem
MultiNoncentralRelativePoseSacProblem(adapter_t &adapter, algorithm_t algorithm, const std::vector< std::vector< int > > &indices, bool asCentral=false, bool randomSeed=true)
Constructor.
Definition MultiNoncentralRelativePoseSacProblem.hpp:123
opengv::sac_problems::relative_pose::MultiNoncentralRelativePoseSacProblem::_algorithm
algorithm_t _algorithm
Definition MultiNoncentralRelativePoseSacProblem.hpp:174
opengv::sac_problems::relative_pose::MultiNoncentralRelativePoseSacProblem::model_t
transformation_t model_t
Definition MultiNoncentralRelativePoseSacProblem.hpp:78
opengv::sac_problems::relative_pose::MultiNoncentralRelativePoseSacProblem::computeModelCoefficients
virtual bool computeModelCoefficients(const std::vector< std::vector< int > > &indices, model_t &outModel) const
See parent-class.
opengv::sac_problems::relative_pose::MultiNoncentralRelativePoseSacProblem::getSelectedDistancesToModel
virtual void getSelectedDistancesToModel(const model_t &model, const std::vector< std::vector< int > > &indices, std::vector< std::vector< double > > &scores) const
See parent-class.
opengv::sac_problems::relative_pose::MultiNoncentralRelativePoseSacProblem::Algorithm
Algorithm
Definition MultiNoncentralRelativePoseSacProblem.hpp:84
opengv::sac_problems::relative_pose::MultiNoncentralRelativePoseSacProblem::_adapter
adapter_t & _adapter
Definition MultiNoncentralRelativePoseSacProblem.hpp:172
opengv::sac_problems::relative_pose::MultiNoncentralRelativePoseSacProblem::adapter_t
opengv::relative_pose::RelativeMultiAdapterBase adapter_t
Definition MultiNoncentralRelativePoseSacProblem.hpp:80
opengv::sac_problems::relative_pose::MultiNoncentralRelativePoseSacProblem::optimizeModelCoefficients
virtual void optimizeModelCoefficients(const std::vector< std::vector< int > > &inliers, const model_t &model, model_t &optimized_model)
See parent-class.
opengv::sac_problems::relative_pose::MultiNoncentralRelativePoseSacProblem::~MultiNoncentralRelativePoseSacProblem
virtual ~MultiNoncentralRelativePoseSacProblem()
Definition MultiNoncentralRelativePoseSacProblem.hpp:140
opengv::sac_problems::relative_pose::MultiNoncentralRelativePoseSacProblem::MultiNoncentralRelativePoseSacProblem
MultiNoncentralRelativePoseSacProblem(adapter_t &adapter, algorithm_t algorithm, bool asCentral=false, bool randomSeed=true)
Constructor.
Definition MultiNoncentralRelativePoseSacProblem.hpp:99
opengv::sac_problems::relative_pose::MultiNoncentralRelativePoseSacProblem::getSampleSizes
virtual std::vector< int > getSampleSizes() const
See parent-class.
opengv::sac_problems::relative_pose
The namespace for the relative pose methods.
Definition CentralRelativePoseSacProblem.hpp:59
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...