0

I recently overtook an aruco tag detection project from a coworker and I am having trouble compiling it. The actual developer of this algorithm claims that it compiles on her PC so I believe I have a setup issue. I tested the OpenCV installation by writing a simple image processing code and it worked fine however I am receiving 3 errors related the aruco library in particular. The errors are as follows:

detect_markers.cpp: In function ‘bool readDetectorParameters(std::__cxx11::string, cv::Ptr<cv::aruco::DetectorParameters>&)’:
detect_markers.cpp:128:45: error: ‘struct cv::aruco::DetectorParameters’ has no member named ‘cornerRefinementMethod’
fs["cornerRefinementMethod"] >> params->cornerRefinementMethod;

detect_markers.cpp: In function ‘int main(int, char**)’:
detect_markers.cpp:167:21: error: ‘struct cv::aruco::DetectorParameters’ has no member named ‘cornerRefinementMethod’
detectorParams->cornerRefinementMethod = aruco::CORNER_REFINE_SUBPIX; // do corner refinement in markers

detect_markers.cpp:167:46: error: ‘CORNER_REFINE_SUBPIX’ is not a member of ‘cv::aruco’
detectorParams->cornerRefinementMethod = aruco::CORNER_REFINE_SUBPIX; 

I checked the cv::aruco::DetectorParameters Struct Reference and cornerRefinementMethod is actually a member of cv::aruco::DetectorParameters.

The code that I am trying to compile is a modified version of the detect_markers.cpp code that can be found here.

csg
  • 8,096
  • 3
  • 14
  • 38
  • Which version of OpenCV are you building it with? – Dan Mašek May 27 '19 at 00:35
  • @DanMašek OpenCV3. I followed this tutorial: https://www.learnopencv.com/install-opencv3-on-ubuntu/ – csg May 27 '19 at 00:37
  • What's the full version number (there are quite a few releases that where the major version is 3)? `3.3.1` that the tutorial you refer to uses? – Dan Mašek May 27 '19 at 00:39
  • @DanMašek I have version `3.2.0` installed. – csg May 27 '19 at 00:43
  • Then you're reading the wrong version of documentation and also referring to a much more recent version of the sample code. Look at the [docs from 3.2.0](https://docs.opencv.org/3.2.0/d1/dcd/structcv_1_1aruco_1_1DetectorParameters.html) -- there really isn't any member named `cornerRefinementMethod`. It seems it was added in 3.3.0. – Dan Mašek May 27 '19 at 00:49
  • @DanMašek thanks for pointing that out. I will install `3.3.x` and try building again. – csg May 27 '19 at 00:52
  • No problem. Best idea would be to check with your colleague what version of OpenCV they use (or even better, what version is used in production builds) and use the same one. It would probably be a good idea to document that somewhere (at least a README file in the source repo), so this issue can be avoided in the future. – Dan Mašek May 27 '19 at 00:53
  • @DanMašek I've just installed `3.3.1` instead of `3.2.0` but the same error still persists. Do you have any other suggestions? – csg May 27 '19 at 02:09
  • 1
    Looking at the [source code](https://github.com/opencv/opencv_contrib/blob/3.3.1/modules/aruco/include/opencv2/aruco.hpp#L145) of that specific version in the official repository, that member variable is there. Make sure that you're actually using the right version of the header files (not some leftovers from the 3.2.0). Check the include path and grep for the member variable name in that sub-tree. – Dan Mašek May 27 '19 at 02:26

0 Answers0