image_pipeline icon indicating copy to clipboard operation
image_pipeline copied to clipboard

image_proc's TrackMarkerNode requires OpenCV 4.5.1 or greater

Open tedsteiner opened this issue 5 months ago • 4 comments

The TrackMarkerNode includes the OpenCV header <opencv2/core/quaternion.hpp>. Currently the image_proc CMakeLists.txt file specifies that OpenCV 3.2.0 is the minimum required version. However, quaternion.hpp wasn't added to OpenCV until version 4.5.1. The result is a compiler error on earlier versions of OpenCV, such as those provided by Ubuntu 20.04 (4.2.0).

At first I thought this was maybe just a header left unintentionally because it's a bit subtle, but here's where the OpenCV quaternion header is used:

      // Convert angle-axis to quaternion
      cv::Quatd q = cv::Quatd::createFromRvec(rvecs[0]);
      pose.pose.orientation.x = q.x;
      pose.pose.orientation.y = q.y;
      pose.pose.orientation.z = q.z;
      pose.pose.orientation.w = q.w;
      pub_->publish(pose);

Is there maybe some other code that already exists somewhere to do this conversion without using the cv::Quatd class?

This causes a build error when trying to build ROS 2 Jazzy from source with the perception variant on Ubuntu 20.04 with the Apt-provided version of libopencv-dev. The original merge request was here: https://github.com/ros-perception/image_pipeline/pull/930

tedsteiner avatar Sep 04 '24 22:09 tedsteiner