I am trying to generate aruco marker using Visual Studio vc16 and opencv 4.70 lib with opencv_contrib.4. After building the libraries, i tried to run a short simple program for generating aruco marker and I got an error that I added after code.
the code that I am using:
#include <opencv2/highgui.hpp>
#include <opencv2/aruco.hpp>
using namespace cv;
namespace {
const char* about = "Create an ArUco marker image";
const char* keys =
"{@outfile |<none> | Output image }"
"{d | | dictionary: DICT_4X4_50=0, DICT_4X4_100=1, DICT_4X4_250=2,"
"DICT_4X4_1000=3, DICT_5X5_50=4, DICT_5X5_100=5, DICT_5X5_250=6, DICT_5X5_1000=7, "
"DICT_6X6_50=8, DICT_6X6_100=9, DICT_6X6_250=10, DICT_6X6_1000=11, DICT_7X7_50=12,"
"DICT_7X7_100=13, DICT_7X7_250=14, DICT_7X7_1000=15, DICT_ARUCO_ORIGINAL = 16}"
"{id | | Marker id in the dictionary }"
"{ms | 200 | Marker size in pixels }"
"{bb | 1 | Number of bits in marker borders }"
"{si | false | show generated image }";
}
int main(int argc, char* argv[]) {
CommandLineParser parser(argc, argv, keys);
parser.about(about);
if (argc < 4) {
parser.printMessage();
return 0;
}
int dictionaryId = parser.get<int>("d");
int markerId = parser.get<int>("id");
int borderBits = parser.get<int>("bb");
int markerSize = parser.get<int>("ms");
bool showImage = parser.get<bool>("si");
String out = parser.get<String>(0);
if (!parser.check()) {
parser.printErrors();
return 0;
}
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, markerImg);
return 0;
}
the error:
> Build started... 1>------ Build started: Project: TESTOPENCV,
> Configuration: Release x64 ------ 1>main.cpp error C2039:
> 'PREDEFINED_DICTIONARY_NAME': is not a member of 'cv::aruco'
> 1>C:\OpenCVLIB\install\include\opencv2\aruco.hpp(11): message : see
> declaration of 'cv::aruco' error C3861: 'PREDEFINED_DICTIONARY_NAME':
> identifier not found
> 1>C:\Users\ilyas\source\repos\TESTOPENCV\main.cpp(47,12): error C2039:
> 'drawMarker': is not a member of 'cv::aruco'
> 1>C:\OpenCVLIB\install\include\opencv2\aruco.hpp(11): message : see
> declaration of 'cv::aruco' 1 error C3861: 'drawMarker': identifier not
> found 1>Done building project "TESTOPENCV.vcxproj" -- FAILED.
> ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I am new to Arcuo marker, so I have no idea what do and what to change and to what. Any help would be really appreciated!
I tried looking it up, but could not find any answer on the internet. It says that Arcuo marker library has been changed but I am not sure what changed to what.