Ask Your Question
0

Load custom ArUco dictionary

asked 2018-09-24 08:54:19 -0500

JulzS gravatar image

updated 2018-09-24 08:57:42 -0500

Hi,

I'm currently trying to implement an ArUco based tracker using a custom dictionary (3x3 is sadly not provided). So I save my dictionary as a .yml file and load it in my tracking tool.

However, the cv::aruco::detectMarkers function requires a cv::Ptr<cv::aruco::Dictionary> as input but I can only create a cv::aruco::Dictionary object: test_dict = cv::aruco::Dictionary(bits, marker_size, correction_bits);

Some code:

test_dict = cv::aruco::Dictionary(bits, bits, marker_size, correction_bit);
cv::aruco::detectMarkers(cvimage, test_dict, corners, ids);

In the second line, I need a pointer: cv::Ptr<cv::aruco::Dictionary>, but obviously, &test_dict does not work. so my question is how to get such a pointer?

PS: I'm stuck to OpenCV 3.3.1 :)

Best Julz

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2018-09-24 09:06:20 -0500

berak gravatar image

you're already close. all you need is (note the new):

Ptr<Dictionary> test_dict(new aruco::Dictionary(bits, bits, marker_size, correction_bit));

or (if you dig templates...):

Ptr<Dictionary> test_dict = makePtr<aruco::Dictionary>(bits, bits, marker_size, correction_bit);
edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2018-09-24 08:54:19 -0500

Seen: 57 times

Last updated: Sep 24 '18