Skip to content

Commit e0d6857

Browse files
committed
Fix CV flags
1 parent a8db656 commit e0d6857

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/caffe/layers/window_data_layer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ void WindowDataLayer<Dtype>::load_batch(Batch<Dtype>* batch) {
290290
image_database_cache_[window[WindowDataLayer<Dtype>::IMAGE_INDEX]];
291291
cv_img = DecodeDatumToCVMat(image_cached.second, true);
292292
} else {
293-
cv_img = cv::imread(image.first, CV_LOAD_IMAGE_COLOR);
293+
cv_img = cv::imread(image.first, cv::IMREAD_COLOR);
294294
if (!cv_img.data) {
295295
LOG(ERROR) << "Could not open or find file " << image.first;
296296
return;

src/caffe/test/test_io.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ class IOTest : public ::testing::Test {};
2020
bool ReadImageToDatumReference(const string& filename, const int label,
2121
const int height, const int width, const bool is_color, Datum* datum) {
2222
cv::Mat cv_img;
23-
int cv_read_flag = (is_color ? CV_LOAD_IMAGE_COLOR :
24-
CV_LOAD_IMAGE_GRAYSCALE);
23+
int cv_read_flag = (is_color ? cv::IMREAD_COLOR :
24+
cv::IMREAD_GRAYSCALE);
2525

2626
cv::Mat cv_img_origin = cv::imread(filename, cv_read_flag);
2727
if (!cv_img_origin.data) {

src/caffe/util/io.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ bool ReadProtoFromBinaryFile(const char* filename, Message* proto) {
5353
int fd = open(filename, O_RDONLY);
5454
CHECK_NE(fd, -1) << "File not found: " << filename;
5555
ZeroCopyInputStream* raw_input = new FileInputStream(fd);
56-
CodedInputStream* coded_input = new CodedInputStream(raw_input);
56+
CodedInputStream* coded_input = new CodedInputStream(raw_input);
5757
#if GOOGLE_PROTOBUF_VERSION >= 3011000
5858
// Only take one parameter since protobuf 3.11
5959
coded_input->SetTotalBytesLimit(kProtoReadBytesLimit);
@@ -79,8 +79,8 @@ void WriteProtoToBinaryFile(const Message& proto, const char* filename) {
7979
cv::Mat ReadImageToCVMat(const string& filename,
8080
const int height, const int width, const bool is_color) {
8181
cv::Mat cv_img;
82-
int cv_read_flag = (is_color ? CV_LOAD_IMAGE_COLOR :
83-
CV_LOAD_IMAGE_GRAYSCALE);
82+
int cv_read_flag = (is_color ? cv::IMREAD_COLOR :
83+
cv::IMREAD_COLOR);
8484
cv::Mat cv_img_origin = cv::imread(filename, cv_read_flag);
8585
if (!cv_img_origin.data) {
8686
LOG(ERROR) << "Could not open or find file " << filename;
@@ -185,8 +185,8 @@ cv::Mat DecodeDatumToCVMat(const Datum& datum, bool is_color) {
185185
CHECK(datum.encoded()) << "Datum not encoded";
186186
const string& data = datum.data();
187187
std::vector<char> vec_data(data.c_str(), data.c_str() + data.size());
188-
int cv_read_flag = (is_color ? CV_LOAD_IMAGE_COLOR :
189-
CV_LOAD_IMAGE_GRAYSCALE);
188+
int cv_read_flag = (is_color ? cv::IMREAD_COLOR :
189+
cv::IMREAD_GRAYSCALE);
190190
cv_img = cv::imdecode(vec_data, cv_read_flag);
191191
if (!cv_img.data) {
192192
LOG(ERROR) << "Could not decode datum ";

0 commit comments

Comments
 (0)