嗨
我正在尝试使用Visual Studio 2019在Windows 10上运行OpenCV和Aruco,
使用cmake安装opencv和contrib,然后进行构建,没问题,
并且我有C:\ openCV \ build \ install \ x64 \ vc16 \ bin \ opencv_aruco411d.dll库,
关于Windows 10的环境变量:
OPENCV_DIR = C:\ openCV \ build \ install \ x64 \ vc16
PATH变量包括%OPENCV_DIR%\ bin
在Visual Studio中,我已经:
Linker --> Input --> Addictional dipendence contains "opencv_aruco411d.lib"
Linker --> General --> Addictional library directory contains "$(OPENCV_DIR)\lib"
C/C++ --> General --> Addictional inclusion directory contains "$(OPENCV_DIR)\..\..\include"
但是当我使用简单的第一个程序时:
我没有找到aruco.h
#include "aruco.h"
#include <iostream>
#include <opencv2/highgui/highgui.hpp>
int main(int argc,char **argv){
if (argc != 2 ){ std::cerr<<"Usage: inimage"<<std::endl;return -1;}
cv::Mat image=cv::imread(argv[1]);
aruco::MarkerDetector MDetector;
//detect
std::vector<aruco::Marker> markers=MDetector.detect(image);
//print info to console
for(size_t i=0;i<markers.size();i++){
std::cout<<markers[i]<<std::endl;
//draw in the image
markers[i].draw(image);
cv::imshow("image",image);
cv::waitKey(0);
}
哪里出问题了?
安东尼奥
答案 0 :(得分:0)
库编译是通过
完成的C:\aruco-3.1.2;
mkdir build;
cd build ;
cmake .. -DOpenCV_DIR=C:\openCV\build;
但是VisualStudio解决方案aruco.sln会产生很多链接器错误
Errore LNK2019 riferimento al simbolo esterno "bool __cdecl cv::imwrite(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class cv::debug_build_guard::_InputArray const &,class std::vector<int,class std::allocator<int> > const &)" (?imwrite@cv@@YA_NAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV_InputArray@debug_build_guard@1@AEBV?$vector@HV?$allocator@H@std@@@3@@Z) non risolto nella funzione main aruco_create_markermap C:\aruco-3.1.2\build\utils_markermap\aruco_create_markermap.obj 1
并且似乎不可能将针对它的属性表应用于opencv。