Skip to content

Incorrect dictionary size returned from cv::aruco::extendDictionary #24222

@plupps

Description

@plupps

System Information

OpenCV version: 4.8.0
Operating System / Platform: Ubuntu 22.04
Compiler & compiler version: GCC 11.4

Detailed description

According to the documentation for extendDictionary, if the size of baseDictionary is higher than nMarkers, only the first nMarkers in baseDictionary are taken and no new marker is added. However, if nMarkers is smaller than the size of baseDictionary, the complete baseDictionary will be returned.

/** @brief Extend base dictionary by new nMarkers
  *
  * @param nMarkers number of markers in the dictionary
  * @param markerSize number of bits per dimension of each markers
  * @param baseDictionary Include the markers in this dictionary at the beginning (optional)
  * @param randomSeed a user supplied seed for theRNG()
  *
  * This function creates a new dictionary composed by nMarkers markers and each markers composed
  * by markerSize x markerSize bits. If baseDictionary is provided, its markers are directly
  * included and the rest are generated based on them. If the size of baseDictionary is higher
  * than nMarkers, only the first nMarkers in baseDictionary are taken and no new marker is added.
  */
CV_EXPORTS_W Dictionary extendDictionary(int nMarkers, int markerSize, const Dictionary &baseDictionary = Dictionary(),
                                         int randomSeed=0);

Steps to reproduce

cv::aruco::Dictionary base_dictionary = cv::aruco::getPredefinedDictionary(cv::aruco::DICT_4X4_250);
cv::aruco::Dictionary custom_dictionary= cv::aruco::extendDictionary(150, 4, base_dictionary);

Issue submission checklist

  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
  • I updated to the latest OpenCV version and the issue is still there
  • There is reproducer code and related data files (videos, images, onnx, etc)

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions