moms-apriltag


Namemoms-apriltag JSON
Version 2023.1.15 PyPI version JSON
download
home_pagehttps://pypi.org/project/apriltag_gen/
SummaryGenerate apriltags, calibration targets, and camera (mono/stereo) calibration
upload_time2023-01-16 03:43:10
maintainer
docs_urlNone
authorwalchko
requires_python>=3.8
licenseMIT
keywords apriltag apriltagv2 apriltagv3 camera calibration
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ![](https://github.com/MomsFriendlyRobotCompany/moms_apriltag/blob/master/example/apriltag_target.png?raw=true)

# Apriltag Camera Calibration Board Generator
![CheckPackage](https://github.com/MomsFriendlyRobotCompany/moms_apriltag/workflows/CheckPackage/badge.svg)
![GitHub](https://img.shields.io/github/license/MomsFriendlyRobotCompany/moms_apriltag)
[![Latest Version](https://img.shields.io/pypi/v/moms_apriltag.svg)](https://pypi.python.org/pypi/moms_apriltag/)
[![image](https://img.shields.io/pypi/pyversions/moms_apriltag.svg)](https://pypi.python.org/pypi/moms_apriltag)
[![image](https://img.shields.io/pypi/format/moms_apriltag.svg)](https://pypi.python.org/pypi/moms_apriltag)
![PyPI - Downloads](https://img.shields.io/pypi/dm/moms_apriltag?color=aqua)

Why? There didn't really seem to be an easy way to do this IMHO.

This library is able to produce both generation 2 and 3 apriltags all via python (
no C/C++ library compiling and linking).

However, you will need another library (like `cv2.aruco`) to decode the tags ... see below for more info.

## Install

```
pip install moms_apriltag
```

## Examples / Usage

See the jupyter notebooks in [`docs/jupyter`](https://github.com/MomsFriendlyRobotCompany/moms_apriltag/tree/master/docs/jupyter) folder for how to use this.

This package create a simple numpy image that can then be saved
to a PNG or JPEG image and printed. For circular or custom tags,
there is a `toRGBA()` function to save the tag to a `png` using
any image library that can accept `numpy` array images.

Supported families are shown in the table below in the image and table:

![](https://raw.githubusercontent.com/MomsFriendlyRobotCompany/moms_apriltag/master/pics/apriltag_formats.png)

| Family    | Generation | Hamming | Size | Data Bits | Unique Tags |
|-----------|------------|---------|------|-----------|-------------|
| `tag16h5` | 2          | 5       | 4x4  | 16        | 30
| `tag25h9` | 2          | 9       | 5x5  | 25        | 35
| `tag36h10`| 2          | 10      | 5x5  | 36        | 2,320
| `tag36h11`| 2          | 11      | 5x5  | 36        | 587
| `tagCircle21h7`| 3     | 7       | 9x9  | 36        | 38
| `tagCircle49h12`| 3    | 12      | 11x11| 49        | 65,535
| `tagCustom48h12`| 3    | 12      | 10x10| 48        | 42,211
| `tagStandard41h12`| 3  | 12      | 9x9  | 41        | 2,115
| `tagStandard52h13`| 3  | 13      | 10x10| 52        | 48,714

[ref](https://optitag.io/blogs/news/designing-your-perfect-apriltag)

```python
#!/usr/bin/env python3
from moms_apriltag import ApriltagBoard
import imageio

board = ApriltagBoard.create(4,6,"tag25h9", 0.02)
tgt = board.board

filename = "apriltag_target.png"
imageio.imwrite(filename, tgt)
```

```python
# for AprilTag v2
from moms_apriltag import TagGenerator2
from matplotlib import pyplot as plt

tg = TagGenerator2("tag16h5")
tag = tg.generate(4)

plt.imshow(tag, cmap="gray)
```

```python
# for AprilTag v3
from moms_apriltag import TagGenerator3
from matplotlib import pyplot as plt

tg = TagGenerator3("tagStandard41h12")
tag = tg.generate(137)

plt.imshow(tag, cmap="gray)
```
## Apriltags using `opencv-contrib-python` for Camera Calibration Target Detection

This library uses the builtin `cv2.aruco` module that can detect:

- `DICT_APRILTAG_16H5`
- `DICT_APRILTAG_25h9`
- `DICT_APRILTAG_36h10`
- `DICT_APRILTAG_36h11`

## Decoders

`cv2.aruco` for calibration is built in, but it can decode generation 2 tags only.

- pupil labs (tested): https://github.com/pupil-labs/apriltags can decode generation 2 and 3 tags
- WillB97 (untested): https://github.com/WillB97/pyapriltags can decode generation 2 and 3 tags

# Todo

- [x] change the way the board is created, do a fixed scale size and add a margin with
      text saying the orientation, family, size, and maybe in the small squares next to
      the tags, put the number of the tag (number is for the lower left apriltag). I think
      this would help debugging and understanding what is going on
- [ ] insert stereo calibration code using pupil labs?
- [x] move the `opencv_camera` calibration code with `apriltags` here
- [x] refactor board code
- [ ] enable apriltag v3 markers in board

# MIT License

**Copyright (c) 2020 Kevin J. Walchko**

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

            

Raw data

            {
    "_id": null,
    "home_page": "https://pypi.org/project/apriltag_gen/",
    "name": "moms-apriltag",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "apriltag,apriltagv2,apriltagv3,camera,calibration",
    "author": "walchko",
    "author_email": "walchko@users.noreply.github.com",
    "download_url": "https://files.pythonhosted.org/packages/d5/0b/72b03320fffc595f62cda0555f6c4baa0a43b635cb5161dc98a204b05199/moms_apriltag-2023.1.15.tar.gz",
    "platform": null,
    "description": "![](https://github.com/MomsFriendlyRobotCompany/moms_apriltag/blob/master/example/apriltag_target.png?raw=true)\n\n# Apriltag Camera Calibration Board Generator\n![CheckPackage](https://github.com/MomsFriendlyRobotCompany/moms_apriltag/workflows/CheckPackage/badge.svg)\n![GitHub](https://img.shields.io/github/license/MomsFriendlyRobotCompany/moms_apriltag)\n[![Latest Version](https://img.shields.io/pypi/v/moms_apriltag.svg)](https://pypi.python.org/pypi/moms_apriltag/)\n[![image](https://img.shields.io/pypi/pyversions/moms_apriltag.svg)](https://pypi.python.org/pypi/moms_apriltag)\n[![image](https://img.shields.io/pypi/format/moms_apriltag.svg)](https://pypi.python.org/pypi/moms_apriltag)\n![PyPI - Downloads](https://img.shields.io/pypi/dm/moms_apriltag?color=aqua)\n\nWhy? There didn't really seem to be an easy way to do this IMHO.\n\nThis library is able to produce both generation 2 and 3 apriltags all via python (\nno C/C++ library compiling and linking).\n\nHowever, you will need another library (like `cv2.aruco`) to decode the tags ... see below for more info.\n\n## Install\n\n```\npip install moms_apriltag\n```\n\n## Examples / Usage\n\nSee the jupyter notebooks in [`docs/jupyter`](https://github.com/MomsFriendlyRobotCompany/moms_apriltag/tree/master/docs/jupyter) folder for how to use this.\n\nThis package create a simple numpy image that can then be saved\nto a PNG or JPEG image and printed. For circular or custom tags,\nthere is a `toRGBA()` function to save the tag to a `png` using\nany image library that can accept `numpy` array images.\n\nSupported families are shown in the table below in the image and table:\n\n![](https://raw.githubusercontent.com/MomsFriendlyRobotCompany/moms_apriltag/master/pics/apriltag_formats.png)\n\n| Family    | Generation | Hamming | Size | Data Bits | Unique Tags |\n|-----------|------------|---------|------|-----------|-------------|\n| `tag16h5` | 2          | 5       | 4x4  | 16        | 30\n| `tag25h9` | 2          | 9       | 5x5  | 25        | 35\n| `tag36h10`| 2          | 10      | 5x5  | 36        | 2,320\n| `tag36h11`| 2          | 11      | 5x5  | 36        | 587\n| `tagCircle21h7`| 3     | 7       | 9x9  | 36        | 38\n| `tagCircle49h12`| 3    | 12      | 11x11| 49        | 65,535\n| `tagCustom48h12`| 3    | 12      | 10x10| 48        | 42,211\n| `tagStandard41h12`| 3  | 12      | 9x9  | 41        | 2,115\n| `tagStandard52h13`| 3  | 13      | 10x10| 52        | 48,714\n\n[ref](https://optitag.io/blogs/news/designing-your-perfect-apriltag)\n\n```python\n#!/usr/bin/env python3\nfrom moms_apriltag import ApriltagBoard\nimport imageio\n\nboard = ApriltagBoard.create(4,6,\"tag25h9\", 0.02)\ntgt = board.board\n\nfilename = \"apriltag_target.png\"\nimageio.imwrite(filename, tgt)\n```\n\n```python\n# for AprilTag v2\nfrom moms_apriltag import TagGenerator2\nfrom matplotlib import pyplot as plt\n\ntg = TagGenerator2(\"tag16h5\")\ntag = tg.generate(4)\n\nplt.imshow(tag, cmap=\"gray)\n```\n\n```python\n# for AprilTag v3\nfrom moms_apriltag import TagGenerator3\nfrom matplotlib import pyplot as plt\n\ntg = TagGenerator3(\"tagStandard41h12\")\ntag = tg.generate(137)\n\nplt.imshow(tag, cmap=\"gray)\n```\n## Apriltags using `opencv-contrib-python` for Camera Calibration Target Detection\n\nThis library uses the builtin `cv2.aruco` module that can detect:\n\n- `DICT_APRILTAG_16H5`\n- `DICT_APRILTAG_25h9`\n- `DICT_APRILTAG_36h10`\n- `DICT_APRILTAG_36h11`\n\n## Decoders\n\n`cv2.aruco` for calibration is built in, but it can decode generation 2 tags only.\n\n- pupil labs (tested): https://github.com/pupil-labs/apriltags can decode generation 2 and 3 tags\n- WillB97 (untested): https://github.com/WillB97/pyapriltags can decode generation 2 and 3 tags\n\n# Todo\n\n- [x] change the way the board is created, do a fixed scale size and add a margin with\n      text saying the orientation, family, size, and maybe in the small squares next to\n      the tags, put the number of the tag (number is for the lower left apriltag). I think\n      this would help debugging and understanding what is going on\n- [ ] insert stereo calibration code using pupil labs?\n- [x] move the `opencv_camera` calibration code with `apriltags` here\n- [x] refactor board code\n- [ ] enable apriltag v3 markers in board\n\n# MIT License\n\n**Copyright (c) 2020 Kevin J. Walchko**\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Generate apriltags, calibration targets, and camera (mono/stereo) calibration",
    "version": "2023.1.15",
    "split_keywords": [
        "apriltag",
        "apriltagv2",
        "apriltagv3",
        "camera",
        "calibration"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3a3ed6b49df575c9d1da1722e2e0a89050d2a9cfbb9c5376aadf3e2f8f99237b",
                "md5": "772cb65c738c06e98bdf0e9d0100bd42",
                "sha256": "8c168a0e809a5cf5bb849b1b649816be629030a0eb25833db5850094dd95996b"
            },
            "downloads": -1,
            "filename": "moms_apriltag-2023.1.15-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "772cb65c738c06e98bdf0e9d0100bd42",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 1415888,
            "upload_time": "2023-01-16T03:43:03",
            "upload_time_iso_8601": "2023-01-16T03:43:03.908253Z",
            "url": "https://files.pythonhosted.org/packages/3a/3e/d6b49df575c9d1da1722e2e0a89050d2a9cfbb9c5376aadf3e2f8f99237b/moms_apriltag-2023.1.15-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d50b72b03320fffc595f62cda0555f6c4baa0a43b635cb5161dc98a204b05199",
                "md5": "ffc5f4339d74bc831b6e6271494e60f0",
                "sha256": "b5ae39fd01d9564cbe7e3cf2a768617a2c85775c1e911946ed1d9f8b5421083b"
            },
            "downloads": -1,
            "filename": "moms_apriltag-2023.1.15.tar.gz",
            "has_sig": false,
            "md5_digest": "ffc5f4339d74bc831b6e6271494e60f0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 2546717,
            "upload_time": "2023-01-16T03:43:10",
            "upload_time_iso_8601": "2023-01-16T03:43:10.567217Z",
            "url": "https://files.pythonhosted.org/packages/d5/0b/72b03320fffc595f62cda0555f6c4baa0a43b635cb5161dc98a204b05199/moms_apriltag-2023.1.15.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-16 03:43:10",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "moms-apriltag"
}
        
Elapsed time: 0.06128s