diff --git a/modules/features2d/src/akaze.cpp b/modules/features2d/src/akaze.cpp index 3c918bfba..7a0ac729b 100644 --- a/modules/features2d/src/akaze.cpp +++ b/modules/features2d/src/akaze.cpp @@ -150,8 +150,8 @@ namespace cv impl.Compute_Descriptors(keypoints, desc); - CV_Assert((!desc.rows || desc.cols == descriptorSize()) && "Descriptor size does not match expected"); - CV_Assert((!desc.rows || (desc.type() & descriptorType())) && "Descriptor type does not match expected"); + CV_Assert((!desc.rows || desc.cols == descriptorSize())); + CV_Assert((!desc.rows || (desc.type() & descriptorType()))); } void AKAZE::detectImpl(InputArray image, std::vector& keypoints, InputArray mask) const @@ -196,7 +196,7 @@ namespace cv impl.Create_Nonlinear_Scale_Space(img1_32); impl.Compute_Descriptors(keypoints, desc); - CV_Assert((!desc.rows || desc.cols == descriptorSize()) && "Descriptor size does not match expected"); - CV_Assert((!desc.rows || (desc.type() & descriptorType())) && "Descriptor type does not match expected"); + CV_Assert((!desc.rows || desc.cols == descriptorSize())); + CV_Assert((!desc.rows || (desc.type() & descriptorType()))); } } \ No newline at end of file diff --git a/modules/features2d/src/kaze.cpp b/modules/features2d/src/kaze.cpp index 52fef1366..d975eaeb0 100644 --- a/modules/features2d/src/kaze.cpp +++ b/modules/features2d/src/kaze.cpp @@ -119,8 +119,8 @@ namespace cv impl.Feature_Description(keypoints, desc); - CV_Assert((!desc.rows || desc.cols == descriptorSize()) && "Descriptor size does not match expected"); - CV_Assert((!desc.rows || (desc.type() & descriptorType())) && "Descriptor type does not match expected"); + CV_Assert((!desc.rows || desc.cols == descriptorSize())); + CV_Assert((!desc.rows || (desc.type() & descriptorType()))); } void KAZE::detectImpl(InputArray image, std::vector& keypoints, InputArray mask) const @@ -167,7 +167,7 @@ namespace cv impl.Create_Nonlinear_Scale_Space(img1_32); impl.Feature_Description(keypoints, desc); - CV_Assert((!desc.rows || desc.cols == descriptorSize()) && "Descriptor size does not match expected"); - CV_Assert((!desc.rows || (desc.type() & descriptorType())) && "Descriptor type does not match expected"); + CV_Assert((!desc.rows || desc.cols == descriptorSize())); + CV_Assert((!desc.rows || (desc.type() & descriptorType()))); } } \ No newline at end of file diff --git a/modules/features2d/src/kaze/KAZE.cpp b/modules/features2d/src/kaze/KAZE.cpp index 36e969009..f8625f983 100644 --- a/modules/features2d/src/kaze/KAZE.cpp +++ b/modules/features2d/src/kaze/KAZE.cpp @@ -51,6 +51,8 @@ KAZEFeatures::KAZEFeatures(KAZEOptions& options) { use_fed_ = options.use_fed; use_upright_ = options.upright; use_extended_ = options.extended; + use_normalization = USE_CLIPPING_NORMALIZATION; + kcontrast_ = DEFAULT_KCONTRAST; ncycles_ = 0; reordering_ = true; @@ -232,9 +234,9 @@ void KAZEFeatures::Compute_KContrast(const cv::Mat &img, const float &kpercentil // cout << "Computing Kcontrast factor." << endl; //} - if (COMPUTE_KCONTRAST) { + //if (COMPUTE_KCONTRAST) { kcontrast_ = compute_k_percentile(img, kpercentile, sderivatives_, KCONTRAST_NBINS, 0, 0); - } + //} //if (verbosity_ == true) { // cout << "kcontrast = " << kcontrast_ << endl; @@ -972,7 +974,7 @@ void KAZEFeatures::Get_SURF_Upright_Descriptor_64(const cv::KeyPoint &kpt, float desc[i] /= len; } - if (USE_CLIPPING_NORMALIZATION == true) { + if (use_normalization == true) { clippingDescriptor(desc, dsize, CLIPPING_NORMALIZATION_NITER, CLIPPING_NORMALIZATION_RATIO); } } @@ -1079,7 +1081,7 @@ void KAZEFeatures::Get_SURF_Descriptor_64(const cv::KeyPoint &kpt, float *desc) desc[i] /= len; } - if (USE_CLIPPING_NORMALIZATION == true) { + if (use_normalization == true) { clippingDescriptor(desc, dsize, CLIPPING_NORMALIZATION_NITER, CLIPPING_NORMALIZATION_RATIO); } } @@ -1211,7 +1213,7 @@ void KAZEFeatures::Get_MSURF_Upright_Descriptor_64(const cv::KeyPoint &kpt, floa desc[i] /= len; } - if (USE_CLIPPING_NORMALIZATION == true) { + if (use_normalization == true) { clippingDescriptor(desc, dsize, CLIPPING_NORMALIZATION_NITER, CLIPPING_NORMALIZATION_RATIO); } } @@ -1344,7 +1346,7 @@ void KAZEFeatures::Get_MSURF_Descriptor_64(const cv::KeyPoint &kpt, float *desc) desc[i] /= len; } - if (USE_CLIPPING_NORMALIZATION == true) { + if (use_normalization == true) { clippingDescriptor(desc, dsize, CLIPPING_NORMALIZATION_NITER, CLIPPING_NORMALIZATION_RATIO); } } @@ -1479,7 +1481,7 @@ void KAZEFeatures::Get_GSURF_Upright_Descriptor_64(const cv::KeyPoint &kpt, floa desc[i] /= len; } - if (USE_CLIPPING_NORMALIZATION == true) { + if (use_normalization == true) { clippingDescriptor(desc, dsize, CLIPPING_NORMALIZATION_NITER, CLIPPING_NORMALIZATION_RATIO); } } @@ -1617,7 +1619,7 @@ void KAZEFeatures::Get_GSURF_Descriptor_64(const cv::KeyPoint &kpt, float *desc) desc[i] /= len; } - if (USE_CLIPPING_NORMALIZATION == true) { + if (use_normalization == true) { clippingDescriptor(desc, dsize, CLIPPING_NORMALIZATION_NITER, CLIPPING_NORMALIZATION_RATIO); } @@ -1737,7 +1739,7 @@ void KAZEFeatures::Get_SURF_Upright_Descriptor_128(const cv::KeyPoint &kpt, floa desc[i] /= len; } - if (USE_CLIPPING_NORMALIZATION == true) { + if (use_normalization == true) { clippingDescriptor(desc, dsize, CLIPPING_NORMALIZATION_NITER, CLIPPING_NORMALIZATION_RATIO); } } @@ -1865,7 +1867,7 @@ void KAZEFeatures::Get_SURF_Descriptor_128(const cv::KeyPoint &kpt, float *desc) desc[i] /= len; } - if (USE_CLIPPING_NORMALIZATION == true) { + if (use_normalization == true) { clippingDescriptor(desc, dsize, CLIPPING_NORMALIZATION_NITER, CLIPPING_NORMALIZATION_RATIO); } } @@ -2021,7 +2023,7 @@ void KAZEFeatures::Get_MSURF_Upright_Descriptor_128(const cv::KeyPoint &kpt, flo desc[i] /= len; } - if (USE_CLIPPING_NORMALIZATION == true) { + if (use_normalization == true) { clippingDescriptor(desc, dsize, CLIPPING_NORMALIZATION_NITER, CLIPPING_NORMALIZATION_RATIO); } } @@ -2182,7 +2184,7 @@ void KAZEFeatures::Get_MSURF_Descriptor_128(const cv::KeyPoint &kpt, float *desc desc[i] /= len; } - if (USE_CLIPPING_NORMALIZATION == true) { + if (use_normalization == true) { clippingDescriptor(desc, dsize, CLIPPING_NORMALIZATION_NITER, CLIPPING_NORMALIZATION_RATIO); } } @@ -2335,7 +2337,7 @@ void KAZEFeatures::Get_GSURF_Upright_Descriptor_128(const cv::KeyPoint &kpt, flo desc[i] /= len; } - if (USE_CLIPPING_NORMALIZATION == true) { + if (use_normalization == true) { clippingDescriptor(desc, dsize, CLIPPING_NORMALIZATION_NITER, CLIPPING_NORMALIZATION_RATIO); } } @@ -2493,7 +2495,7 @@ void KAZEFeatures::Get_GSURF_Descriptor_128(const cv::KeyPoint &kpt, float *desc desc[i] /= len; } - if (USE_CLIPPING_NORMALIZATION == true) { + if (use_normalization == true) { clippingDescriptor(desc, dsize, CLIPPING_NORMALIZATION_NITER, CLIPPING_NORMALIZATION_RATIO); } } diff --git a/modules/features2d/src/kaze/KAZE.h b/modules/features2d/src/kaze/KAZE.h index 71b44340e..31507a602 100644 --- a/modules/features2d/src/kaze/KAZE.h +++ b/modules/features2d/src/kaze/KAZE.h @@ -43,6 +43,7 @@ private: bool use_fed_; // Set to true in case we want to use FED for the nonlinear diffusion filtering. Set false for using AOS bool use_upright_; // Set to true in case we want to use the upright version of the descriptors bool use_extended_; // Set to true in case we want to use the extended version of the descriptors + bool use_normalization; // Vector of keypoint vectors for finding extrema in multiple threads std::vector > kpts_par_;