使用c ++中的aruco编译opencv2时出错

时间:2016-05-24 11:03:27

标签: c++ opencv g++ opencv3.0 aruco

我写了一个简单的代码,用于在aruco库中创建制作者

#include <opencv2/highgui/highgui.hpp>
#include <opencv2/aruco.hpp>

using namespace cv;

int main(int argc, char *argv[]) {


int dictionaryId = 100;
int markerId = 45;
int borderBits = 2;
int markerSize = 2450;
bool showImage = true;

cv::Ptr<aruco::Dictionary> dictionary = aruco::getPredefinedDictionary(aruco::PREDEFINED_DICTIONARY_NAME(dictionaryId));

Mat markerImg;
aruco::drawMarker(dictionary, markerId, markerSize, markerImg, borderBits);

if(showImage) {
    imshow("marker", markerImg);
    waitKey(0);
}

imwrite("out.png", markerImg);

return 0;
}

当我尝试使用命令

编译并运行它时
  

g ++ -I / usr / local / include / opencv -I / usr / include / opencv2 -L / usr / local / lib /   -g -o binary create_marker.cpp -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_ml -lopencv_video -lopencv_features2d -lopencv_calib3d -lopencv_objdetect -lopencv_contrib -lopencv_legacy -lopencv_stitching -lopencv_aruco

如本网站的某个解决方案中所示,它会出现此错误

  

g ++ -I / usr / local / include / opencv -I / usr / include / opencv2   -L在/ usr / local / lib目录/   -g -o binary create_marker.cpp -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_ml -lopencv_video -lopencv_features2d -lopencv_calib3d -lopencv_objdetect -lopencv_contrib -lopencv_legacy -lopencv_stitching -lopencv_aruco / usr / bin / ld:找不到-lopencv_aruco collect2:错误:ld返回1退出状态

有人可以指出我做错了什么,因为我是opencv的新手 谢谢!

1 个答案:

答案 0 :(得分:-1)

使用此命令:

tell application "TextWrangler"
    select insertion point after last character of text window 1
    set selection to "hello world!"
end tell

如果仍然无效,请再次发布错误。