Skip to content

Commit

Permalink
Macro issue in openCvMultiversionHeaders.hpp that makes CV4+ not co…
Browse files Browse the repository at this point in the history
…mpatible (CMU-Perceptual-Computing-Lab#1491)

In old versions, variables like `CV_IMWRITE_JPEG_QUALITY` are "enum"s not "define"s. Hence, "ifdef"s here are useless here and will make OpenCV4.0+(non-alpha/beta version) not able to compile. This can be fixed by detecting the macro `cvvConvertImage` which is along with CV_LOAD_xxx & CV_IMWRITE_xxx in old versions :)
  • Loading branch information
ganler authored Apr 4, 2020
1 parent b1ca9af commit d4db1c9
Showing 1 changed file with 5 additions and 16 deletions.
21 changes: 5 additions & 16 deletions include/openpose_private/utilities/openCvMultiversionHeaders.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,12 @@
#define CV_WINDOW_NORMAL cv::WINDOW_NORMAL
#define CV_WINDOW_OPENGL cv::WINDOW_OPENGL
#define CV_WND_PROP_FULLSCREEN cv::WND_PROP_FULLSCREEN
// Required for alpha and beta versions, but not for rc version
#include <opencv2/imgcodecs/imgcodecs.hpp>
#ifndef CV_IMWRITE_JPEG_QUALITY
#define CV_IMWRITE_JPEG_QUALITY cv::IMWRITE_JPEG_QUALITY
#endif
#ifndef CV_IMWRITE_PNG_COMPRESSION
#define CV_IMWRITE_PNG_COMPRESSION cv::IMWRITE_PNG_COMPRESSION
#endif
#ifndef CV_LOAD_IMAGE_ANYDEPTH
#define CV_LOAD_IMAGE_ANYDEPTH cv::IMREAD_ANYDEPTH
#endif
#ifndef CV_LOAD_IMAGE_COLOR
#define CV_LOAD_IMAGE_COLOR cv::IMREAD_COLOR
#endif
#ifndef CV_LOAD_IMAGE_GRAYSCALE
#define CV_LOAD_IMAGE_GRAYSCALE cv::IMREAD_GRAYSCALE
#endif
#define CV_IMWRITE_JPEG_QUALITY cv::IMWRITE_JPEG_QUALITY
#define CV_IMWRITE_PNG_COMPRESSION cv::IMWRITE_PNG_COMPRESSION
#define CV_LOAD_IMAGE_ANYDEPTH cv::IMREAD_ANYDEPTH
#define CV_LOAD_IMAGE_COLOR cv::IMREAD_COLOR
#define CV_LOAD_IMAGE_GRAYSCALE cv::IMREAD_GRAYSCALE
#endif

#endif // OPENPOSE_PRIVATE_UTILITIES_OPENCV_MULTIVERSION_HEADERS_HPP

0 comments on commit d4db1c9

Please sign in to comment.