我在将旧的ArUco检测代码移植到新版本的OpenCV时遇到问题。尽管我使用了ArUco模块提供的方法,但我还是得到了ArUco模块的**getPredefinedDictionary()**函数的不合适的用户定义错误。因此,当我试图加载cv::ptr与预定义的字典像这样:
cv::Ptr<cv::aruco::Dictionary> arucoDictionary = cv::aruco::getPredefinedDictionary(cv::aruco::DICT_6X6_250);
我总是得到以下错误:
这些是我在头文件中使用的OpenCV包含:
#include <opencv2/imgproc.hpp>
#include <opencv2/features2d.hpp>
#include <opencv2/calib3d.hpp>
#include <opencv2/aruco.hpp>
#include <opencv2/objdetect.hpp>
从代码中删除cv::ptr解决了这个问题,但当我想在cv::aruco::detectMarkers
中使用这个字典时,也会在代码中引入新的问题。我想知道是否有可能像OpenCV的旧版本一样使用cv指针。
- 更多的上下文:* 我使用OpenCV 4.7和Contrib_4x,因为这是我可以成功编译和构建Visual Studio 2022forARM64平台的唯一版本。我也设置了包含目录、链接器和附加库。最初的应用程序是为x86平台和OpenCV 3构建的,现在我需要为ARM64构建它,所以我从头开始完全重新创建了解决方案和项目。
1条答案
按热度按时间vmdwslir1#
在阅读了@Christoph拉克维茨的建议后,我修改了代码,所以现在看起来像这样:
在此之后,我得到了新的错误,所以我用
-DBUILD_opencv_world=ON
选项重新编译了ARM 64的OpenCV 4.7,然后重新包含并重新链接了库,问题得到了解决。似乎是链接器找不到对应的库导致的错误。