ravijo / ros_openpose

ROS wrapper for OpenPose
MIT License
142 stars 63 forks source link

Error while compiling : error: no match for ‘operator=’ (operand types are ‘op::Matrix’ and ‘const cv::Mat’) #10

Closed magi-dalmau closed 4 years ago

magi-dalmau commented 4 years ago

Hi, i'm trying to compile ros_openpose with this hardware and software:

I've seen in your troubleshooting section the same error that i'm getting from my compiler but i've tryed the proposed solution (install a recent version of openpose) unsuccesfully...

I would really appreciate if you could you help me please. I remain at your disposal for any questions do you have.

Plese find bellow all the error throwed by the compilator:

(*NOTE: (---) = catkin workspace directory)

Scanning dependencies of target ros_openpose_generate_messages_lisp
[ 78%] Generating Lisp code from ros_openpose/Pixel.msg
(---) /src/ros_openpose/src/rosOpenpose.cpp: In member function ‘virtual sPtrVecSPtrDatum WUserInput::workProducer()’:
(---) /src/ros_openpose/src/rosOpenpose.cpp:74:33: error: no match for ‘operator=’ (operand types are ‘op::Matrix’ and ‘const cv::Mat’)
           datumPtr->cvInputData = colorImage;
                                 ^
In file included from /usr/local/include/openpose/core/array.hpp:7:0,
                 from /usr/local/include/openpose/core/common.hpp:10,
                 from /usr/local/include/openpose/3d/cameraParameterReader.hpp:4,
                 from /usr/local/include/openpose/3d/headers.hpp:5,
                 from /usr/local/include/openpose/headers.hpp:5,
                 from (---) /src/ros_openpose/src/rosOpenpose.cpp:23:
/usr/local/include/openpose/core/matrix.hpp:95:18: note: candidate: op::Matrix& op::Matrix::operator=(const op::Matrix&)
     class OP_API Matrix
                  ^
