ArUco - 未处理的异常

ArUco - unhandled exception


我已经设置了 ArUco 库,现在想写一个小代码来测试它是否正常工作。代码如下:

#include<opencv2/opencv.hpp>
#include<iostream>
#include<aruco.h>
#include<cvdrawingutils.h>

using namespace cv;
using namespace std;
using namespace aruco;

int main()
{
    Mat image;
    //Read image and display it
    image = imread("E:/../Capture.PNG", 1);
    if (image.empty()) //check whether the image is loaded or not
    {
        cout << "Error : Image cannot be loaded..!!" << endl;
        //system("pause"); //wait for a key press
        return -1;
    }
    namedWindow("Image", CV_WINDOW_AUTOSIZE);
    imshow("Image", image);
    waitKey(1000);

    //Marker detection
    MarkerDetector MDetector;
    vector<Marker> Markers;

   //I am not sure if we need to read the pattern of the marker. So I read it.
    Markers = imread("E:/.../pattern.PNG", 1);
    MDetector.detect(image, Markers);

    //draw infor and its boundaries
    for (int i = 0; i < Markers.size(); i++)
    {
        Markers[i].draw(image, Scalar(0, 0, 255), 2);
    }
    imshow("ouput", image);
    waitKey(0);
} 


此代码以零错误构建,但是当我 运行 它时,它给我错误。
错误是:

这是我点击 break 时得到的结果。

我使用 Windows 8.1、Microsoft visual studio 2013、opencv 3.0 和 ArUco 1.3.0
任何帮助都会有所帮助。非常感谢您的帮助。

这个问题解决了。我使用了错误的标记模式。我们应该使用 ArUco 提供的标记模式。你可以在这里找到生成它们:http://terpconnect.umd.edu/~jwelsh12/enes100/markergen.html
代码也有错误。正确代码如下:

#include<opencv2/opencv.hpp>
#include<iostream>
#include<aruco.h>
#include<cvdrawingutils.h>

using namespace cv;
using namespace std;
using namespace aruco;

int main()
{
    Mat image;
    //Read image and display it
    image = imread("E:/Studies/Master Thesis/Markers/arucoTest.PNG", 1);
    if (image.empty()) //check whether the image is loaded or not
    {
        cout << "Error : Image cannot be loaded..!!" << endl;
        //system("pause"); //wait for a key press
        return -1;
    }
    namedWindow("Image", CV_WINDOW_AUTOSIZE);
    imshow("Image", image);
    waitKey(1000);

    //Marker detection
    MarkerDetector MDetector;
    vector<Marker> Markers;
    MDetector.detect(image, Markers);

    //draw information and its boundaries
    for (unsigned int i = 0; i<Markers.size(); i++) {
        cout << Markers[i] << endl;
        Markers[i].draw(image, Scalar(0, 0, 255), 2);
    }
    imshow("ouput", image);
    waitKey(0);
}


希望这段测试代码对ArUco新手(和我一样的人)有所帮助。