Fix size_t to int conversion

This commit is contained in:
Ievgen Khvedchenia 2014-04-28 19:32:29 +03:00
parent 0e3bbd7026
commit c68cbfced3
3 changed files with 9 additions and 14 deletions

View 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, * A Scheme for Coherence-Enhancing Diffusion Filtering with Optimized Rotation Invariance,
* Journal of Visual Communication and Image Representation 2002 * Journal of Visual Communication and Image Representation 2002
*/ */
void image_derivatives_scharr(const cv::Mat& src, cv::Mat& dst, void image_derivatives_scharr(const cv::Mat& src, cv::Mat& dst, int xorder, int yorder) {
const size_t& xorder, const size_t& yorder) {
Scharr(src, dst, CV_32F, xorder, yorder, 1.0, 0, BORDER_DEFAULT); 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 yorder Derivative order in Y-direction (vertical)
* @param scale Scale factor for the derivative size * @param scale Scale factor for the derivative size
*/ */
void compute_scharr_derivatives(const cv::Mat& src, cv::Mat& dst, const size_t& xorder, void compute_scharr_derivatives(const cv::Mat& src, cv::Mat& dst, int xorder, int yorder, int scale) {
const size_t& yorder, const size_t& scale) {
Mat kx, ky; Mat kx, ky;
compute_derivative_kernels(kx, ky, xorder, yorder, scale); 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 dy The derivative order in y-direction
* @param scale The kernel size * @param scale The kernel size
*/ */
void compute_derivative_kernels(cv::OutputArray kx_, cv::OutputArray ky_, void compute_derivative_kernels(cv::OutputArray kx_, cv::OutputArray ky_, int dx, int dy, int scale) {
const size_t& dx, const size_t& dy, const size_t& scale) {
const int ksize = 3 + 2 * ( (int)scale - 1); const int ksize = 3 + 2 * (scale - 1);
// The usual Scharr kernel // The usual Scharr kernel
if (scale == 1) { if (scale == 1) {

View 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); 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, float compute_k_percentile(const cv::Mat& img, float perc, float gscale,
size_t nbins, size_t ksize_x, size_t ksize_y); 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, void compute_scharr_derivatives(const cv::Mat& src, cv::Mat& dst, int xorder, int, int scale);
const size_t& yorder, const size_t& scale);
void nld_step_scalar(cv::Mat& Ld, const cv::Mat& c, cv::Mat& Lstep, const float& stepsize); 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 downsample_image(const cv::Mat& src, cv::Mat& dst);
void halfsample_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_, void compute_derivative_kernels(cv::OutputArray kx_, cv::OutputArray ky_, int dx, int dy, int scale);
const size_t& dx, const size_t& dy, const size_t& scale);
bool check_maximum_neighbourhood(const cv::Mat& img, int dsize, float value, bool check_maximum_neighbourhood(const cv::Mat& img, int dsize, float value,
int row, int col, bool same_img); int row, int col, bool same_img);

View File

@ -43,11 +43,11 @@ using namespace cv;
void gaussian_2D_convolution(const cv::Mat& src, cv::Mat& dst, void gaussian_2D_convolution(const cv::Mat& src, cv::Mat& dst,
int ksize_x, int ksize_y, float sigma) { 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 // Compute an appropriate kernel size according to the specified sigma
if (sigma > ksize_x || sigma > ksize_y || ksize_x == 0 || ksize_y == 0) { 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_; ksize_y_ = ksize_x_;
} }
@ -196,7 +196,7 @@ float compute_k_percentile(const cv::Mat& img, float perc, float gscale,
} }
if (nelements < nthreshold) { if (nelements < nthreshold) {
kperc = 0.03; kperc = 0.03f;
} }
else { else {
kperc = hmax*((float)(k)/(float)nbins); kperc = hmax*((float)(k)/(float)nbins);