/usr/local/include/openpose/core/matrix.hpp:95:18: note:   no known conversion for argument 1 from ‘const cv::Mat’ to ‘const op::Matrix&’
/usr/local/include/openpose/core/matrix.hpp:95:18: note: candidate: op::Matrix& op::Matrix::operator=(op::Matrix&&)
/usr/local/include/openpose/core/matrix.hpp:95:18: note:   no known conversion for argument 1 from ‘const cv::Mat’ to ‘op::Matrix&&’
(---) /src/ros_openpose/src/rosOpenpose.cpp: In function ‘void configureOpenPose(op::Wrapper&, const std::shared_ptr<ros_openpose::CameraReader>&, const ros::Publisher&, const string&, bool)’:
(---) /src/ros_openpose/src/rosOpenpose.cpp:263:5: error: ‘check’ is not a member of ‘op’
     op::check(0 <= FLAGS_logging_level && FLAGS_logging_level <= 255,
     ^
(---) /src/ros_openpose/src/rosOpenpose.cpp:263:5: note: suggested alternative:
In file included from /opt/ros/kinetic/include/ros/ros.h:52:0,
                 from (---) /src/ros_openpose/src/rosOpenpose.cpp:15:
/opt/ros/kinetic/include/ros/master.h:80:18: note:   ‘ros::master::check’
 ROSCPP_DECL bool check();
                  ^
(---) /src/ros_openpose/src/rosOpenpose.cpp:274:78: error: invalid initialization of reference of type ‘const op::String&’ from expression of type ‘fLS::clstring {aka std::__cxx11::basic_string<char>}’
     const auto outputSize = op::flagsToPoint(FLAGS_output_resolution, "-1x-1");
                                                                              ^
In file included from /usr/local/include/openpose/utilities/headers.hpp:10:0,
                 from /usr/local/include/openpose/headers.hpp:44,
                 from (---) src/ros_openpose/src/rosOpenpose.cpp:23:
/usr/local/include/openpose/utilities/flagsToOpenPose.hpp:41:23: note: in passing argument 1 of ‘op::Point<int> op::flagsToPoint(const op::String&, const op::String&)’
     OP_API Point<int> flagsToPoint(const String& pointString, const String& pointExample = String("1280x720"));
                       ^
(---) /src/ros_openpose/src/rosOpenpose.cpp:277:78: error: invalid initialization of reference of type ‘const op::String&’ from expression of type ‘fLS::clstring {aka std::__cxx11::basic_string<char>}’
     const auto netInputSize = op::flagsToPoint(FLAGS_net_resolution, "-1x368");
                                                                              ^
In file included from /usr/local/include/openpose/utilities/headers.hpp:10:0,
                 from /usr/local/include/openpose/headers.hpp:44,
                 from (---) /src/ros_openpose/src/rosOpenpose.cpp:23:
/usr/local/include/openpose/utilities/flagsToOpenPose.hpp:41:23: note: in passing argument 1 of ‘op::Point<int> op::flagsToPoint(const op::String&, const op::String&)’
     OP_API Point<int> flagsToPoint(const String& pointString, const String& pointExample = String("1280x720"));
                       ^
(---) /src/ros_openpose/src/rosOpenpose.cpp:280:106: error: invalid initialization of reference of type ‘const op::String&’ from expression of type ‘fLS::clstring {aka std::__cxx11::basic_string<char>}’
     const auto faceNetInputSize = op::flagsToPoint(FLAGS_face_net_resolution, "368x368 (multiples of 16)");
                                                                                                          ^
In file included from /usr/local/include/openpose/utilities/headers.hpp:10:0,
                 from /usr/local/include/openpose/headers.hpp:44,
                 from (---) /src/ros_openpose/src/rosOpenpose.cpp:23:
/usr/local/include/openpose/utilities/flagsToOpenPose.hpp:41:23: note: in passing argument 1 of ‘op::Point<int> op::flagsToPoint(const op::String&, const op::String&)’
     OP_API Point<int> flagsToPoint(const String& pointString, const String& pointExample = String("1280x720"));
                       ^
(---) /src/ros_openpose/src/rosOpenpose.cpp:283:106: error: invalid initialization of reference of type ‘const op::String&’ from expression of type ‘fLS::clstring {aka std::__cxx11::basic_string<char>}’
     const auto handNetInputSize = op::flagsToPoint(FLAGS_hand_net_resolution, "368x368 (multiples of 16)");
                                                                                                          ^
In file included from /usr/local/include/openpose/utilities/headers.hpp:10:0,
                 from /usr/local/include/openpose/headers.hpp:44,
                 from(---) /src/ros_openpose/src/rosOpenpose.cpp:23:
/usr/local/include/openpose/utilities/flagsToOpenPose.hpp:41:23: note: in passing argument 1 of ‘op::Point<int> op::flagsToPoint(const op::String&, const op::String&)’
     OP_API Point<int> flagsToPoint(const String& pointString, const String& pointExample = String("1280x720"));
                       ^
(---) /src/ros_openpose/src/rosOpenpose.cpp:289:65: error: invalid initialization of reference of type ‘const op::String&’ from expression of type ‘fLS::clstring {aka std::__cxx11::basic_string<char>}’
     const auto poseModel = op::flagsToPoseModel(FLAGS_model_pose);
                                                                 ^
In file included from /usr/local/include/openpose/utilities/headers.hpp:10:0,
                 from /usr/local/include/openpose/headers.hpp:44,
                 from(---) /src/ros_openpose/src/rosOpenpose.cpp:23:
/usr/local/include/openpose/utilities/flagsToOpenPose.hpp:15:22: note: in passing argument 1 of ‘op::PoseModel op::flagsToPoseModel(const op::String&)’
     OP_API PoseModel flagsToPoseModel(const String& poseModeString);
                      ^
(---) /src/ros_openpose/src/rosOpenpose.cpp:354:70: error: no matching function for call to ‘op::WrapperStructPose::WrapperStructPose(<brace-enclosed initializer list>)’
                                                   enableGoogleLogging};
                                                                      ^
In file included from /usr/local/include/openpose/wrapper/wrapper.hpp:13:0,
                 from /usr/local/include/openpose/wrapper/headers.hpp:6,
                 from /usr/local/include/openpose/headers.hpp:47,
                 from(---) /src/ros_openpose/src/rosOpenpose.cpp:23:
/usr/local/include/openpose/wrapper/wrapperStructPose.hpp:212:9: note: candidate: op::WrapperStructPose::WrapperStructPose(op::PoseMode, const op::Point<int>&, const op::Point<int>&, op::ScaleMode, int, int, int, float, op::RenderMode, op::PoseModel, bool, float, float, int, const op::String&, const std::vector<op::HeatMapType>&, op::ScaleMode, bool, float, int, bool, double, const op::String&, const op::String&, float, bool)
         WrapperStructPose(
         ^
/usr/local/include/openpose/wrapper/wrapperStructPose.hpp:212:9: note:   conversion of argument 2 would be ill-formed:
/usr/local/include/openpose/wrapper/wrapperStructPose.hpp:18:19: note: candidate: op::WrapperStructPose::WrapperStructPose(const op::WrapperStructPose&)
     struct OP_API WrapperStructPose
                   ^
/usr/local/include/openpose/wrapper/wrapperStructPose.hpp:18:19: note:   candidate expects 1 argument, 26 provided
/usr/local/include/openpose/wrapper/wrapperStructPose.hpp:18:19: note: candidate: op::WrapperStructPose::WrapperStructPose(op::WrapperStructPose&&)
/usr/local/include/openpose/wrapper/wrapperStructPose.hpp:18:19: note:   candidate expects 1 argument, 26 provided
(---) /src/ros_openpose/src/rosOpenpose.cpp:366:85: error: no matching function for call to ‘op::WrapperStructFace::WrapperStructFace(<brace-enclosed initializer list>)’
                                                   (float)FLAGS_face_render_threshold};
                                                                                     ^
