From 0661aff4a50ff46c1f437dc3cebbe38145ed351c Mon Sep 17 00:00:00 2001 From: Wang Kai <53281385+kai-waang@users.noreply.github.com> Date: Mon, 3 Jul 2023 17:08:12 +0800 Subject: [PATCH] Merge pull request #23900 from kai-waang:fixing-typo Fixing typos in usac #23900 Just read and correct some typos in `usac` ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [ ] There is a reference to the original bug report and related work - [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [ ] The feature is well documented and sample code can be built with the project CMake --- modules/calib3d/src/usac/degeneracy.cpp | 2 +- modules/calib3d/src/usac/essential_solver.cpp | 2 +- modules/calib3d/src/usac/fundamental_solver.cpp | 4 ++-- modules/calib3d/src/usac/pnp_solver.cpp | 4 ++-- modules/calib3d/src/usac/ransac_solvers.cpp | 2 +- modules/calib3d/src/usac/sampler.cpp | 8 ++++---- modules/calib3d/src/usac/termination.cpp | 2 +- modules/calib3d/src/usac/utils.cpp | 4 ++-- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/modules/calib3d/src/usac/degeneracy.cpp b/modules/calib3d/src/usac/degeneracy.cpp index 6ccf2bb497..bf5ec2b110 100644 --- a/modules/calib3d/src/usac/degeneracy.cpp +++ b/modules/calib3d/src/usac/degeneracy.cpp @@ -112,7 +112,7 @@ public: return false; // Checks if points are not collinear - // If area of triangle constructed with 3 points is less then threshold then points are collinear: + // If area of triangle constructed with 3 points is less than threshold then points are collinear: // |x1 y1 1| |x1 y1 1| // (1/2) det |x2 y2 1| = (1/2) det |x2-x1 y2-y1 0| = det |x2-x1 y2-y1| < 2 * threshold // |x3 y3 1| |x3-x1 y3-y1 0| |x3-x1 y3-y1| diff --git a/modules/calib3d/src/usac/essential_solver.cpp b/modules/calib3d/src/usac/essential_solver.cpp index 6dad2a4b88..504fec6ab5 100644 --- a/modules/calib3d/src/usac/essential_solver.cpp +++ b/modules/calib3d/src/usac/essential_solver.cpp @@ -142,7 +142,7 @@ public: } std::vector c(11), rs; - // filling coefficients of 10-degree polynomial satysfying zero-determinant constraint of essential matrix, ie., det(E) = 0 + // filling coefficients of 10-degree polynomial satisfying zero-determinant constraint of essential matrix, ie., det(E) = 0 // based on "An Efficient Solution to the Five-Point Relative Pose Problem" (David Nister) // same as in five-point.cpp c[10] = (b[0]*b[17]*b[34]+b[26]*b[4]*b[21]-b[26]*b[17]*b[8]-b[13]*b[4]*b[34]-b[0]*b[21]*b[30]+b[13]*b[30]*b[8]); diff --git a/modules/calib3d/src/usac/fundamental_solver.cpp b/modules/calib3d/src/usac/fundamental_solver.cpp index 4083b76102..a5e3b30fba 100644 --- a/modules/calib3d/src/usac/fundamental_solver.cpp +++ b/modules/calib3d/src/usac/fundamental_solver.cpp @@ -438,7 +438,7 @@ public: explicit CovarianceEpipolarSolverImpl (const Mat &points_, bool is_fundamental_) { points_size = points_.rows; is_fundamental = is_fundamental_; - if (is_fundamental) { // normalize image points only for fundmantal matrix + if (is_fundamental) { // normalize image points only for fundamental matrix std::vector sample(points_size); for (int i = 0; i < points_size; i++) sample[i] = i; const Ptr normTr = NormTransform::create(points_); @@ -558,7 +558,7 @@ public: const auto * const pts_ = (float *) calib_points.data; // a few point are enough to test // actually due to Sampson error minimization, the input R,t do not really matter - // for a correct pair there is a sligthly faster convergence + // for a correct pair there is a slightly faster convergence for (int i = 0; i < 3; i++) { // could be 1 point const int rand_inl = 4 * sample[rng.uniform(0, sample_size)]; Vec3d p1 (pts_[rand_inl], pts_[rand_inl+1], 1), p2(pts_[rand_inl+2], pts_[rand_inl+3], 1); diff --git a/modules/calib3d/src/usac/pnp_solver.cpp b/modules/calib3d/src/usac/pnp_solver.cpp index b7b136d1e2..db04770908 100644 --- a/modules/calib3d/src/usac/pnp_solver.cpp +++ b/modules/calib3d/src/usac/pnp_solver.cpp @@ -196,7 +196,7 @@ public: a2[10] = v * Z; a2[11] = v; - // fill covarinace matrix + // fill covariance matrix for (int j = 0; j < 12; j++) for (int z = j; z < 12; z++) AtA[j * 12 + z] += a1[j] * a1[z] + a2[j] * a2[z]; @@ -227,7 +227,7 @@ public: a2[10] = v * weight_Z; a2[11] = v * weight; - // fill covarinace matrix + // fill covariance matrix for (int j = 0; j < 12; j++) for (int z = j; z < 12; z++) AtA[j * 12 + z] += a1[j] * a1[z] + a2[j] * a2[z]; diff --git a/modules/calib3d/src/usac/ransac_solvers.cpp b/modules/calib3d/src/usac/ransac_solvers.cpp index 1a76353331..28620c0b3f 100644 --- a/modules/calib3d/src/usac/ransac_solvers.cpp +++ b/modules/calib3d/src/usac/ransac_solvers.cpp @@ -294,7 +294,7 @@ public: params->getUpperIncompleteOfSigmaQuantile()); break; case ScoreMethod::SCORE_METHOD_LMEDS : quality = LMedsQuality::create(points_size, threshold, error); break; - default: CV_Error(cv::Error::StsNotImplemented, "Score is not imeplemeted!"); + default: CV_Error(cv::Error::StsNotImplemented, "Score is not implemented!"); } const auto is_ge_solver = params->getRansacSolver() == GEM_SOLVER; diff --git a/modules/calib3d/src/usac/sampler.cpp b/modules/calib3d/src/usac/sampler.cpp index 2095ee8b4d..1938bde918 100644 --- a/modules/calib3d/src/usac/sampler.cpp +++ b/modules/calib3d/src/usac/sampler.cpp @@ -62,8 +62,8 @@ Ptr UniformSampler::create(int state, int sample_size_, int poin /////////////////////////////////// PROSAC (SIMPLE) SAMPLER /////////////////////////////////////// /* * PROSAC (simple) sampler does not use array of precalculated T_n (n is subset size) samples, but computes T_n for -* specific n directy in generateSample() function. -* Also, the stopping length (or maximum subset size n*) by default is set to points_size (N) and does not updating +* specific n directly in generateSample() function. +* Also, the stopping length (or maximum subset size n*) by default is set to points_size (N) and does not update * during computation. */ class ProsacSimpleSamplerImpl : public ProsacSimpleSampler { @@ -176,7 +176,7 @@ protected: // In our experiments, the parameter was set to T_N = 200000 int growth_max_samples; - // how many time PROSAC generateSample() was called + // how many times PROSAC generateSample() was called int kth_sample_number; Ptr random_gen; public: @@ -488,7 +488,7 @@ public: points_large_neighborhood_size = 0; - // find indicies of points that have sufficient neighborhood (at least sample_size-1) + // find indices of points that have sufficient neighborhood (at least sample_size-1) for (int pt_idx = 0; pt_idx < points_size; pt_idx++) if ((int)neighborhood_graph->getNeighbors(pt_idx).size() >= sample_size-1) points_large_neighborhood[points_large_neighborhood_size++] = pt_idx; diff --git a/modules/calib3d/src/usac/termination.cpp b/modules/calib3d/src/usac/termination.cpp index 803b060e41..26a9e331ed 100644 --- a/modules/calib3d/src/usac/termination.cpp +++ b/modules/calib3d/src/usac/termination.cpp @@ -19,7 +19,7 @@ public: /* * Get upper bound iterations for any sample number - * n is points size, w is inlier ratio, p is desired probability, k is expceted number of iterations. + * n is points size, w is inlier ratio, p is desired probability, k is expected number of iterations. * 1 - p = (1 - w^n)^k, * k = log_(1-w^n) (1-p) * k = ln (1-p) / ln (1-w^n) diff --git a/modules/calib3d/src/usac/utils.cpp b/modules/calib3d/src/usac/utils.cpp index 5e2206702f..da1956f26c 100644 --- a/modules/calib3d/src/usac/utils.cpp +++ b/modules/calib3d/src/usac/utils.cpp @@ -344,10 +344,10 @@ void Utils::decomposeProjection (const Mat &P, Matx33d &K, Matx33d &R, Vec3d &t, } double Utils::getPoissonCDF (double lambda, int inliers) { - double exp_lamda = exp(-lambda), cdf = exp_lamda, lambda_i_div_fact_i = 1; + double exp_lambda = exp(-lambda), cdf = exp_lambda, lambda_i_div_fact_i = 1; for (int i = 1; i <= inliers; i++) { lambda_i_div_fact_i *= (lambda / i); - cdf += exp_lamda * lambda_i_div_fact_i; + cdf += exp_lambda * lambda_i_div_fact_i; if (fabs(cdf - 1) < DBL_EPSILON) // cdf is almost 1 break; }