问题
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