I have a program for aruco markers to detect, I would like to use 1 marker his pose for a calculation from a camera image with multiple aruco IDs.
I have a board with aruco id 256, 257, 258 The problem is that when aruco id 256 is seen it will calculate all aruco tags in the image and not only the aruco id 256.
Is there a solution to this problem, below my code.
************** code ****************
// if marker detected = ID 256
for(int i = 0;i < ids.size();i++){
std::cout << "aruco ID: " << ids[i] << std::endl; //print de marker ID die we gevonden hebben
if (ids[i]==256) // als de gedetecteerde marker gelijk is aan de gewenste marker
{
std::cout << "aruco marker grootte in meters: " << actual_marker_length << std::endl;
cv::aruco::drawDetectedMarkers(image_copy, corners, ids);
std::vector<cv::Vec3d> rvecs, tvecs;
cv::aruco::estimatePoseSingleMarkers(corners, actual_marker_length,
camera_matrix, dist_coeffs, rvecs, tvecs);
cv::aruco::drawAxis(image_copy, camera_matrix, dist_coeffs,
rvecs[i], tvecs[i], 0.1);
vector_to_marker.str(std::string());
vector_to_marker << std::setprecision(4)
<< "x: " << std::setw(8)<< tvecs[0](0);
std::cout << "x: " << tvecs[0](0) << std::endl;
cv::putText(image_copy, vector_to_marker.str(),
cvPoint(10, 30), cv::FONT_HERSHEY_SIMPLEX, 0.6,
cvScalar(0, 252, 124), 1, CV_AA);
vector_to_marker.str(std::string());
vector_to_marker << std::setprecision(4)
<< "y: " << std::setw(8) << tvecs[0](1);
std::cout << "y: " << tvecs[0](1) << std::endl;
cv::putText(image_copy, vector_to_marker.str(),
cvPoint(10, 50), cv::FONT_HERSHEY_SIMPLEX, 0.6,
cvScalar(0, 252, 124), 1, CV_AA);
vector_to_marker.str(std::string());
vector_to_marker << std::setprecision(4)
<< "z: " << std::setw(8) << tvecs[0](2);
berekenZ(ArucoMarker, tvecs[0](2));
cv::putText(image_copy, vector_to_marker.str(),
cvPoint(10, 70), cv::FONT_HERSHEY_SIMPLEX, 0.6,
cvScalar(0, 252, 124), 1, CV_AA);
berekeningenIrLock(tvecs[0](0), tvecs[0](1), tvecs[0](2));
}