Aruco Marker Tracking With Multiple Markers From the Same Dictionary

孤者浪人 提交于 2020-04-11 08:53:06

问题


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.

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.

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?


回答1:


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;
}


来源:https://stackoverflow.com/questions/53379508/aruco-marker-tracking-with-multiple-markers-from-the-same-dictionary

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!