python-aruco2 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- python_aruco2-0.1.0/.github/workflows/wheels.yml +82 -0
- python_aruco2-0.1.0/.gitignore +7 -0
- python_aruco2-0.1.0/CMakeLists.txt +64 -0
- python_aruco2-0.1.0/LICENSE +21 -0
- python_aruco2-0.1.0/PKG-INFO +73 -0
- python_aruco2-0.1.0/README.md +55 -0
- python_aruco2-0.1.0/UPSTREAM.md +15 -0
- python_aruco2-0.1.0/cpp/bindings.cpp +155 -0
- python_aruco2-0.1.0/pyproject.toml +39 -0
- python_aruco2-0.1.0/src/aruco2/__init__.py +3 -0
- python_aruco2-0.1.0/src/aruco2/__init__.pyi +129 -0
- python_aruco2-0.1.0/src/aruco2/licenses/opencv-LICENSE +202 -0
- python_aruco2-0.1.0/src/aruco2/licenses/pybind11-LICENSE +29 -0
- python_aruco2-0.1.0/src/aruco2/py.typed +0 -0
- python_aruco2-0.1.0/tests/test_binding.py +95 -0
- python_aruco2-0.1.0/vendor/aruco2/.gitignore +3 -0
- python_aruco2-0.1.0/vendor/aruco2/CMakeLists.txt +91 -0
- python_aruco2-0.1.0/vendor/aruco2/LICENSE +201 -0
- python_aruco2-0.1.0/vendor/aruco2/README.md +570 -0
- python_aruco2-0.1.0/vendor/aruco2/board9x5.png +0 -0
- python_aruco2-0.1.0/vendor/aruco2/opencl/aruco2detect.cl +993 -0
- python_aruco2-0.1.0/vendor/aruco2/opencv2/objdetect/aruco2.hpp +594 -0
- python_aruco2-0.1.0/vendor/aruco2/src/aruco2.cpp +1856 -0
- python_aruco2-0.1.0/vendor/aruco2/src/aruco2_dictionary.cpp +586 -0
- python_aruco2-0.1.0/vendor/aruco2/src/aruco2_dictionary.hpp +134 -0
- python_aruco2-0.1.0/vendor/aruco2/src/aruco2_fractal.cpp +1236 -0
- python_aruco2-0.1.0/vendor/aruco2/src/aruco2_predefined_dictionaries.hpp +20129 -0
- python_aruco2-0.1.0/vendor/aruco2/src/aruco2_predefined_dictionaries_alvar.hpp +7549 -0
- python_aruco2-0.1.0/vendor/aruco2/src/aruco2_predefined_dictionaries_apriltag.hpp +14900 -0
- python_aruco2-0.1.0/vendor/aruco2/src/aruco2_predefined_dictionaries_raruco.hpp +32 -0
- python_aruco2-0.1.0/vendor/aruco2/src/aruco_dictionary.cpp +580 -0
- python_aruco2-0.1.0/vendor/aruco2/src/aruco_dictionary.hpp +132 -0
- python_aruco2-0.1.0/vendor/aruco2/src/predefined_dictionaries.hpp +20129 -0
- python_aruco2-0.1.0/vendor/aruco2/src/predefined_dictionaries_alvar.hpp +7549 -0
- python_aruco2-0.1.0/vendor/aruco2/src/predefined_dictionaries_apriltag.hpp +14900 -0
- python_aruco2-0.1.0/vendor/aruco2/types.jpg +0 -0
- python_aruco2-0.1.0/vendor/aruco2/utils/aruco2_camera_calibration.cpp +151 -0
- python_aruco2-0.1.0/vendor/aruco2/utils/aruco2_detect_diamonds.cpp +148 -0
- python_aruco2-0.1.0/vendor/aruco2/utils/aruco2_detect_fractal.cpp +150 -0
- python_aruco2-0.1.0/vendor/aruco2/utils/aruco2_detect_markers.cpp +186 -0
- python_aruco2-0.1.0/vendor/aruco2/utils/aruco2_detect_raruco.cpp +358 -0
- python_aruco2-0.1.0/vendor/aruco2/utils/aruco2_print.cpp +59 -0
- python_aruco2-0.1.0/vendor/aruco2/utils/cl2cpp.cmake +79 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
name: Wheels
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
pull_request:
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
concurrency:
|
|
12
|
+
group: wheels-${{ github.workflow }}-${{ github.ref }}
|
|
13
|
+
cancel-in-progress: true
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
wheels:
|
|
17
|
+
name: ${{ matrix.os }} / ${{ matrix.python }}
|
|
18
|
+
runs-on: ${{ matrix.os }}
|
|
19
|
+
timeout-minutes: 60
|
|
20
|
+
strategy:
|
|
21
|
+
fail-fast: false
|
|
22
|
+
matrix:
|
|
23
|
+
os: [windows-latest, ubuntu-latest, macos-latest]
|
|
24
|
+
python: [cp310, cp311, cp312, cp313, cp314]
|
|
25
|
+
env:
|
|
26
|
+
CIBW_BUILD: ${{ matrix.python }}-*
|
|
27
|
+
CMAKE_BUILD_PARALLEL_LEVEL: "2"
|
|
28
|
+
steps:
|
|
29
|
+
- uses: actions/checkout@v6
|
|
30
|
+
with:
|
|
31
|
+
persist-credentials: false
|
|
32
|
+
- uses: actions/setup-python@v6
|
|
33
|
+
with:
|
|
34
|
+
python-version: "3.12"
|
|
35
|
+
- name: Install wheel builder
|
|
36
|
+
run: python -m pip install cibuildwheel==4.3.5
|
|
37
|
+
- name: Build and test installed wheel
|
|
38
|
+
run: python -m cibuildwheel --output-dir wheelhouse
|
|
39
|
+
- uses: actions/upload-artifact@v6
|
|
40
|
+
with:
|
|
41
|
+
name: wheels-${{ matrix.os }}-${{ matrix.python }}
|
|
42
|
+
path: wheelhouse/*.whl
|
|
43
|
+
if-no-files-found: error
|
|
44
|
+
|
|
45
|
+
sdist:
|
|
46
|
+
name: Source distribution
|
|
47
|
+
runs-on: ubuntu-latest
|
|
48
|
+
timeout-minutes: 10
|
|
49
|
+
steps:
|
|
50
|
+
- uses: actions/checkout@v6
|
|
51
|
+
with:
|
|
52
|
+
persist-credentials: false
|
|
53
|
+
- uses: actions/setup-python@v6
|
|
54
|
+
with:
|
|
55
|
+
python-version: "3.12"
|
|
56
|
+
- run: python -m pip install build
|
|
57
|
+
- run: python -m build --sdist
|
|
58
|
+
- uses: actions/upload-artifact@v6
|
|
59
|
+
with:
|
|
60
|
+
name: source-distribution
|
|
61
|
+
path: dist/*.tar.gz
|
|
62
|
+
if-no-files-found: error
|
|
63
|
+
|
|
64
|
+
publish:
|
|
65
|
+
name: Publish to PyPI
|
|
66
|
+
needs: [wheels, sdist]
|
|
67
|
+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
|
|
68
|
+
runs-on: ubuntu-latest
|
|
69
|
+
timeout-minutes: 10
|
|
70
|
+
environment:
|
|
71
|
+
name: pypi
|
|
72
|
+
url: https://pypi.org/p/python-aruco2
|
|
73
|
+
permissions:
|
|
74
|
+
id-token: write
|
|
75
|
+
steps:
|
|
76
|
+
- name: Download built distributions
|
|
77
|
+
uses: actions/download-artifact@v6
|
|
78
|
+
with:
|
|
79
|
+
path: dist
|
|
80
|
+
merge-multiple: true
|
|
81
|
+
- name: Publish distributions
|
|
82
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
cmake_minimum_required(VERSION 3.24)
|
|
2
|
+
project(python_aruco2 LANGUAGES C CXX)
|
|
3
|
+
set(CMAKE_CXX_STANDARD 17)
|
|
4
|
+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
5
|
+
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
|
6
|
+
find_package(Python REQUIRED COMPONENTS Interpreter Development.Module)
|
|
7
|
+
find_package(pybind11 CONFIG REQUIRED)
|
|
8
|
+
|
|
9
|
+
option(ARUCO2_BUILD_OPENCV "Build a private static OpenCV instead of using an installed SDK" ON)
|
|
10
|
+
if(ARUCO2_BUILD_OPENCV)
|
|
11
|
+
include(FetchContent)
|
|
12
|
+
set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
|
|
13
|
+
set(BUILD_LIST core,imgproc,flann,calib3d CACHE STRING "" FORCE)
|
|
14
|
+
foreach(opt BUILD_TESTS BUILD_PERF_TESTS BUILD_EXAMPLES BUILD_opencv_apps BUILD_JAVA
|
|
15
|
+
BUILD_opencv_python2 BUILD_opencv_python3 WITH_IPP WITH_ITT WITH_FFMPEG WITH_MSMF
|
|
16
|
+
WITH_VTK WITH_QT WITH_GTK WITH_OPENCL OPENCV_ENABLE_NONFREE)
|
|
17
|
+
set(${opt} OFF CACHE BOOL "" FORCE)
|
|
18
|
+
endforeach()
|
|
19
|
+
set(OPENCV_FORCE_3RDPARTY_BUILD ON CACHE BOOL "" FORCE)
|
|
20
|
+
set(OPENCV_SKIP_PYTHON_LOADER ON CACHE BOOL "" FORCE)
|
|
21
|
+
FetchContent_Declare(opencv URL https://github.com/opencv/opencv/archive/refs/tags/4.12.0.tar.gz
|
|
22
|
+
URL_HASH SHA256=44c106d5bb47efec04e531fd93008b3fcd1d27138985c5baf4eafac0e1ec9e9d
|
|
23
|
+
DOWNLOAD_EXTRACT_TIMESTAMP TRUE)
|
|
24
|
+
FetchContent_MakeAvailable(opencv)
|
|
25
|
+
set(OpenCV_LIBS opencv_core opencv_imgproc opencv_flann opencv_calib3d)
|
|
26
|
+
set(OpenCV_INCLUDE_DIRS "${opencv_BINARY_DIR}" "${opencv_SOURCE_DIR}/include")
|
|
27
|
+
foreach(mod core imgproc flann calib3d features2d highgui imgcodecs videoio)
|
|
28
|
+
list(APPEND OpenCV_INCLUDE_DIRS "${opencv_SOURCE_DIR}/modules/${mod}/include")
|
|
29
|
+
endforeach()
|
|
30
|
+
else()
|
|
31
|
+
find_package(OpenCV 4 REQUIRED COMPONENTS core imgproc flann calib3d)
|
|
32
|
+
endif()
|
|
33
|
+
|
|
34
|
+
set(ARUCO2_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/vendor/aruco2")
|
|
35
|
+
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/opencl_kernels_aruco2.hpp"
|
|
36
|
+
"${CMAKE_CURRENT_BINARY_DIR}/opencl_kernels_aruco2.cpp"
|
|
37
|
+
COMMAND ${CMAKE_COMMAND}
|
|
38
|
+
"-DCL_PATH=${ARUCO2_SOURCE_DIR}/opencl/aruco2detect.cl"
|
|
39
|
+
"-DHPP_PATH=${CMAKE_CURRENT_BINARY_DIR}/opencl_kernels_aruco2.hpp"
|
|
40
|
+
"-DCPP_PATH=${CMAKE_CURRENT_BINARY_DIR}/opencl_kernels_aruco2.cpp"
|
|
41
|
+
-P "${ARUCO2_SOURCE_DIR}/utils/cl2cpp.cmake"
|
|
42
|
+
DEPENDS "${ARUCO2_SOURCE_DIR}/opencl/aruco2detect.cl" "${ARUCO2_SOURCE_DIR}/utils/cl2cpp.cmake")
|
|
43
|
+
pybind11_add_module(_native MODULE cpp/bindings.cpp
|
|
44
|
+
"${ARUCO2_SOURCE_DIR}/src/aruco2.cpp"
|
|
45
|
+
"${ARUCO2_SOURCE_DIR}/src/aruco2_dictionary.cpp"
|
|
46
|
+
"${ARUCO2_SOURCE_DIR}/src/aruco2_fractal.cpp"
|
|
47
|
+
"${CMAKE_CURRENT_BINARY_DIR}/opencl_kernels_aruco2.cpp")
|
|
48
|
+
target_include_directories(_native PRIVATE ${OpenCV_INCLUDE_DIRS}
|
|
49
|
+
"${ARUCO2_SOURCE_DIR}" "${ARUCO2_SOURCE_DIR}/src" "${CMAKE_CURRENT_BINARY_DIR}")
|
|
50
|
+
target_link_libraries(_native PRIVATE ${OpenCV_LIBS})
|
|
51
|
+
option(ARUCO2_STATIC_CRT "Match an external OpenCV SDK built with the static MSVC runtime" OFF)
|
|
52
|
+
if(MSVC AND ((ARUCO2_BUILD_OPENCV AND BUILD_WITH_STATIC_CRT) OR ARUCO2_STATIC_CRT))
|
|
53
|
+
set_property(TARGET _native PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
|
54
|
+
endif()
|
|
55
|
+
if(MSVC)
|
|
56
|
+
target_compile_options(_native PRIVATE /bigobj /utf-8)
|
|
57
|
+
endif()
|
|
58
|
+
install(TARGETS _native RUNTIME DESTINATION aruco2 COMPONENT python-aruco2
|
|
59
|
+
LIBRARY DESTINATION aruco2 COMPONENT python-aruco2)
|
|
60
|
+
|
|
61
|
+
install(FILES "${ARUCO2_SOURCE_DIR}/LICENSE" DESTINATION aruco2/licenses RENAME aruco2-LICENSE COMPONENT python-aruco2)
|
|
62
|
+
if(ARUCO2_BUILD_OPENCV)
|
|
63
|
+
install(FILES "${opencv_SOURCE_DIR}/LICENSE" DESTINATION aruco2/licenses RENAME opencv-LICENSE COMPONENT python-aruco2)
|
|
64
|
+
endif()
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 HITLAB contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: python-aruco2
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: NumPy Python bindings for rmsalinas/aruco2
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
License-File: UPSTREAM.md
|
|
8
|
+
License-File: src/aruco2/licenses/opencv-LICENSE
|
|
9
|
+
License-File: src/aruco2/licenses/pybind11-LICENSE
|
|
10
|
+
License-File: vendor/aruco2/LICENSE
|
|
11
|
+
Project-URL: Repository, https://github.com/hit-labvn/python-aruco2
|
|
12
|
+
Project-URL: Issues, https://github.com/hit-labvn/python-aruco2/issues
|
|
13
|
+
Requires-Python: >=3.10
|
|
14
|
+
Requires-Dist: numpy>=1.23
|
|
15
|
+
Provides-Extra: test
|
|
16
|
+
Requires-Dist: pytest>=8; extra == "test"
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
|
|
19
|
+
# python-aruco2
|
|
20
|
+
|
|
21
|
+
[](https://github.com/hit-labvn/python-aruco2/actions/workflows/wheels.yml)
|
|
22
|
+
[](LICENSE)
|
|
23
|
+
|
|
24
|
+
Standalone Python/NumPy bindings for rmsalinas/aruco2. Distribution: `python-aruco2`; import: `aruco2`.
|
|
25
|
+
|
|
26
|
+
## Build on Windows
|
|
27
|
+
|
|
28
|
+
Requires Python 3.10+, CMake 3.24+ and Visual Studio 2022 with Desktop development with C++.
|
|
29
|
+
|
|
30
|
+
```powershell
|
|
31
|
+
uv venv --python 3.12 .venv
|
|
32
|
+
uv pip install --python .venv/Scripts/python.exe ".[test]"
|
|
33
|
+
.venv/Scripts/python.exe -m pytest
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
The first build downloads OpenCV 4.12.0 and compiles private static CPU libraries. No cv2 installation or OpenCV DLL search path is needed. Internet is needed for build dependencies and OpenCV on the first build. The runtime depends only on NumPy and the normal Microsoft Visual C++ runtime. The same CMake project is used for Linux and macOS wheel builds in CI.
|
|
37
|
+
|
|
38
|
+
To use an existing OpenCV C++ SDK instead:
|
|
39
|
+
|
|
40
|
+
```powershell
|
|
41
|
+
uv pip install . --config-settings "cmake.define.ARUCO2_BUILD_OPENCV=OFF" --config-settings "cmake.define.OpenCV_DIR=C:/opencv/build"
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
For an external Windows SDK compiled with /MT, also pass `--config-settings "cmake.define.ARUCO2_STATIC_CRT=ON"`. With an external shared SDK, distributing its runtime libraries is your responsibility. The opencv-python wheel does not provide a C++ SDK.
|
|
45
|
+
|
|
46
|
+
## Usage
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
import aruco2
|
|
50
|
+
import numpy as np
|
|
51
|
+
|
|
52
|
+
image = aruco2.getFiducialMarkerImage(aruco2.DICT_6X6_250, 42)
|
|
53
|
+
markers = aruco2.detectFiducialMarkers(image, aruco2.DICT_6X6_250)
|
|
54
|
+
for marker in markers:
|
|
55
|
+
print(marker.id, marker.corners) # float32 (4, 2), clockwise
|
|
56
|
+
object_points, image_points = aruco2.getSolvePnpPoints(marker, markerSize=0.05)
|
|
57
|
+
# Pass these arrays to cv2.solvePnP if pose estimation is needed.
|
|
58
|
+
annotated = aruco2.drawFiducialMarkers(np.repeat(image[..., None], 3, axis=2), markers)
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Inputs must be uint8 grayscale (H,W), (H,W,1), or BGR (H,W,3). Noncontiguous inputs are copied; 16-bit images must be explicitly converted by the caller. Detection releases the GIL; callers must not mutate input arrays concurrently. Output arrays own their memory. Drawing returns a new image and does not mutate its input. Parameters use upstream defaults, including strict error correction. `DetectionParameters` is the actual upstream name; `DetectorParameters` is also accepted as an alias.
|
|
62
|
+
|
|
63
|
+
Exposes single/multiple dictionary detection, grid boards (including custom IDs), diamonds, fractals, RArUco, generators, drawing, all dictionary/fractal constants, and solvePnP point extraction. This initial binding uses CPU Mat inputs; OpenCL/UMat and drawAxis are not exposed.
|
|
64
|
+
|
|
65
|
+
## Continuous integration
|
|
66
|
+
|
|
67
|
+
GitHub Actions builds and tests CPython 3.10 through 3.14 wheels for Windows x64, Linux x86_64 (manylinux), and macOS Apple Silicon on pushes, pull requests, and manual runs. Download wheels from the artifacts of a successful [Wheels workflow run](https://github.com/hit-labvn/python-aruco2/actions/workflows/wheels.yml). A separate job builds the source archive. Version tags (`v*`) publish all distributions to PyPI after every build and test succeeds, using the `pypi` GitHub environment and PyPI Trusted Publishing. CI tests the installed wheel rather than importing the source tree.
|
|
68
|
+
|
|
69
|
+
## Source and licensing
|
|
70
|
+
|
|
71
|
+
The binding code is licensed under **MIT**. Vendored ArUco2 and OpenCV retain their Apache-2.0 licenses; pybind11 retains its BSD license. MIT does not replace third-party licenses.
|
|
72
|
+
|
|
73
|
+
Upstream is vendored at commit `c26b030cee4292649be566092812308fa179e871`. See `UPSTREAM.md`, `LICENSE` and `vendor/aruco2/LICENSE`. This is an independent binding project, not an official upstream Python release.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# python-aruco2
|
|
2
|
+
|
|
3
|
+
[](https://github.com/hit-labvn/python-aruco2/actions/workflows/wheels.yml)
|
|
4
|
+
[](LICENSE)
|
|
5
|
+
|
|
6
|
+
Standalone Python/NumPy bindings for rmsalinas/aruco2. Distribution: `python-aruco2`; import: `aruco2`.
|
|
7
|
+
|
|
8
|
+
## Build on Windows
|
|
9
|
+
|
|
10
|
+
Requires Python 3.10+, CMake 3.24+ and Visual Studio 2022 with Desktop development with C++.
|
|
11
|
+
|
|
12
|
+
```powershell
|
|
13
|
+
uv venv --python 3.12 .venv
|
|
14
|
+
uv pip install --python .venv/Scripts/python.exe ".[test]"
|
|
15
|
+
.venv/Scripts/python.exe -m pytest
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
The first build downloads OpenCV 4.12.0 and compiles private static CPU libraries. No cv2 installation or OpenCV DLL search path is needed. Internet is needed for build dependencies and OpenCV on the first build. The runtime depends only on NumPy and the normal Microsoft Visual C++ runtime. The same CMake project is used for Linux and macOS wheel builds in CI.
|
|
19
|
+
|
|
20
|
+
To use an existing OpenCV C++ SDK instead:
|
|
21
|
+
|
|
22
|
+
```powershell
|
|
23
|
+
uv pip install . --config-settings "cmake.define.ARUCO2_BUILD_OPENCV=OFF" --config-settings "cmake.define.OpenCV_DIR=C:/opencv/build"
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
For an external Windows SDK compiled with /MT, also pass `--config-settings "cmake.define.ARUCO2_STATIC_CRT=ON"`. With an external shared SDK, distributing its runtime libraries is your responsibility. The opencv-python wheel does not provide a C++ SDK.
|
|
27
|
+
|
|
28
|
+
## Usage
|
|
29
|
+
|
|
30
|
+
```python
|
|
31
|
+
import aruco2
|
|
32
|
+
import numpy as np
|
|
33
|
+
|
|
34
|
+
image = aruco2.getFiducialMarkerImage(aruco2.DICT_6X6_250, 42)
|
|
35
|
+
markers = aruco2.detectFiducialMarkers(image, aruco2.DICT_6X6_250)
|
|
36
|
+
for marker in markers:
|
|
37
|
+
print(marker.id, marker.corners) # float32 (4, 2), clockwise
|
|
38
|
+
object_points, image_points = aruco2.getSolvePnpPoints(marker, markerSize=0.05)
|
|
39
|
+
# Pass these arrays to cv2.solvePnP if pose estimation is needed.
|
|
40
|
+
annotated = aruco2.drawFiducialMarkers(np.repeat(image[..., None], 3, axis=2), markers)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Inputs must be uint8 grayscale (H,W), (H,W,1), or BGR (H,W,3). Noncontiguous inputs are copied; 16-bit images must be explicitly converted by the caller. Detection releases the GIL; callers must not mutate input arrays concurrently. Output arrays own their memory. Drawing returns a new image and does not mutate its input. Parameters use upstream defaults, including strict error correction. `DetectionParameters` is the actual upstream name; `DetectorParameters` is also accepted as an alias.
|
|
44
|
+
|
|
45
|
+
Exposes single/multiple dictionary detection, grid boards (including custom IDs), diamonds, fractals, RArUco, generators, drawing, all dictionary/fractal constants, and solvePnP point extraction. This initial binding uses CPU Mat inputs; OpenCL/UMat and drawAxis are not exposed.
|
|
46
|
+
|
|
47
|
+
## Continuous integration
|
|
48
|
+
|
|
49
|
+
GitHub Actions builds and tests CPython 3.10 through 3.14 wheels for Windows x64, Linux x86_64 (manylinux), and macOS Apple Silicon on pushes, pull requests, and manual runs. Download wheels from the artifacts of a successful [Wheels workflow run](https://github.com/hit-labvn/python-aruco2/actions/workflows/wheels.yml). A separate job builds the source archive. Version tags (`v*`) publish all distributions to PyPI after every build and test succeeds, using the `pypi` GitHub environment and PyPI Trusted Publishing. CI tests the installed wheel rather than importing the source tree.
|
|
50
|
+
|
|
51
|
+
## Source and licensing
|
|
52
|
+
|
|
53
|
+
The binding code is licensed under **MIT**. Vendored ArUco2 and OpenCV retain their Apache-2.0 licenses; pybind11 retains its BSD license. MIT does not replace third-party licenses.
|
|
54
|
+
|
|
55
|
+
Upstream is vendored at commit `c26b030cee4292649be566092812308fa179e871`. See `UPSTREAM.md`, `LICENSE` and `vendor/aruco2/LICENSE`. This is an independent binding project, not an official upstream Python release.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Upstream sources
|
|
2
|
+
|
|
3
|
+
The Python binding, packaging, tests, and CI configuration are MIT-licensed; see the root LICENSE. Third-party files retain the licenses below.
|
|
4
|
+
|
|
5
|
+
ArUco2: https://github.com/rmsalinas/aruco2
|
|
6
|
+
Commit: c26b030cee4292649be566092812308fa179e871
|
|
7
|
+
License: Apache-2.0, retained in vendor/aruco2/LICENSE.
|
|
8
|
+
|
|
9
|
+
The binding compiles aruco2_dictionary.cpp (the source referenced by current aruco2.cpp), rather than the older aruco_dictionary.cpp listed by upstream CMakeLists.txt. Local patch: the public DictionaryType enum is missing DICT_RARUCO_16h4, which is referenced by aruco2_dictionary.cpp. We append this enum value without renumbering existing values. Upstream sources are otherwise unmodified.
|
|
10
|
+
|
|
11
|
+
OpenCV: https://github.com/opencv/opencv, tag 4.12.0, Apache-2.0.
|
|
12
|
+
Its license is included in the installed package when building the private copy.
|
|
13
|
+
pybind11: https://github.com/pybind/pybind11, BSD-style license, build dependency.
|
|
14
|
+
Local patch: disabled the OpenCV-internal ../precomp.hpp include in aruco2_dictionary.cpp for standalone compilation.
|
|
15
|
+
Local patch: removed the unused highgui include from aruco2.cpp so a headless OpenCV SDK suffices.
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
#include <pybind11/pybind11.h>
|
|
2
|
+
#include <pybind11/numpy.h>
|
|
3
|
+
#include <pybind11/stl.h>
|
|
4
|
+
#include "opencv2/objdetect/aruco2.hpp"
|
|
5
|
+
#include <cstring>
|
|
6
|
+
#include <limits>
|
|
7
|
+
#include <cmath>
|
|
8
|
+
namespace py = pybind11;
|
|
9
|
+
namespace a = cv::aruco2;
|
|
10
|
+
using Image = py::array_t<uint8_t, py::array::c_style>;
|
|
11
|
+
|
|
12
|
+
Image image_array(const py::array &input) {
|
|
13
|
+
if (!input.dtype().is(py::dtype::of<uint8_t>()))
|
|
14
|
+
throw py::type_error("image must have dtype uint8; convert 16-bit images explicitly");
|
|
15
|
+
if (input.ndim() != 2 && !(input.ndim() == 3 && (input.shape(2) == 1 || input.shape(2) == 3)))
|
|
16
|
+
throw py::value_error("image must have shape (H, W), (H, W, 1), or (H, W, 3) in BGR order");
|
|
17
|
+
for (int i = 0; i < 2; ++i)
|
|
18
|
+
if (input.shape(i) <= 0 || input.shape(i) > std::numeric_limits<int>::max())
|
|
19
|
+
throw py::value_error("image dimensions must be positive and fit an OpenCV int");
|
|
20
|
+
return Image::ensure(input);
|
|
21
|
+
}
|
|
22
|
+
cv::Mat view(const Image &input) {
|
|
23
|
+
int channels = input.ndim() == 2 ? 1 : int(input.shape(2));
|
|
24
|
+
return cv::Mat(int(input.shape(0)), int(input.shape(1)), CV_MAKETYPE(CV_8U, channels), const_cast<uint8_t*>(input.data()));
|
|
25
|
+
}
|
|
26
|
+
py::array output(const cv::Mat &mat) {
|
|
27
|
+
std::vector<py::ssize_t> shape{mat.rows, mat.cols};
|
|
28
|
+
if (mat.channels() > 1) shape.push_back(mat.channels());
|
|
29
|
+
py::dtype dtype = mat.depth() == CV_32F ? py::dtype::of<float>() : py::dtype::of<uint8_t>();
|
|
30
|
+
py::array out(dtype, shape);
|
|
31
|
+
auto continuous = mat.isContinuous() ? mat : mat.clone();
|
|
32
|
+
if (mat.total()) std::memcpy(out.mutable_data(), continuous.data, mat.total() * mat.elemSize());
|
|
33
|
+
return out;
|
|
34
|
+
}
|
|
35
|
+
py::array_t<float> corners(const std::vector<cv::Point2f> &points) {
|
|
36
|
+
py::array_t<float> out({py::ssize_t(points.size()), py::ssize_t(2)});
|
|
37
|
+
auto v = out.mutable_unchecked<2>();
|
|
38
|
+
for (size_t i=0; i<points.size(); ++i) { v(i,0)=points[i].x; v(i,1)=points[i].y; }
|
|
39
|
+
return out;
|
|
40
|
+
}
|
|
41
|
+
template <typename T> void bind_pose(py::module_ &m) {
|
|
42
|
+
m.def("getSolvePnpPoints", [](const T &target, float size) {
|
|
43
|
+
if (!(size > 0) || !std::isfinite(size)) throw py::value_error("markerSize must be finite and positive");
|
|
44
|
+
cv::Mat obj, img;
|
|
45
|
+
a::getSolvePnpPoints(target, obj, img, size);
|
|
46
|
+
return py::make_tuple(output(obj), output(img));
|
|
47
|
+
}, py::arg("target"), py::arg("markerSize")=1.f);
|
|
48
|
+
}
|
|
49
|
+
template <typename T, typename F> py::array draw(const py::array &input, const std::vector<T> &targets, const std::array<double,3> &color, F fn) {
|
|
50
|
+
auto array = image_array(input);
|
|
51
|
+
cv::Mat result = view(array).clone();
|
|
52
|
+
fn(result, targets, cv::Scalar(color[0],color[1],color[2]));
|
|
53
|
+
return output(result);
|
|
54
|
+
}
|
|
55
|
+
PYBIND11_MODULE(_native, m) {
|
|
56
|
+
m.doc() = "Standalone NumPy bindings for ArUco2; detection releases the Python GIL";
|
|
57
|
+
m.attr("__version__") = "0.1.0";
|
|
58
|
+
m.attr("upstream_commit") = "c26b030cee4292649be566092812308fa179e871";
|
|
59
|
+
m.attr("opencv_version") = CV_VERSION;
|
|
60
|
+
auto dict = py::enum_<a::DictionaryType>(m, "DictionaryType");
|
|
61
|
+
#define DICT(name) dict.value(#name, a::name)
|
|
62
|
+
DICT(DICT_4X4_50); DICT(DICT_4X4_100); DICT(DICT_4X4_250); DICT(DICT_4X4_1000);
|
|
63
|
+
DICT(DICT_5X5_50); DICT(DICT_5X5_100); DICT(DICT_5X5_250); DICT(DICT_5X5_1000);
|
|
64
|
+
DICT(DICT_6X6_50); DICT(DICT_6X6_100); DICT(DICT_6X6_250); DICT(DICT_6X6_1000);
|
|
65
|
+
DICT(DICT_7X7_50); DICT(DICT_7X7_100); DICT(DICT_7X7_250); DICT(DICT_7X7_1000);
|
|
66
|
+
DICT(DICT_ARUCO_ORIGINAL); DICT(DICT_APRILTAG_16h5); DICT(DICT_APRILTAG_25h9);
|
|
67
|
+
DICT(DICT_APRILTAG_36h10); DICT(DICT_APRILTAG_36h11); DICT(DICT_ARUCO_MIP_36h12);
|
|
68
|
+
DICT(DICT_ALVAR_5X5_256); DICT(DICT_ALVAR_7X7_1000); DICT(DICT_RARUCO_16h4);
|
|
69
|
+
#undef DICT
|
|
70
|
+
dict.export_values();
|
|
71
|
+
py::enum_<a::FractalType>(m, "FractalType")
|
|
72
|
+
.value("FRACTAL_2L_6", a::FRACTAL_2L_6).value("FRACTAL_3L_6", a::FRACTAL_3L_6)
|
|
73
|
+
.value("FRACTAL_4L_6", a::FRACTAL_4L_6).value("FRACTAL_5L_6", a::FRACTAL_5L_6).export_values();
|
|
74
|
+
auto params = py::class_<a::DetectionParameters>(m,"DetectionParameters").def(py::init<>());
|
|
75
|
+
#define PARAM(name) params.def_readwrite(#name, &a::DetectionParameters::name)
|
|
76
|
+
PARAM(boxFilterSize); PARAM(thres); PARAM(minSize); PARAM(maxAttemptsPerCandidate);
|
|
77
|
+
PARAM(maxTimesRevisited); PARAM(errorCorrectionRate); PARAM(maxErroneousBitsInBorderRate);
|
|
78
|
+
PARAM(detectColorMode); PARAM(gridBitSampling); PARAM(harrisThresh);
|
|
79
|
+
#undef PARAM
|
|
80
|
+
m.attr("DetectorParameters") = m.attr("DetectionParameters");
|
|
81
|
+
py::class_<a::FiducialMarker>(m,"FiducialMarker")
|
|
82
|
+
.def_readonly("id", &a::FiducialMarker::id)
|
|
83
|
+
.def_readonly("dictionary", &a::FiducialMarker::dictionary)
|
|
84
|
+
.def_property_readonly("corners", [](const a::FiducialMarker &v){return corners(v.corners);});
|
|
85
|
+
py::class_<a::GridBoard>(m,"GridBoard")
|
|
86
|
+
.def_readonly("markers", &a::GridBoard::markers).def_readonly("dictionary", &a::GridBoard::dictionary)
|
|
87
|
+
.def_property_readonly("gridSize", [](const a::GridBoard &b){return py::make_tuple(b.gridSize.width,b.gridSize.height);});
|
|
88
|
+
py::class_<a::Diamond>(m,"Diamond")
|
|
89
|
+
.def_readonly("markers", &a::Diamond::markers).def_readonly("dictionary", &a::Diamond::dictionary)
|
|
90
|
+
.def_property_readonly("id", [](const a::Diamond &d){return std::array<int,4>{d.id[0],d.id[1],d.id[2],d.id[3]};});
|
|
91
|
+
py::class_<a::FractalMarker>(m,"FractalMarker")
|
|
92
|
+
.def_readonly("id", &a::FractalMarker::id).def_readonly("type", &a::FractalMarker::type)
|
|
93
|
+
.def_property_readonly("corners", [](const a::FractalMarker &v){return corners(v.corners);});
|
|
94
|
+
m.def("detectFiducialMarkers", [](const py::array &input, a::DictionaryType d, const a::DetectionParameters &p){
|
|
95
|
+
auto arr=image_array(input); auto mat=view(arr); py::gil_scoped_release release;
|
|
96
|
+
return a::detectFiducialMarkers(mat,d,p);
|
|
97
|
+
}, py::arg("image"),py::arg("dictionary")=a::DICT_ARUCO_MIP_36h12,py::arg("parameters")=a::DetectionParameters());
|
|
98
|
+
m.def("detectFiducialMarkers", [](const py::array &input, const std::vector<a::DictionaryType> &d, const a::DetectionParameters &p){
|
|
99
|
+
if (d.empty()) throw py::value_error("dictionaries must not be empty");
|
|
100
|
+
auto arr=image_array(input); auto mat=view(arr); py::gil_scoped_release release;
|
|
101
|
+
return a::detectFiducialMarkers(mat,d,p);
|
|
102
|
+
}, py::arg("image"),py::arg("dictionaries"),py::arg("parameters")=a::DetectionParameters());
|
|
103
|
+
m.def("detectRArucoMarkers", [](const py::array &input,a::DictionaryType d,const a::DetectionParameters &p){
|
|
104
|
+
auto arr=image_array(input); auto mat=view(arr); py::gil_scoped_release release;
|
|
105
|
+
return a::detectRArucoMarkers(mat,d,p);
|
|
106
|
+
},py::arg("image"),py::arg("dictionary")=a::DICT_APRILTAG_16h5,py::arg("parameters")=a::DetectionParameters());
|
|
107
|
+
m.def("detectGridBoard", [](const py::array &input,std::array<int,2> size,a::DictionaryType d,const std::vector<int> &ids){
|
|
108
|
+
if (size[0]<=0 || size[1]<=0) throw py::value_error("gridSize must be positive");
|
|
109
|
+
auto arr=image_array(input); a::GridBoard board{}; bool found;
|
|
110
|
+
{py::gil_scoped_release release; found=a::detectGridBoard(view(arr),cv::Size(size[0],size[1]),d,board,ids);}
|
|
111
|
+
return py::make_tuple(found,board);
|
|
112
|
+
},py::arg("image"),py::arg("gridSize"),py::arg("dictionary"),py::arg("ids")=std::vector<int>{});
|
|
113
|
+
m.def("detectDiamonds", [](const py::array &input,a::DictionaryType d){
|
|
114
|
+
auto arr=image_array(input); py::gil_scoped_release release; return a::detectDiamonds(view(arr),d);
|
|
115
|
+
},py::arg("image"),py::arg("dictionary"));
|
|
116
|
+
m.def("detectFractals", [](const py::array &input,a::FractalType t){
|
|
117
|
+
auto arr=image_array(input); py::gil_scoped_release release; return a::detectFractals(view(arr),t);
|
|
118
|
+
},py::arg("image"),py::arg("type"));
|
|
119
|
+
m.def("getFiducialMarkerImage", [](a::DictionaryType d,int id,int bit,bool border){
|
|
120
|
+
if(bit<=0) throw py::value_error("bitSize must be positive");
|
|
121
|
+
cv::Mat img; a::getFiducialMarkerImage(img,d,id,bit,border); return output(img);
|
|
122
|
+
},py::arg("dictionary"),py::arg("id"),py::arg("bitSize")=20,py::arg("externalBorder")=true);
|
|
123
|
+
m.def("getGridBoardImage", [](std::array<int,2> size,a::DictionaryType d,int bit,const std::vector<int> &ids){
|
|
124
|
+
if(size[0]<=0 || size[1]<=0 || bit<=0) throw py::value_error("boardSize and bitSize must be positive");
|
|
125
|
+
cv::Mat img; a::getGridBoardImage(img,cv::Size(size[0],size[1]),d,bit,ids); return output(img);
|
|
126
|
+
},py::arg("boardSize"),py::arg("dictionary"),py::arg("bitSize")=25,py::arg("ids")=std::vector<int>{});
|
|
127
|
+
m.def("getDiamondImage", [](a::DictionaryType d,std::array<int,4> ids,int bit){
|
|
128
|
+
if(bit<=0) throw py::value_error("bitSize must be positive");
|
|
129
|
+
cv::Mat img; a::getDiamondImage(img,d,cv::Vec4i(ids[0],ids[1],ids[2],ids[3]),bit); return output(img);
|
|
130
|
+
},py::arg("dictionary"),py::arg("ids"),py::arg("bitSize")=25);
|
|
131
|
+
m.def("getFractalMarkerImage", [](a::FractalType t,int id,int bit){
|
|
132
|
+
if(bit<=0) throw py::value_error("bitSize must be positive");
|
|
133
|
+
cv::Mat img; a::getFractalMarkerImage(img,t,id,bit); return output(img);
|
|
134
|
+
},py::arg("type"),py::arg("id")=0,py::arg("bitSize")=20);
|
|
135
|
+
m.def("getRArucoMarkerImage", [](a::DictionaryType d,int id,int depth,int bit,int inner,bool border){
|
|
136
|
+
if(bit<=0 || depth<0 || depth>8 || inner<0) throw py::value_error("invalid bitSize, depth (0..8), or innerBorders");
|
|
137
|
+
cv::Mat img; a::getRArucoMarkerImage(img,d,id,depth,bit,inner,border); return output(img);
|
|
138
|
+
},py::arg("dictionary")=a::DICT_APRILTAG_16h5,py::arg("id")=0,py::arg("depth")=2,
|
|
139
|
+
py::arg("bitSize")=5,py::arg("innerBorders")=2,py::arg("externalBorder")=true);
|
|
140
|
+
const auto green=std::array<double,3>{0,255,0};
|
|
141
|
+
m.def("drawFiducialMarkers",[](const py::array &img,const std::vector<a::FiducialMarker> &v,std::array<double,3> color){
|
|
142
|
+
return draw(img,v,color,[](auto &out,const auto &items,auto c){a::drawFiducialMarkers(out,items,c);});
|
|
143
|
+
},py::arg("image"),py::arg("markers"),py::arg("color")=green);
|
|
144
|
+
m.def("drawDiamonds",[](const py::array &img,const std::vector<a::Diamond> &v,std::array<double,3> color){
|
|
145
|
+
return draw(img,v,color,[](auto &out,const auto &items,auto c){a::drawDiamonds(out,items,c);});
|
|
146
|
+
},py::arg("image"),py::arg("diamonds"),py::arg("color")=green);
|
|
147
|
+
m.def("drawFractals",[](const py::array &img,const std::vector<a::FractalMarker> &v,std::array<double,3> color,bool all){
|
|
148
|
+
return draw(img,v,color,[all](auto &out,const auto &items,auto c){a::drawFractals(out,items,c,all);});
|
|
149
|
+
},py::arg("image"),py::arg("fractals"),py::arg("color")=green,py::arg("drawAllImagePoints")=true);
|
|
150
|
+
m.def("drawGridBoard",[](const py::array &img,const a::GridBoard &board,std::array<double,3> color,bool ids){
|
|
151
|
+
auto arr=image_array(img); auto out=view(arr).clone();
|
|
152
|
+
a::drawGridBoard(out,board,cv::Scalar(color[0],color[1],color[2]),ids); return output(out);
|
|
153
|
+
},py::arg("image"),py::arg("board"),py::arg("color")=green,py::arg("drawMarkerIds")=false);
|
|
154
|
+
bind_pose<a::FiducialMarker>(m); bind_pose<a::GridBoard>(m); bind_pose<a::Diamond>(m); bind_pose<a::FractalMarker>(m);
|
|
155
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["scikit-build-core>=0.12", "pybind11>=2.13"]
|
|
3
|
+
build-backend = "scikit_build_core.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "python-aruco2"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "NumPy Python bindings for rmsalinas/aruco2"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
license-files = ["LICENSE", "UPSTREAM.md", "vendor/aruco2/LICENSE", "src/aruco2/licenses/*"]
|
|
13
|
+
dependencies = ["numpy>=1.23"]
|
|
14
|
+
|
|
15
|
+
[project.urls]
|
|
16
|
+
Repository = "https://github.com/hit-labvn/python-aruco2"
|
|
17
|
+
Issues = "https://github.com/hit-labvn/python-aruco2/issues"
|
|
18
|
+
|
|
19
|
+
[project.optional-dependencies]
|
|
20
|
+
test = ["pytest>=8"]
|
|
21
|
+
|
|
22
|
+
[tool.scikit-build]
|
|
23
|
+
cmake.version = ">=3.24"
|
|
24
|
+
cmake.build-type = "Release"
|
|
25
|
+
build-dir = "build/{wheel_tag}"
|
|
26
|
+
wheel.packages = ["src/aruco2"]
|
|
27
|
+
install.components = ["python-aruco2"]
|
|
28
|
+
sdist.include = ["vendor/aruco2/src/**", "vendor/aruco2/opencv2/**", "vendor/aruco2/opencl/**", "vendor/aruco2/utils/cl2cpp.cmake", "vendor/aruco2/LICENSE"]
|
|
29
|
+
sdist.exclude = ["vendor/aruco2/.git/**", ".venv*/**", "build/**", "dist/**", "*.log"]
|
|
30
|
+
|
|
31
|
+
[tool.pytest.ini_options]
|
|
32
|
+
testpaths = ["tests"]
|
|
33
|
+
|
|
34
|
+
[tool.cibuildwheel]
|
|
35
|
+
build = "cp3{10,11,12,13,14}-*"
|
|
36
|
+
skip = "*-musllinux_* *-win32 *-manylinux_i686"
|
|
37
|
+
archs = ["auto64"]
|
|
38
|
+
test-requires = ["pytest>=8"]
|
|
39
|
+
test-command = "python -m pytest {project}/tests -p no:cacheprovider -q"
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"""Public API. Images are uint8 NumPy arrays; coordinates are float32."""
|
|
2
|
+
from enum import Enum
|
|
3
|
+
from typing import Sequence
|
|
4
|
+
import numpy as np
|
|
5
|
+
from numpy.typing import NDArray
|
|
6
|
+
|
|
7
|
+
class DictionaryType(Enum):
|
|
8
|
+
DICT_4X4_50 = 0
|
|
9
|
+
DICT_4X4_100 = 1
|
|
10
|
+
DICT_4X4_250 = 2
|
|
11
|
+
DICT_4X4_1000 = 3
|
|
12
|
+
DICT_5X5_50 = 4
|
|
13
|
+
DICT_5X5_100 = 5
|
|
14
|
+
DICT_5X5_250 = 6
|
|
15
|
+
DICT_5X5_1000 = 7
|
|
16
|
+
DICT_6X6_50 = 8
|
|
17
|
+
DICT_6X6_100 = 9
|
|
18
|
+
DICT_6X6_250 = 10
|
|
19
|
+
DICT_6X6_1000 = 11
|
|
20
|
+
DICT_7X7_50 = 12
|
|
21
|
+
DICT_7X7_100 = 13
|
|
22
|
+
DICT_7X7_250 = 14
|
|
23
|
+
DICT_7X7_1000 = 15
|
|
24
|
+
DICT_ARUCO_ORIGINAL = 16
|
|
25
|
+
DICT_APRILTAG_16h5 = 17
|
|
26
|
+
DICT_APRILTAG_25h9 = 18
|
|
27
|
+
DICT_APRILTAG_36h10 = 19
|
|
28
|
+
DICT_APRILTAG_36h11 = 20
|
|
29
|
+
DICT_ARUCO_MIP_36h12 = 21
|
|
30
|
+
DICT_ALVAR_5X5_256 = 22
|
|
31
|
+
DICT_ALVAR_7X7_1000 = 23
|
|
32
|
+
DICT_RARUCO_16h4 = 24
|
|
33
|
+
|
|
34
|
+
class FractalType(Enum):
|
|
35
|
+
FRACTAL_2L_6 = 0
|
|
36
|
+
FRACTAL_3L_6 = 1
|
|
37
|
+
FRACTAL_4L_6 = 2
|
|
38
|
+
FRACTAL_5L_6 = 3
|
|
39
|
+
|
|
40
|
+
class DetectionParameters:
|
|
41
|
+
boxFilterSize: int
|
|
42
|
+
thres: int
|
|
43
|
+
minSize: int
|
|
44
|
+
maxAttemptsPerCandidate: int
|
|
45
|
+
maxTimesRevisited: float
|
|
46
|
+
errorCorrectionRate: float
|
|
47
|
+
maxErroneousBitsInBorderRate: float
|
|
48
|
+
detectColorMode: int
|
|
49
|
+
gridBitSampling: bool
|
|
50
|
+
harrisThresh: float
|
|
51
|
+
def __init__(self) -> None: ...
|
|
52
|
+
DetectorParameters = DetectionParameters
|
|
53
|
+
|
|
54
|
+
class FiducialMarker:
|
|
55
|
+
@property
|
|
56
|
+
def id(self) -> int: ...
|
|
57
|
+
@property
|
|
58
|
+
def dictionary(self) -> DictionaryType: ...
|
|
59
|
+
@property
|
|
60
|
+
def corners(self) -> NDArray[np.float32]: ...
|
|
61
|
+
class GridBoard:
|
|
62
|
+
@property
|
|
63
|
+
def gridSize(self) -> tuple[int, int]: ...
|
|
64
|
+
@property
|
|
65
|
+
def dictionary(self) -> DictionaryType: ...
|
|
66
|
+
@property
|
|
67
|
+
def markers(self) -> list[FiducialMarker]: ...
|
|
68
|
+
class Diamond:
|
|
69
|
+
@property
|
|
70
|
+
def id(self) -> list[int]: ...
|
|
71
|
+
@property
|
|
72
|
+
def dictionary(self) -> DictionaryType: ...
|
|
73
|
+
@property
|
|
74
|
+
def markers(self) -> list[FiducialMarker]: ...
|
|
75
|
+
class FractalMarker:
|
|
76
|
+
@property
|
|
77
|
+
def id(self) -> int: ...
|
|
78
|
+
@property
|
|
79
|
+
def type(self) -> FractalType: ...
|
|
80
|
+
@property
|
|
81
|
+
def corners(self) -> NDArray[np.float32]: ...
|
|
82
|
+
|
|
83
|
+
def detectFiducialMarkers(image: NDArray[np.uint8], dictionary: DictionaryType | Sequence[DictionaryType] = ..., parameters: DetectionParameters = ...) -> list[FiducialMarker]: ...
|
|
84
|
+
def detectRArucoMarkers(image: NDArray[np.uint8], dictionary: DictionaryType = ..., parameters: DetectionParameters = ...) -> list[FiducialMarker]: ...
|
|
85
|
+
def detectGridBoard(image: NDArray[np.uint8], gridSize: Sequence[int], dictionary: DictionaryType, ids: Sequence[int] = ...) -> tuple[bool, GridBoard]: ...
|
|
86
|
+
def detectDiamonds(image: NDArray[np.uint8], dictionary: DictionaryType) -> list[Diamond]: ...
|
|
87
|
+
def detectFractals(image: NDArray[np.uint8], type: FractalType) -> list[FractalMarker]: ...
|
|
88
|
+
def getFiducialMarkerImage(dictionary: DictionaryType, id: int, bitSize: int = ..., externalBorder: bool = ...) -> NDArray[np.uint8]: ...
|
|
89
|
+
def getGridBoardImage(boardSize: Sequence[int], dictionary: DictionaryType, bitSize: int = ..., ids: Sequence[int] = ...) -> NDArray[np.uint8]: ...
|
|
90
|
+
def getDiamondImage(dictionary: DictionaryType, ids: Sequence[int], bitSize: int = ...) -> NDArray[np.uint8]: ...
|
|
91
|
+
def getFractalMarkerImage(type: FractalType, id: int = ..., bitSize: int = ...) -> NDArray[np.uint8]: ...
|
|
92
|
+
def getRArucoMarkerImage(dictionary: DictionaryType = ..., id: int = ..., depth: int = ..., bitSize: int = ..., innerBorders: int = ..., externalBorder: bool = ...) -> NDArray[np.uint8]: ...
|
|
93
|
+
def getSolvePnpPoints(target: FiducialMarker | GridBoard | Diamond | FractalMarker, markerSize: float = ...) -> tuple[NDArray[np.float32], NDArray[np.float32]]: ...
|
|
94
|
+
def drawFiducialMarkers(image: NDArray[np.uint8], markers: Sequence[FiducialMarker], color: Sequence[float] = ...) -> NDArray[np.uint8]: ...
|
|
95
|
+
def drawGridBoard(image: NDArray[np.uint8], board: GridBoard, color: Sequence[float] = ..., drawMarkerIds: bool = ...) -> NDArray[np.uint8]: ...
|
|
96
|
+
def drawDiamonds(image: NDArray[np.uint8], diamonds: Sequence[Diamond], color: Sequence[float] = ...) -> NDArray[np.uint8]: ...
|
|
97
|
+
def drawFractals(image: NDArray[np.uint8], fractals: Sequence[FractalMarker], color: Sequence[float] = ..., drawAllImagePoints: bool = ...) -> NDArray[np.uint8]: ...
|
|
98
|
+
__version__: str
|
|
99
|
+
upstream_commit: str
|
|
100
|
+
opencv_version: str
|
|
101
|
+
DICT_4X4_50: DictionaryType
|
|
102
|
+
DICT_4X4_100: DictionaryType
|
|
103
|
+
DICT_4X4_250: DictionaryType
|
|
104
|
+
DICT_4X4_1000: DictionaryType
|
|
105
|
+
DICT_5X5_50: DictionaryType
|
|
106
|
+
DICT_5X5_100: DictionaryType
|
|
107
|
+
DICT_5X5_250: DictionaryType
|
|
108
|
+
DICT_5X5_1000: DictionaryType
|
|
109
|
+
DICT_6X6_50: DictionaryType
|
|
110
|
+
DICT_6X6_100: DictionaryType
|
|
111
|
+
DICT_6X6_250: DictionaryType
|
|
112
|
+
DICT_6X6_1000: DictionaryType
|
|
113
|
+
DICT_7X7_50: DictionaryType
|
|
114
|
+
DICT_7X7_100: DictionaryType
|
|
115
|
+
DICT_7X7_250: DictionaryType
|
|
116
|
+
DICT_7X7_1000: DictionaryType
|
|
117
|
+
DICT_ARUCO_ORIGINAL: DictionaryType
|
|
118
|
+
DICT_APRILTAG_16h5: DictionaryType
|
|
119
|
+
DICT_APRILTAG_25h9: DictionaryType
|
|
120
|
+
DICT_APRILTAG_36h10: DictionaryType
|
|
121
|
+
DICT_APRILTAG_36h11: DictionaryType
|
|
122
|
+
DICT_ARUCO_MIP_36h12: DictionaryType
|
|
123
|
+
DICT_ALVAR_5X5_256: DictionaryType
|
|
124
|
+
DICT_ALVAR_7X7_1000: DictionaryType
|
|
125
|
+
DICT_RARUCO_16h4: DictionaryType
|
|
126
|
+
FRACTAL_2L_6: FractalType
|
|
127
|
+
FRACTAL_3L_6: FractalType
|
|
128
|
+
FRACTAL_4L_6: FractalType
|
|
129
|
+
FRACTAL_5L_6: FractalType
|