diff --git a/modules/core/src/image/private/vpImageConvert_impl.h b/modules/core/src/image/private/vpImageConvert_impl.h index f5d7a17485..b3fce17d6c 100644 --- a/modules/core/src/image/private/vpImageConvert_impl.h +++ b/modules/core/src/image/private/vpImageConvert_impl.h @@ -93,7 +93,7 @@ BEGIN_VISP_NAMESPACE #endif const unsigned int val_0x10000 = 0x10000; - for (int i = 2; i < val_0x10000; ++i) { + for (unsigned int i = 2; i < val_0x10000; ++i) { histogram[i] += histogram[i - 1]; // Build a cumulative histogram for the indices in [1,0xFFFF] } dest_depth.resize(src_depth.getHeight(), src_depth.getWidth()); @@ -151,7 +151,7 @@ void vp_createDepthHistogram(const vpImage &src_depth, vpImage &src_depth, vpImage &d } const unsigned int val_0x10000 = 0x10000; - for (int i = 2; i < val_0x10000; ++i) { + for (unsigned int i = 2; i < val_0x10000; ++i) { histogram[i] += histogram[i - 1]; // Build a cumulative histogram for the indices in [1,0xFFFF] } -#ifdef VISP_HAVE_OPENMP -#pragma omp parallel for -#endif + const unsigned char val_uc_5 = 5; const unsigned char val_uc_20 = 20; const unsigned char val_uc_255 = 255; +#ifdef VISP_HAVE_OPENMP +#pragma omp parallel for +#endif for (int i = 0; i < src_depth_size; ++i) { uint16_t d = static_cast(src_depth.bitmap[i]); if (d) { @@ -247,13 +248,13 @@ void vp_createDepthHistogram(const vpImage &src_depth, vpImage for (unsigned int i = 2; i < val_0x10000; ++i) { histogram[i] += histogram[i - 1]; // Build a cumulative histogram for the indices in [1,0xFFFF] } -#ifdef VISP_HAVE_OPENMP -#pragma omp parallel for -#endif const unsigned char val_uc_5 = 5; const unsigned char val_uc_20 = 20; const unsigned char val_uc_255 = 255; +#ifdef VISP_HAVE_OPENMP +#pragma omp parallel for +#endif for (int i = 0; i < src_depth_size; ++i) { uint16_t d = src_depth.bitmap[i]; if (d) { diff --git a/modules/core/src/image/vpImageTools.cpp b/modules/core/src/image/vpImageTools.cpp index 8056c746cd..9e591d7ac8 100644 --- a/modules/core/src/image/vpImageTools.cpp +++ b/modules/core/src/image/vpImageTools.cpp @@ -1217,10 +1217,11 @@ int vpImageTools::inRange(const unsigned char *hue, const unsigned char *saturat unsigned char v_high = static_cast(hsv_range[index_5]); int size_ = static_cast(size); int cpt_in_range = 0; + + const unsigned char val_uc_255 = 255; #if defined(_OPENMP) #pragma omp parallel for reduction(+:cpt_in_range) #endif - const unsigned char val_uc_255 = 255; for (int i = 0; i < size_; ++i) { bool check_h_low_high_hue = (h_low <= hue[i]) && (hue[i] <= h_high); bool check_s_low_high_saturation = (s_low <= saturation[i]) && (saturation[i] <= s_high);