On RHEL 9, opencv-4.6.0-7.el9.x86_64 there is this representative build error.
src/caffe/util/io.cpp:76:34: error: ‘CV_LOAD_IMAGE_COLOR’ was not declared in this scope
76 | int cv_read_flag = (is_color ? CV_LOAD_IMAGE_COLOR :
The header containing this enum has moved to
opencv4/opencv2/imgcodecs/legacy/constants_c.h
And is no longer in the include path.
The replacement mappings are
CV_LOAD_IMAGE_COLOR -> IMREAD_COLOR
CV_LOAD_IMAGE_GRAYSCALE -> IMREAD_GRAYSCALE
from
./opencv4/opencv2/imgcodecs/legacy/constants_c.h
CV_LOAD_IMAGE_GRAYSCALE =0,
CV_LOAD_IMAGE_COLOR =1,
to
./opencv2/imgcodecs.hpp
IMREAD_GRAYSCALE = 0, //!< If set, always convert image to the single channel grayscale image (codec internal conversion).
IMREAD_COLOR = 1, //!< If set, always convert image to the 3 channel BGR color image.
On RHEL 9, opencv-4.6.0-7.el9.x86_64 there is this representative build error.
src/caffe/util/io.cpp:76:34: error: ‘CV_LOAD_IMAGE_COLOR’ was not declared in this scope 76 | int cv_read_flag = (is_color ? CV_LOAD_IMAGE_COLOR :
The header containing this enum has moved to opencv4/opencv2/imgcodecs/legacy/constants_c.h And is no longer in the include path.
The replacement mappings are CV_LOAD_IMAGE_COLOR -> IMREAD_COLOR CV_LOAD_IMAGE_GRAYSCALE -> IMREAD_GRAYSCALE
from ./opencv4/opencv2/imgcodecs/legacy/constants_c.h CV_LOAD_IMAGE_GRAYSCALE =0, CV_LOAD_IMAGE_COLOR =1, to ./opencv2/imgcodecs.hpp IMREAD_GRAYSCALE = 0, //!< If set, always convert image to the single channel grayscale image (codec internal conversion). IMREAD_COLOR = 1, //!< If set, always convert image to the 3 channel BGR color image.
Signed-off-by: Tom Rix trix@redhat.com