In file included from /usr/local/include/openpose/wrapper/wrapper.hpp:8:0,
                 from /usr/local/include/openpose/wrapper/headers.hpp:6,
                 from /usr/local/include/openpose/headers.hpp:47,
                 from (---) /src/ros_openpose/src/rosOpenpose.cpp:23:
/usr/local/include/openpose/wrapper/wrapperStructFace.hpp:69:9: note: candidate: op::WrapperStructFace::WrapperStructFace(bool, op::Detector, const op::Point<int>&, op::RenderMode, float, float, float)
         WrapperStructFace(
         ^
/usr/local/include/openpose/wrapper/wrapperStructFace.hpp:69:9: note:   conversion of argument 3 would be ill-formed:
/usr/local/include/openpose/wrapper/wrapperStructFace.hpp:16:19: note: candidate: op::WrapperStructFace::WrapperStructFace(const op::WrapperStructFace&)
     struct OP_API WrapperStructFace
                   ^
/usr/local/include/openpose/wrapper/wrapperStructFace.hpp:16:19: note:   candidate expects 1 argument, 7 provided
/usr/local/include/openpose/wrapper/wrapperStructFace.hpp:16:19: note: candidate: op::WrapperStructFace::WrapperStructFace(op::WrapperStructFace&&)
/usr/local/include/openpose/wrapper/wrapperStructFace.hpp:16:19: note:   candidate expects 1 argument, 7 provided
(---) /src/ros_openpose/src/rosOpenpose.cpp:380:85: error: no matching function for call to ‘op::WrapperStructHand::WrapperStructHand(<brace-enclosed initializer list>)’
                                                   (float)FLAGS_hand_render_threshold};
                                                                                     ^
In file included from /usr/local/include/openpose/wrapper/wrapper.hpp:10:0,
                 from /usr/local/include/openpose/wrapper/headers.hpp:6,
                 from /usr/local/include/openpose/headers.hpp:47,
                 from (---) /src/ros_openpose/src/rosOpenpose.cpp:23:
/usr/local/include/openpose/wrapper/wrapperStructHand.hpp:88:9: note: candidate: op::WrapperStructHand::WrapperStructHand(bool, op::Detector, const op::Point<int>&, int, float, op::RenderMode, float, float, float)
         WrapperStructHand(
         ^
/usr/local/include/openpose/wrapper/wrapperStructHand.hpp:88:9: note:   conversion of argument 3 would be ill-formed:
/usr/local/include/openpose/wrapper/wrapperStructHand.hpp:16:19: note: candidate: op::WrapperStructHand::WrapperStructHand(const op::WrapperStructHand&)
     struct OP_API WrapperStructHand
                   ^
/usr/local/include/openpose/wrapper/wrapperStructHand.hpp:16:19: note:   candidate expects 1 argument, 9 provided
/usr/local/include/openpose/wrapper/wrapperStructHand.hpp:16:19: note: candidate: op::WrapperStructHand::WrapperStructHand(op::WrapperStructHand&&)
/usr/local/include/openpose/wrapper/wrapperStructHand.hpp:16:19: note:   candidate expects 1 argument, 9 provided
(---) /src/ros_openpose/src/rosOpenpose.cpp:410:69: error: no matching function for call to ‘op::WrapperStructOutput::WrapperStructOutput(<brace-enclosed initializer list>)’
                                                       FLAGS_udp_port};
                                                                     ^
In file included from /usr/local/include/openpose/wrapper/wrapper.hpp:12:0,
                 from /usr/local/include/openpose/wrapper/headers.hpp:6,
                 from /usr/local/include/openpose/headers.hpp:47,
                 from (---) /src/ros_openpose/src/rosOpenpose.cpp:23:
