mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 15:53:03 +04:00
Merge branch 4.x
This commit is contained in:
@@ -1740,7 +1740,7 @@ static inline unsigned sacCalcIterBound(double confidence,
|
||||
* \[ k = \frac{\log{(1-confidence)}}{\log{(1-inlierRate**sampleSize)}} \]
|
||||
*/
|
||||
|
||||
double atLeastOneOutlierProbability = 1.-pow(inlierRate, (double)sampleSize);
|
||||
double atLeastOneOutlierProbability = 1.-std::pow(inlierRate, (double)sampleSize);
|
||||
|
||||
/**
|
||||
* There are two special cases: When argument to log() is 0 and when it is 1.
|
||||
|
||||
@@ -508,7 +508,7 @@ static void undistortPointsInternal( const Mat& _src, Mat& _dst, const Mat& _cam
|
||||
double x_proj = xd*fx + cx;
|
||||
double y_proj = yd*fy + cy;
|
||||
|
||||
error = sqrt( pow(x_proj - u, 2) + pow(y_proj - v, 2) );
|
||||
error = sqrt( std::pow(x_proj - u, 2) + std::pow(y_proj - v, 2) );
|
||||
}
|
||||
if (error > prevError) {
|
||||
alpha *= .5;
|
||||
|
||||
@@ -68,7 +68,7 @@ class NormTransform : public Algorithm {
|
||||
public:
|
||||
/*
|
||||
* @norm_points is output matrix of size pts_size x 4
|
||||
* @sample constains indices of points
|
||||
* @sample contains indices of points
|
||||
* @sample_number is number of used points in sample <0; sample_number)
|
||||
* @T1, T2 are output transformation matrices
|
||||
*/
|
||||
|
||||
@@ -435,7 +435,7 @@ public:
|
||||
const int num_f_inliers_of_h_outliers = getNonPlanarSupport(Mat(F), num_models_used_so_far >= MAX_MODELS_TO_TEST, non_planar_support);
|
||||
if (non_planar_support < num_f_inliers_of_h_outliers) {
|
||||
non_planar_support = num_f_inliers_of_h_outliers;
|
||||
const double predicted_iters = log_conf / log(1 - pow(static_cast<double>
|
||||
const double predicted_iters = log_conf / log(1 - std::pow(static_cast<double>
|
||||
(getNonPlanarSupport(Mat(F), non_planar_pts, num_non_planar_pts)) / num_non_planar_pts, 2));
|
||||
if (use_preemptive && ! std::isinf(predicted_iters) && predicted_iters < max_iters)
|
||||
max_iters = static_cast<int>(predicted_iters);
|
||||
|
||||
@@ -454,7 +454,7 @@ public:
|
||||
DoF = DoF_; C = C_;
|
||||
max_sigma = max_sigma_;
|
||||
squared_sigma_max_2 = max_sigma * max_sigma * 2.0;
|
||||
one_over_sigma = C * pow(2.0, (DoF - 1.0) * 0.5) / max_sigma;
|
||||
one_over_sigma = C * std::pow(2, (DoF - 1.0) * 0.5) / max_sigma;
|
||||
max_sigma_sqr = squared_sigma_max_2 * 0.5;
|
||||
rescale_err = scale_of_stored_gammas / squared_sigma_max_2;
|
||||
}
|
||||
@@ -464,7 +464,7 @@ public:
|
||||
int getInliersWeights (const std::vector<float> &errors, std::vector<int> &inliers, std::vector<double> &weights, double thr_sqr) const override {
|
||||
const auto _max_sigma = thr_sqr;
|
||||
const auto _squared_sigma_max_2 = _max_sigma * _max_sigma * 2.0;
|
||||
const auto _one_over_sigma = C * pow(2.0, (DoF - 1.0) * 0.5) / _max_sigma;
|
||||
const auto _one_over_sigma = C * std::pow(2, (DoF - 1.0) * 0.5) / _max_sigma;
|
||||
const auto _max_sigma_sqr = _squared_sigma_max_2 * 0.5;
|
||||
const auto _rescale_err = scale_of_stored_gammas / _squared_sigma_max_2;
|
||||
return getInliersWeights(errors, inliers, weights, _one_over_sigma, _rescale_err, _max_sigma_sqr);
|
||||
|
||||
@@ -197,7 +197,7 @@ public:
|
||||
const auto maximum_sigma_2 = (float) (maximum_sigma * maximum_sigma);
|
||||
maximum_sigma_2_per_2 = maximum_sigma_2 / 2.f;
|
||||
const auto maximum_sigma_2_times_2 = maximum_sigma_2 * 2.f;
|
||||
two_ad_dof_plus_one_per_maximum_sigma = pow(2.0, (DoF + 1.0)*.5)/maximum_sigma;
|
||||
two_ad_dof_plus_one_per_maximum_sigma = std::pow(2, (DoF + 1.0)*.5)/maximum_sigma;
|
||||
rescale_err = gamma_generator->getScaleOfGammaCompleteValues() / maximum_sigma_2_times_2;
|
||||
stored_incomplete_gamma_number_min1 = static_cast<unsigned int>(gamma_generator->getTableSize()-1);
|
||||
|
||||
|
||||
@@ -1099,14 +1099,14 @@ bool UniversalRANSAC::run(Ptr<RansacOutput> &ransac_output) {
|
||||
_quality->getInliers(best_model, temp_inliers));
|
||||
// quick test on lambda from all inliers (= upper bound of independent inliers)
|
||||
// if model with independent inliers is not random for Poisson with all inliers then it is not random using independent inliers too
|
||||
if (pow(Utils::getPoissonCDF(lambda_non_random_all_inliers, non_random_inls_best_model), num_total_tested_models) < 0.9999) {
|
||||
if (std::pow(Utils::getPoissonCDF(lambda_non_random_all_inliers, non_random_inls_best_model), num_total_tested_models) < 0.9999) {
|
||||
std::vector<int> inliers_list(models_for_random_test.size());
|
||||
for (int m = 0; m < (int)models_for_random_test.size(); m++)
|
||||
inliers_list[m] = getIndependentInliers(models_for_random_test[m], samples_for_random_test[m],
|
||||
temp_inliers, _quality->getInliers(models_for_random_test[m], temp_inliers));
|
||||
int min_non_rand_inliers;
|
||||
const double lambda = getLambda(inliers_list, 1.644, points_size, sample_size, true, min_non_rand_inliers);
|
||||
const double cdf_lambda = Utils::getPoissonCDF(lambda, non_random_inls_best_model), cdf_N = pow(cdf_lambda, num_total_tested_models);
|
||||
const double cdf_lambda = Utils::getPoissonCDF(lambda, non_random_inls_best_model), cdf_N = std::pow(cdf_lambda, num_total_tested_models);
|
||||
model_conf = cdf_N < 0.9999 ? ModelConfidence ::RANDOM : ModelConfidence ::NON_RANDOM;
|
||||
} else model_conf = ModelConfidence ::NON_RANDOM;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ public:
|
||||
}
|
||||
|
||||
static int getMaxIterations (int inlier_number, int sample_size, int points_size, double conf) {
|
||||
const double pred_iters = log(1 - conf) / log(1 - pow(static_cast<double>(inlier_number)/points_size, sample_size));
|
||||
const double pred_iters = log(1 - conf) / log(1 - std::pow(static_cast<double>(inlier_number)/points_size, sample_size));
|
||||
if (std::isinf(pred_iters))
|
||||
return INT_MAX;
|
||||
return (int) pred_iters + 1;
|
||||
@@ -322,7 +322,7 @@ public:
|
||||
continue;
|
||||
|
||||
// add 1 to termination length since num_inliers_under_termination_len is updated
|
||||
const double new_max_samples = log_conf/log(1-pow(static_cast<double>(num_inliers_under_termination_len)
|
||||
const double new_max_samples = log_conf/log(1-std::pow(static_cast<double>(num_inliers_under_termination_len)
|
||||
/ (termination_len+1), sample_size));
|
||||
|
||||
if (! std::isinf(new_max_samples) && predicted_iterations > new_max_samples) {
|
||||
|
||||
Reference in New Issue
Block a user