Incubator-mxnet: compile error in "image_aug_default.cc"

Created on 10 Aug 2018  Â·  4Comments  Â·  Source: apache/incubator-mxnet

I build mxnet from source on ubuntu 14.04+cuda8.0+cudnn5, and meet the following error when compiling. It seems like an opencv error, but I have installed opencv3.1 , how to solve it?

src/io/image_aug_default.cc: In member function ‘virtual cv::Mat mxnet::io::DefaultImageAugmenter::Process(const cv::Mat&, std::vector, mxnet::common::RANDOM_ENGINE)’:
src/io/image_aug_default.cc:483:32: error: ‘CV_RGB2GRAY’ was not declared in this scope
cvtColor(res, temp_, CV_RGB2GRAY);
^
src/io/image_aug_default.cc:489:32: error: ‘CV_RGB2GRAY’ was not declared in this scope
cvtColor(res, temp_, CV_RGB2GRAY);
^
src/io/image_aug_default.cc:490:34: error: ‘CV_GRAY2BGR’ was not declared in this scope
cvtColor(temp_, temp_, CV_GRAY2BGR);
^
src/io/image_aug_default.cc:499:26: error: ‘CV_BGR2HLS’ was not declared in this scope
cvtColor(res, res, CV_BGR2HLS);
^
src/io/image_aug_default.cc:519:26: error: ‘CV_HLS2BGR’ was not declared in this scope
cvtColor(res, res, CV_HLS2BGR);
^

Build

Most helpful comment

Hi, you can try do something like this:

1 image_augmenter.h

#if MXNET_USE_OPENCV
#include <opencv2/opencv.hpp>
+    #include <opencv2/imgproc/types_c.h>
#include // NOLINT()
#include // NOLINT()
#include // NOLINT(*)

2 image_io.cc

#if MXNET_USE_OPENCV
#include <opencv2/opencv.hpp>
+    #include <opencv2/imgproc/types_c.h>
#endif // MXNET_USE_OPENCV

All 4 comments

You can change the code in image_aug_default.cc.
CV_RGB2GRAY -------> cv::COLOR_RGB2GRAY
CV_GRAY2BGR -------> cv::COLOR_GRAY2BGR
CV_BGR2HLS -------> cv::COLOR_BGR2HLS

Hi @liangxi627 looks like this is an OpenCV Version issue. Currently MXNet CI is working on Ubuntu 16.04 version, please try this alternative if you cannot make it with the current solution.
@szha have you seen similar issues as this one before?

@mxnet-label-bot please add [build] in here

Hi, you can try do something like this:

1 image_augmenter.h

#if MXNET_USE_OPENCV
#include <opencv2/opencv.hpp>
+    #include <opencv2/imgproc/types_c.h>
#include // NOLINT()
#include // NOLINT()
#include // NOLINT(*)

2 image_io.cc

#if MXNET_USE_OPENCV
#include <opencv2/opencv.hpp>
+    #include <opencv2/imgproc/types_c.h>
#endif // MXNET_USE_OPENCV

@nuaawzl It works, thanks!

Was this page helpful?
0 / 5 - 0 ratings