/usr/local/include/openpose/wrapper/wrapperStructOutput.hpp:150:9: note: candidate: op::WrapperStructOutput::WrapperStructOutput(double, const op::String&, op::DataFormat, const op::String&, const op::String&, int, int, const op::String&, const op::String&, const op::String&, double, bool, const op::String&, const op::String&, const op::String&, const op::String&, const op::String&, const op::String&, const op::String&)
         WrapperStructOutput(
         ^
/usr/local/include/openpose/wrapper/wrapperStructOutput.hpp:150:9: note:   no known conversion for argument 2 from ‘fLS::clstring {aka std::__cxx11::basic_string<char>}’ to ‘const op::String&’
/usr/local/include/openpose/wrapper/wrapperStructOutput.hpp:13:19: note: candidate: op::WrapperStructOutput::WrapperStructOutput(const op::WrapperStructOutput&)
     struct OP_API WrapperStructOutput
                   ^
/usr/local/include/openpose/wrapper/wrapperStructOutput.hpp:13:19: note:   candidate expects 1 argument, 19 provided
/usr/local/include/openpose/wrapper/wrapperStructOutput.hpp:13:19: note: candidate: op::WrapperStructOutput::WrapperStructOutput(op::WrapperStructOutput&&)
/usr/local/include/openpose/wrapper/wrapperStructOutput.hpp:13:19: note:   candidate expects 1 argument, 19 provided
[ 82%] Generating Lisp code from ros_openpose/Person.msg
[ 85%] Generating Lisp code from ros_openpose/BodyPart.msg
[ 89%] Generating Lisp code from ros_openpose/Frame.msg
[ 92%] Building CXX object ros_openpose/CMakeFiles/rosOpenpose.dir/src/cameraReader.cpp.o
[ 92%] Built target ros_openpose_generate_messages_lisp
Scanning dependencies of target ros_openpose_generate_messages
[ 92%] Built target ros_openpose_generate_messages
ros_openpose/CMakeFiles/rosOpenpose.dir/build.make:82: recipe for target 'ros_openpose/CMakeFiles/rosOpenpose.dir/src/rosOpenpose.cpp.o' failed
make[2]: *** [ros_openpose/CMakeFiles/rosOpenpose.dir/src/rosOpenpose.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
[ 96%] Linking CXX executable (---) /devel/lib/ros_openpose/testCameraReader
/usr/bin/ld: cannot find -lThreads::Threads
collect2: error: ld returned 1 exit status
ros_openpose/CMakeFiles/testCameraReader.dir/build.make:177: recipe for target '(---) 
 /devel/lib/ros_openpose/testCameraReader' failed
make[2]: *** [(---) /devel/lib/ros_openpose/testCameraReader] Error 1
CMakeFiles/Makefile2:1442: recipe for target 'ros_openpose/CMakeFiles/testCameraReader.dir/all' failed
make[1]: *** [ros_openpose/CMakeFiles/testCameraReader.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
CMakeFiles/Makefile2:1555: recipe for target 'ros_openpose/CMakeFiles/rosOpenpose.dir/all' failed
make[1]: *** [ros_openpose/CMakeFiles/rosOpenpose.dir/all] Error 2
Makefile:160: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j4 -l4" failed
ravijo commented 4 years ago

Hi @magi-dalmau

The error is generated due to the improper installation of OpenPose software.

  1. Can you first remove OpenPose completely
  2. And then try to checkout OpenPose version 1.5.1

Do not forget to run sudo make install to install the OpenPose system-wide. I highly recommend you to look at a similar question here.

Let me know the outcome, please!

ravijo commented 4 years ago

Hi @magi-dalmau

Since I couldn't hear from you, I am going to close the issue. Please feel free to open and comment if the issue persists.

kledom commented 4 years ago

I'm having the same problem with

Downgrading to OpenPose 1.5.1 fixed the issue.

ravijo commented 4 years ago

Hi @kledom

Thank you very much for the information.

I checked the deployment and release notes of OpenPose 1.6.0 and found that OpenPose has modified the code to get rid of OpenCV in its headers.

OpenPose 1.6.0 has introduced many new preprocessors. The preprocessor OP_CV2OPCONSTMAT is important for ros_openpose. I believe that if we change this line with the following code, we should be good to go again-

datumPtr->cvInputData = OP_CV2OPCONSTMAT(colorImage);

However, keep in mind that due to the COVID-19 pandemic, I cannot test the above workaround. I do not have access to my PC at the laboratory.

kledom commented 4 years ago

I think there will be some more probems with 1.6.0. For instance, op::check was replace with op::checkBool.

ravijo commented 4 years ago

Hi @kledom

Thank you very much.

For instance, op::check was replace with op::checkBool.

Noted it. I will make some workaround. For now, we should keep using OpenPose 1.5.1.