Fix: UsacParams Python bindings

This commit is contained in:
arodrigu 2020-10-16 14:41:41 +02:00
parent 8bf451a3e0
commit aa51382dbc
2 changed files with 27 additions and 11 deletions

View File

@ -550,17 +550,18 @@ enum NeighborSearchMethod { NEIGH_FLANN_KNN, NEIGH_GRID, NEIGH_FLANN_RADIUS };
struct CV_EXPORTS_W_SIMPLE UsacParams
{ // in alphabetical order
double confidence = 0.99;
bool isParallel = false;
int loIterations = 5;
LocalOptimMethod loMethod = LocalOptimMethod::LOCAL_OPTIM_INNER_LO;
int loSampleSize = 14;
int maxIterations = 5000;
NeighborSearchMethod neighborsSearch = NeighborSearchMethod::NEIGH_GRID;
int randomGeneratorState = 0;
SamplingMethod sampler = SamplingMethod::SAMPLING_UNIFORM;
ScoreMethod score = ScoreMethod::SCORE_METHOD_MSAC;
double threshold = 1.5;
CV_WRAP UsacParams();
CV_PROP_RW double confidence;
CV_PROP_RW bool isParallel;
CV_PROP_RW int loIterations;
CV_PROP_RW LocalOptimMethod loMethod;
CV_PROP_RW int loSampleSize;
CV_PROP_RW int maxIterations;
CV_PROP_RW NeighborSearchMethod neighborsSearch;
CV_PROP_RW int randomGeneratorState;
CV_PROP_RW SamplingMethod sampler;
CV_PROP_RW ScoreMethod score;
CV_PROP_RW double threshold;
};
/** @brief Converts a rotation matrix to a rotation vector or vice versa.

View File

@ -197,6 +197,21 @@ public:
Mat tvec;
};
UsacParams::UsacParams()
{
confidence = 0.99;
isParallel = false;
loIterations = 5;
loMethod = LocalOptimMethod::LOCAL_OPTIM_INNER_LO;
loSampleSize = 14;
maxIterations = 5000;
neighborsSearch = NeighborSearchMethod::NEIGH_GRID;
randomGeneratorState = 0;
sampler = SamplingMethod::SAMPLING_UNIFORM;
score = ScoreMethod::SCORE_METHOD_MSAC;
threshold = 1.5;
}
bool solvePnPRansac(InputArray _opoints, InputArray _ipoints,
InputArray _cameraMatrix, InputArray _distCoeffs,
OutputArray _rvec, OutputArray _tvec, bool useExtrinsicGuess,