Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cmake opencv 4 support #3

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Add cmake opencv 4 support #3

wants to merge 5 commits into from

Conversation

ambersun1234
Copy link

Add opencv4 support in cmake compilation process

opencv3 to 4 had changed some of the variable name
causing the compilation failed.
I've add some of the switch to overcome these kind of error

in CMakeLists.txt file, there is a option to enable build opencv4 or not

caffe_option(OPENCV_VERSION4 "Build with OpenCV4 support" ON)                 

@gineshidalgo99
Copy link
Member

gineshidalgo99 commented Nov 18, 2020

OpenPose does not need Caffe with OpenCV, so this PR is not high priority for me to be involved on it. However, I would be happy to accept it if the following changes are made:

  • It should not be a CMake flag. This would require the user knowledge and manual switching (error prone). You can read the OpenCV version with C++ macros, and apply it automatically in the code without the CMake flag. I actually do this in OpenPose.
  • I see "// #include "opencv2/imgcodecs/imgcodecs.hpp"" commented out all over the code. It should simply be removed then.
  • Rather than using #define CV_LOAD_IMAGE_COLOR cv::IMREAD_COLOR in every single file, there should be a new header file that does the following:
  #ifdef OPENCV_VERSION4
    #define CV_LOAD_IMAGE_COLOR cv::IMREAD_COLOR
    #define CV_LOAD_IMAGE_GRAYSCALE cv::IMREAD_GRAYSCALE
  #endif

And then all other files should simply include this new header. (I also do this in OpenPose itself)

With the 3 changes above i'll happily merge it!

@ambersun1234
Copy link
Author

@gineshidalgo99 All of the above issue had been corrected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants