diff options
author | Achal <achalshah20@gmail.com> | 2018-10-15 17:40:10 -0700 |
---|---|---|
committer | Facebook Github Bot <facebook-github-bot@users.noreply.github.com> | 2018-10-15 17:42:04 -0700 |
commit | 01a333fd7f45beec386a466604fa5f85c2ee0643 (patch) | |
tree | 26708147cc0849f7d5e2be1acc4dce4efc53e1cd /binaries | |
parent | 083e037dea1a149e908218afc86588454a9aeb21 (diff) | |
download | pytorch-01a333fd7f45beec386a466604fa5f85c2ee0643.tar.gz pytorch-01a333fd7f45beec386a466604fa5f85c2ee0643.tar.bz2 pytorch-01a333fd7f45beec386a466604fa5f85c2ee0643.zip |
OpenCV 4.0 Compatibility fix (#9966)
Summary:
caffe2 compiles with latest opencv 4.0 after committed changes.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/9966
Differential Revision: D10369130
Pulled By: ezyang
fbshipit-source-id: 9a104803edca5a22e27e140a794e4b8c878ca416
Diffstat (limited to 'binaries')
-rw-r--r-- | binaries/convert_encoded_to_raw_leveldb.cc | 6 | ||||
-rw-r--r-- | binaries/make_image_db.cc | 3 |
2 files changed, 5 insertions, 4 deletions
diff --git a/binaries/convert_encoded_to_raw_leveldb.cc b/binaries/convert_encoded_to_raw_leveldb.cc index 6b93a6ebb4..b14ad9c2d0 100644 --- a/binaries/convert_encoded_to_raw_leveldb.cc +++ b/binaries/convert_encoded_to_raw_leveldb.cc @@ -108,9 +108,9 @@ void ConvertToRawDataset( const string& encoded_image = input_protos.protos(0).string_data(0); int encoded_size = encoded_image.size(); cv::Mat img = cv::imdecode( - cv::Mat( - 1, &encoded_size, CV_8UC1, const_cast<char*>(encoded_image.data())), - c10::FLAGS_color ? CV_LOAD_IMAGE_COLOR : CV_LOAD_IMAGE_GRAYSCALE); + cv::Mat(1, &encoded_size, CV_8UC1, + const_cast<char*>(encoded_image.data())), + c10::FLAGS_color ? cv::IMREAD_COLOR : cv::IMREAD_GRAYSCALE); cv::Mat resized_img; int scaled_width, scaled_height; if (c10::FLAGS_warp) { diff --git a/binaries/make_image_db.cc b/binaries/make_image_db.cc index fe5ee89df4..8c9d6bd747 100644 --- a/binaries/make_image_db.cc +++ b/binaries/make_image_db.cc @@ -144,7 +144,8 @@ class Converter { // Load image cv::Mat img = cv::imread( input_folder + pair.first, - c10::FLAGS_color ? CV_LOAD_IMAGE_COLOR : CV_LOAD_IMAGE_GRAYSCALE); + c10::FLAGS_color ? cv::IMREAD_COLOR + : cv::IMREAD_GRAYSCALE); // Resize image cv::Mat resized_img; |