Closed gorghino closed 11 months ago
I need to spend some time to test out both Ubuntu 22.02 and the newer OpenCV to get it to support all the version. If you are able to address it, feel free to post the solution (or link to it).
Hi @goldbattle , I'm using Ubuntu 20.04 but I'll tell you if I find the solution. Thank you!
The following solution works for me:
start from ov_core/track/TrackAruco.h
line 106
cv::Ptr<cv::aruco::Dictionary> aruco_dict;
to cv::aruco::Dictionary aruco_dict;
cv::Ptr<cv::aruco::DetectorParameters> aruco_params;
to cv::aruco::DetectorParameters aruco_params;
cv::aruco::ArucoDetector aruco_detector;
belowAlso in ov_core/track/TrackAruco.cpp
line 97
change cv::aruco::detectMarkers(img0, aruco_dict, corners[cam_id], ids_aruco[cam_id], aruco_params, rejects[cam_id]);
to aruco_detector.detectMarkers(img0, corners[cam_id], ids_aruco[cam_id], rejects[cam_id]);
Hi @ZibYang Your fix removed Ptr errors but not this one:
Starting >>> ov_core
Starting >>> ov_data
Finished <<< ov_data [1.45s]
--- stderr: ov_core
In file included from /home/nvidia/ws_openVINS/src/open_vins/ov_core/src/track/TrackAruco.cpp:22:
/home/nvidia/ws_openVINS/src/open_vins/ov_core/src/track/TrackAruco.h: In constructor ‘ov_core::TrackAruco::TrackAruco(std::unordered_map<long unsigned int, std::shared_ptr<ov_core::CamBase> >, int, bool, ov_core::TrackBase::HistogramMethod, bool)’:
/home/nvidia/ws_openVINS/src/open_vins/ov_core/src/track/TrackAruco.h:59:51: error: ‘create’ is not a member of ‘cv::aruco::DetectorParameters’
59 | aruco_params = cv::aruco::DetectorParameters::create();
| ^~~~~~
make[2]: *** [CMakeFiles/ov_core_lib.dir/build.make:146: CMakeFiles/ov_core_lib.dir/src/track/TrackAruco.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:141: CMakeFiles/ov_core_lib.dir/all] Error 2
make: *** [Makefile:146: all] Error 2
---
Failed <<< ov_core [24.7s, exited with code 2]
Summary: 1 package finished [25.9s]
1 package failed: ov_core
1 package had stderr output: ov_core
3 packages not processed
I believe you can just remove the line and it will use the default constructor: https://github.com/opencv/opencv/blob/86fa0308fc17f982cf9aa291b5e53e7b9e71e0be/modules/objdetect/include/opencv2/objdetect/aruco_detector.hpp#L23-L59
It looks like you will need to make a ArucoDetector
object (untested code, just a guess here):
aruco::Dictionary aruco_dict = aruco::getPredefinedDictionary(aruco::DICT_6X6_1000);
aruco::DetectorParameters aruco_params;
aruco_params.cornerRefinementMethod = cv::aruco::CORNER_REFINE_SUBPIX;
aruco_detector = aruco::ArucoDetector(aruco_dict, aruco_params);
and use it as:
aruco_detector.detectMarkers(img0, corners[cam_id], ids_aruco[cam_id], rejects[cam_id]);
Hi @ZibYang Your fix removed Ptr errors but not this one:
Starting >>> ov_core Starting >>> ov_data Finished <<< ov_data [1.45s] --- stderr: ov_core In file included from /home/nvidia/ws_openVINS/src/open_vins/ov_core/src/track/TrackAruco.cpp:22: /home/nvidia/ws_openVINS/src/open_vins/ov_core/src/track/TrackAruco.h: In constructor ‘ov_core::TrackAruco::TrackAruco(std::unordered_map<long unsigned int, std::shared_ptr<ov_core::CamBase> >, int, bool, ov_core::TrackBase::HistogramMethod, bool)’: /home/nvidia/ws_openVINS/src/open_vins/ov_core/src/track/TrackAruco.h:59:51: error: ‘create’ is not a member of ‘cv::aruco::DetectorParameters’ 59 | aruco_params = cv::aruco::DetectorParameters::create(); | ^~~~~~ make[2]: *** [CMakeFiles/ov_core_lib.dir/build.make:146: CMakeFiles/ov_core_lib.dir/src/track/TrackAruco.cpp.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:141: CMakeFiles/ov_core_lib.dir/all] Error 2 make: *** [Makefile:146: all] Error 2 --- Failed <<< ov_core [24.7s, exited with code 2] Summary: 1 package finished [25.9s] 1 package failed: ov_core 1 package had stderr output: ov_core 3 packages not processed
Sorry about that. You should also change line 59 at ov_core/track/TrackAruco.h
from aruco_params = cv::aruco::DetectorParameters::create();
to aruco_params = cv::aruco::DetectorParameters();
And I believe that error will disappear~ enjoy your day!
ps. My reference is from: https://docs.opencv.org/4.x/d5/dae/tutorial_aruco_detection.html
Hi! I built OpenCV 4.7 from the sources (with contrib) but OpenVINS build fails if ENABLE_ARUCO_TAGS is ON:
I think it's a problem related to the aruco library that is not in contrib anymore. I think it's in opencv2/objdetect module now. Adding
in TrackAruco.h doesn't fix the problem.