同一词典中具有多个标记的Aruco标记跟踪 [英] Aruco Marker Tracking With Multiple Markers From the Same Dictionary

查看:73
本文介绍了同一词典中具有多个标记的Aruco标记跟踪的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用OpenCV Contrib中的ChAruCo marker tracking.我想跟踪多个面板,但是创建标记面板的机制却不尽人意.

I'm using ChAruCo marker tracking from OpenCV Contrib. I'd like to track multiple boards, but the mechanism to create the marker boards is not as I would expect.

我的图片有一个字典(说,DICT_4X4_50),使用字典中不同的ID范围来创建许多标记.
CharucoBoard::create()接受字典并使用标记0-X创建木板.我想在范围的开头添加一个偏移量.

What I picture is having one dictionary (Say, DICT_4X4_50) to create many markers using distinct ID ranges from the dictionary.
CharucoBoard::create() accepts the dictionary and uses markers 0-X to create the board. I'd like to add an offset to the beginning of the range.

如果我可以创建板,则cv::aruco::detectMarkers()输出ID,这些ID可以确定视图中的板.是否支持此功能;如果不支持,应该如何跟踪多个目标?

If I can create the boards, cv::aruco::detectMarkers() outputs IDs which can determine which board is in view. Is this supported, and if not, how should I go about tracking more than one target?

推荐答案

您可以在Board类的向量id中简单地添加一个偏移量.我无法告诉您这是否受支持",但我们将其用于非charuco板,并且效果很好. 由于charuco板索引nearestMarkerIdxids向量的索引,因此应该可以解决问题.

You can simply add an offset to the elements in the vector ids in the Board class. I can't tell you whether this is "supported", but we used it for non charuco boards and it worked fine. Since the charuco board indices nearestMarkerIdx are indices into the ids vector this should work out fine.

cv::Ptr<cv::aruco::CharucoBoard> board1 =  cv::aruco::CharucoBoard::create(3, 5, 0.32f, 0.08f, dictionary);
cv::Ptr<cv::aruco::CharucoBoard> board2 = cv::aruco::CharucoBoard::create(3, 5, 0.32f, 0.08f, dictionary);
int id_offset_board2 = board1->ids.size();
for(auto& id: board2->ids)
{
    id += id_offset_board2;
}

这篇关于同一词典中具有多个标记的Aruco标记跟踪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