I am working on a rehabilitation application that relies on four ARuco markers,i need to draw on the four markers in the exercise sequence i.e. the object appears on the first marker, when the patient's hand reaches the object, it moves to the next marker, etc... . I could draw on only the first marker by selecting its marker id, now i need to make a delay to draw on the next marker, here is the code:
std::vector<int> ids;
std::vector<std::vector<cv::Point2f> > corners;
cv::aruco::detectMarkers(image, marker_dict, corners, ids);
// Draw markers using opencv tool
cv::aruco::drawDetectedMarkers(mid, corners, ids);
// Draw markers custom
for (size_t i = 0; i < corners.size(); ++i)
{
// Convert to integer ponits
int num = static_cast<int>(corners[i].size());
std::vector<cv::Point> points;
for (size_t j = 0; j < corners[i].size(); ++j)
points.push_back(cv::Point(static_cast<int>(corners[i][j].x), static_cast<int>(corners[i][j].y)));
const cv::Point* pts = &(points[0]);
// Draw
if (ids.at(i) == 45) {
cv::fillPoly(right, &pts, &num, 1, cv::Scalar(255, 0, 0));
}