OpenCV – Improving marker detection on Charuco board

  aruco, c++, camera-calibration, opencv

I am using OpenCV’s aruco::CharucoBoard object for calibration purposes and noticed that its marker detection doesn’t find all visible markers/corners in the images.

I started investigate the matter and tried to detect the markers on the image of the board that was printed for the calibration.
The aruco::detectMarkers fails to detect all markers unless the image size is 640×480.
I’m sure that some tweaking in the aruco::DetectorParameters is required, but I’ve yet to find the optimal values.

Here is the relevant code:

int nx = 16;
int ny = 10;
double sqrLength = 1.0;
double markerLength = 0.8;
Ptr<aruco::Dictionary> dictionary = aruco::getPredefinedDictionary(aruco::DICT_6X6_250);
Ptr<aruco::CharucoBoard> board = aruco::CharucoBoard::create(nx, ny, sqrLength, markerLength, dictionary);
Ptr<aruco::DetectorParameters> params = aruco::DetectorParameters::create();

Mat boardImg;
Size boardImgSize = Size(640 * 2, 480 * 2);
board->draw(boardImgSize, boardImg);

vector<int> markerIds;
vector<vector<Point2f>> markerCorners, rejected;
aruco::detectMarkers(boardImg, board->dictionary, markerCorners, markerIds, params, rejected);
 cout << markerIds.size() << endl;
    aruco::drawDetectedMarkers(boardImg, markerCorners);
imshow("board", boardImg);

The total number of markers on the board is 80 and the above code manages to find all of them only for
Size boardImgSize = Size(640, 480)

Any idea on how to improve the detection/which parameters should be tweaked?

Source: Windows Questions C++