I have set up ArUco library and now want to write a small code to test if it is working correctly. The code is as below:
#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);
}
This code builds with zero error, but when I run it, it gives me error.
Error is:
This is what I get when I hit break.
I use Windows 8.1, Microsoft visual studio 2013, opencv 3.0 and ArUco 1.3.0
Any help would be helpful. Thank you very much for help.