# Generating custom dictionary with aruco.custom\_dictionary()

**URL:** <https://forum.opencv.org/t/generating-custom-dictionary-with-aruco-custom-dictionary/12708>\
**Category:** Python\
**Tags:** aruco\
**Created:** [April 6, 2023, 6:18pm UTC](https://forum.opencv.org/t/generating-custom-dictionary-with-aruco-custom-dictionary/12708 "2023-04-06T18:18:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kimiaebra](https://avatars.discourse-cdn.com/v4/letter/k/f0a364/32.png) [@kimiaebra](https://forum.opencv.org/u/kimiaebra)\
**Post date:** [April 6, 2023, 6:18pm UTC](https://forum.opencv.org/t/generating-custom-dictionary-with-aruco-custom-dictionary/12708/1 "2023-04-06T18:18:59Z")

</div>

Hello beautiful people,  
I am using opencv 4.5.5 and I want to create a large number of aruco codes using the  
aruco.custom\_dictionary() function. I have two questions about the generated aruco codes. :How is Id of each marker encoded in the bits sequence of the codes, and second how can I save the entire dictionary ??

---

<div class="post-metadata">

**Author:** ![crackwitz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/crackwitz/32/14_2.png) [@crackwitz](https://forum.opencv.org/u/crackwitz)\
**Post date:** [April 6, 2023, 11:53pm UTC](https://forum.opencv.org/t/generating-custom-dictionary-with-aruco-custom-dictionary/12708/2 "2023-04-06T23:53:44Z")

</div>

> The aruco module is based on the [ArUco library](https://www.uco.es/investiga/grupos/ava/portfolio/aruco/), a popular library for detection of square fiducial markers developed by Rafael Muñoz and Sergio Garrido [[88]](https://docs.opencv.org/4.x/d0/de3/citelist.html#CITEREF_Aruco2014).

you will find all the specifics described there.

note that the authors of the aruco publications maintain their implementation, and OpenCV maintains its own. they are separate.

the ID encoding is probably compatible though.

---

<div class="post-metadata">

**Author:** ![kimiaebra](https://avatars.discourse-cdn.com/v4/letter/k/f0a364/32.png) [@kimiaebra](https://forum.opencv.org/u/kimiaebra)\
**Post date:** [April 8, 2023, 11:29am UTC](https://forum.opencv.org/t/generating-custom-dictionary-with-aruco-custom-dictionary/12708/3 "2023-04-08T11:29:02Z")

</div>

thank you for your quick respond. Unfortunately I couldn’t find how I can save a dictionary with lots of aruco codes (that isn’t one of the predefined dictionaries) so that I can use it in the detection as input for detectMarkers().
