Fix size_t to int conversion
authorIevgen Khvedchenia <ekhvedchenya@gmail.com>
Mon, 28 Apr 2014 16:32:29 +0000 (19:32 +0300)
committerIevgen Khvedchenia <ekhvedchenya@gmail.com>
Mon, 28 Apr 2014 16:32:29 +0000 (19:32 +0300)
modules/features2d/src/akaze/nldiffusion_functions.cpp
modules/features2d/src/akaze/nldiffusion_functions.h
modules/features2d/src/kaze/nldiffusion_functions.cpp

index 31db4f101ba16908cc2df4628bdda0c42859b936..9ead4ecfe8b4cd519918daa13efaaf3b6071a1ce 100644 (file)
@@ -69,8 +69,7 @@ void gaussian_2D_convolution(const cv::Mat& src, cv::Mat& dst, const size_t& ksi
  * A Scheme for Coherence-Enhancing Diffusion Filtering with Optimized Rotation Invariance,
  * Journal of Visual Communication and Image Representation 2002
  */
-void image_derivatives_scharr(const cv::Mat& src, cv::Mat& dst,
-    const size_t& xorder, const size_t& yorder) {
+void image_derivatives_scharr(const cv::Mat& src, cv::Mat& dst, int xorder, int yorder) {
     Scharr(src, dst, CV_32F, xorder, yorder, 1.0, 0, BORDER_DEFAULT);
 }
 
@@ -233,8 +232,7 @@ float compute_k_percentile(const cv::Mat& img, float perc, float gscale,
  * @param yorder Derivative order in Y-direction (vertical)
  * @param scale Scale factor for the derivative size
  */
-void compute_scharr_derivatives(const cv::Mat& src, cv::Mat& dst, const size_t& xorder,
-    const size_t& yorder, const size_t& scale) {
+void compute_scharr_derivatives(const cv::Mat& src, cv::Mat& dst, int xorder, int yorder, int scale) {
 
     Mat kx, ky;
     compute_derivative_kernels(kx, ky, xorder, yorder, scale);
@@ -344,10 +342,9 @@ void halfsample_image(const cv::Mat& src, cv::Mat& dst) {
  * @param dy The derivative order in y-direction
  * @param scale The kernel size
  */
-void compute_derivative_kernels(cv::OutputArray kx_, cv::OutputArray ky_,
-    const size_t& dx, const size_t& dy, const size_t& scale) {
+void compute_derivative_kernels(cv::OutputArray kx_, cv::OutputArray ky_, int dx, int dy, int scale) {
 
-    const int ksize = 3 + 2 * ( (int)scale - 1);
+    const int ksize = 3 + 2 * (scale - 1);
 
     // The usual Scharr kernel
     if (scale == 1) {
index ba578758b03c8731812ef3897fe7ec45f977b14f..ec0ef2a847748287e9f4810e6b58241a291a3106 100644 (file)
@@ -23,12 +23,10 @@ void weickert_diffusivity(const cv::Mat& Lx, const cv::Mat& Ly, cv::Mat& dst, co
 void charbonnier_diffusivity(const cv::Mat& Lx, const cv::Mat& Ly, cv::Mat& dst, const float& k);
 float compute_k_percentile(const cv::Mat& img, float perc, float gscale,
                            size_t nbins, size_t ksize_x, size_t ksize_y);
-void compute_scharr_derivatives(const cv::Mat& src, cv::Mat& dst, const size_t& xorder,
-                                const size_t& yorder, const size_t& scale);
+void compute_scharr_derivatives(const cv::Mat& src, cv::Mat& dst, int xorder, int, int scale);
 void nld_step_scalar(cv::Mat& Ld, const cv::Mat& c, cv::Mat& Lstep, const float& stepsize);
 void downsample_image(const cv::Mat& src, cv::Mat& dst);
 void halfsample_image(const cv::Mat& src, cv::Mat& dst);
-void compute_derivative_kernels(cv::OutputArray kx_, cv::OutputArray ky_,
-                                const size_t& dx, const size_t& dy, const size_t& scale);
+void compute_derivative_kernels(cv::OutputArray kx_, cv::OutputArray ky_, int dx, int dy, int scale);
 bool check_maximum_neighbourhood(const cv::Mat& img, int dsize, float value,
                                  int row, int col, bool same_img);
index ce3bef17589dd41ec3616c4aec15f75aff6d184a..c2c46d2b7ad3635ccaac8d16460db98c45caf399 100644 (file)
@@ -43,11 +43,11 @@ using namespace cv;
 void gaussian_2D_convolution(const cv::Mat& src, cv::Mat& dst,
                              int ksize_x, int ksize_y, float sigma) {
 
-  size_t ksize_x_ = 0, ksize_y_ = 0;
+  int ksize_x_ = 0, ksize_y_ = 0;
 
   // Compute an appropriate kernel size according to the specified sigma
   if (sigma > ksize_x || sigma > ksize_y || ksize_x == 0 || ksize_y == 0) {
-    ksize_x_ = (size_t)ceil(2.0f*(1.0f + (sigma-0.8f)/(0.3f)));
+    ksize_x_ = (int)ceil(2.0f*(1.0f + (sigma-0.8f)/(0.3f)));
     ksize_y_ = ksize_x_;
   }
 
@@ -196,7 +196,7 @@ float compute_k_percentile(const cv::Mat& img, float perc, float gscale,
   }
 
   if (nelements < nthreshold)  {
-    kperc = 0.03;
+    kperc = 0.03f;
   }
   else {
     kperc = hmax*((float)(k)/(float)nbins);