Guest User

OpenCV-flags patch

a guest
Dec 25th, 2019
207
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. diff --git a/src/io/image_aug_default.cc b/src/io/image_aug_default.cc
  2. index f31664709bd..a6d7cc1204f 100644
  3. --- a/src/io/image_aug_default.cc
  4. +++ b/src/io/image_aug_default.cc
  5. @@ -479,14 +479,14 @@ class DefaultImageAugmenter : public ImageAugmenter {
  6.          }
  7.          if (i == 1) {
  8.            // contrast
  9. -          cvtColor(res, temp_, CV_RGB2GRAY);
  10. +          cvtColor(res, temp_, cv::COLOR_RGB2GRAY);
  11.            float gray_mean = cv::mean(temp_)[0];
  12.            res.convertTo(res, -1, alpha_c, (1 - alpha_c) * gray_mean);
  13.          }
  14.          if (i == 2) {
  15.            // saturation
  16. -          cvtColor(res, temp_, CV_RGB2GRAY);
  17. -          cvtColor(temp_, temp_, CV_GRAY2BGR);
  18. +          cvtColor(res, temp_, cv::COLOR_RGB2GRAY);
  19. +          cvtColor(temp_, temp_, cv::COLOR_GRAY2BGR);
  20.            cv::addWeighted(res, alpha_s, temp_, 1 - alpha_s, 0.0, res);
  21.          }
  22.        }
  23. @@ -495,7 +495,7 @@ class DefaultImageAugmenter : public ImageAugmenter {
  24.      // color space augmentation
  25.      if (param_.random_h != 0 || param_.random_s != 0 || param_.random_l != 0) {
  26.        std::uniform_real_distribution<float> rand_uniform(0, 1);
  27. -      cvtColor(res, res, CV_BGR2HLS);
  28. +      cvtColor(res, res, cv::COLOR_BGR2HLS);
  29.        // use an approximation of gaussian distribution to reduce extreme value
  30.        float rh = rand_uniform(*prnd); rh += 4 * rand_uniform(*prnd); rh = rh / 5;
  31.        float rs = rand_uniform(*prnd); rs += 4 * rand_uniform(*prnd); rs = rs / 5;
  32. @@ -515,7 +515,7 @@ class DefaultImageAugmenter : public ImageAugmenter {
  33.            }
  34.          }
  35.        }
  36. -      cvtColor(res, res, CV_HLS2BGR);
  37. +      cvtColor(res, res, cv::COLOR_HLS2BGR);
  38.      }
  39.  
  40.      // pca noise
  41. diff --git a/src/io/image_det_aug_default.cc b/src/io/image_det_aug_default.cc
  42. index afe5174b75d..5476ea37218 100644
  43. --- a/src/io/image_det_aug_default.cc
  44. +++ b/src/io/image_det_aug_default.cc
  45. @@ -547,7 +547,7 @@ class DefaultImageDetAugmenter : public ImageAugmenter {
  46.        if (h != 0 || s != 0 || l != 0) {
  47.          int temp[3] = {h, l, s};
  48.          int limit[3] = {180, 255, 255};
  49. -        cv::cvtColor(res, res, CV_BGR2HLS);
  50. +        cv::cvtColor(res, res, cv::COLOR_BGR2HLS);
  51.          for (int i = 0; i < res.rows; ++i) {
  52.            for (int j = 0; j < res.cols; ++j) {
  53.              for (int k = 0; k < 3; ++k) {
  54. @@ -558,7 +558,7 @@ class DefaultImageDetAugmenter : public ImageAugmenter {
  55.              }
  56.            }
  57.          }
  58. -        cv::cvtColor(res, res, CV_HLS2BGR);
  59. +        cv::cvtColor(res, res, cv::COLOR_HLS2BGR);
  60.        }
  61.        if (std::fabs(c) > 1e-3) {
  62.          cv::Mat tmp = res;
  63. diff --git a/src/io/image_io.cc b/src/io/image_io.cc
  64. index b3f7c40b2b1..438c6157865 100644
  65. --- a/src/io/image_io.cc
  66. +++ b/src/io/image_io.cc
  67. @@ -169,7 +169,7 @@ void ImdecodeImpl(int flag, bool to_rgb, void* data, size_t size,
  68.    }
  69.    CHECK_EQ(static_cast<void*>(dst.ptr()), out->data().dptr_);
  70.    if (to_rgb && flag != 0) {
  71. -    cv::cvtColor(dst, dst, CV_BGR2RGB);
  72. +    cv::cvtColor(dst, dst, cv::COLOR_BGR2RGB);
  73.    }
  74.  }
  75.  #endif  // MXNET_USE_OPENCV
  76. diff --git a/tools/im2rec.cc b/tools/im2rec.cc
  77. index 915b78029c8..beae75361c4 100644
  78. --- a/tools/im2rec.cc
  79. +++ b/tools/im2rec.cc
  80. @@ -85,9 +85,9 @@ int main(int argc, char *argv[]) {
  81.    int partid = 0;
  82.    int center_crop = 0;
  83.    int quality = 95;
  84. -  int color_mode = CV_LOAD_IMAGE_COLOR;
  85. +  int color_mode = cv::IMREAD_COLOR;
  86.    int unchanged = 0;
  87. -  int inter_method = CV_INTER_LINEAR;
  88. +  int inter_method = cv::INTER_LINEAR;
  89.    std::string encoding(".jpg");
  90.    for (int i = 4; i < argc; ++i) {
  91.      char key[128], val[128];
  92. @@ -192,11 +192,11 @@ int main(int argc, char *argv[]) {
  93.    std::vector<unsigned char> encode_buf;
  94.    std::vector<int> encode_params;
  95.    if (encoding == std::string(".png")) {
  96. -      encode_params.push_back(CV_IMWRITE_PNG_COMPRESSION);
  97. +      encode_params.push_back(cv::IMWRITE_PNG_COMPRESSION);
  98.        encode_params.push_back(quality);
  99.        LOG(INFO) << "PNG encoding compression: " << quality;
  100.    } else {
  101. -      encode_params.push_back(CV_IMWRITE_JPEG_QUALITY);
  102. +      encode_params.push_back(cv::IMWRITE_JPEG_QUALITY);
  103.        encode_params.push_back(quality);
  104.        LOG(INFO) << "JPEG encoding quality: " << quality;
  105.    }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×