|
| 1 | +[](https://github.com/ManfredStoiber/stag-python/actions/workflows/python-publish.yml) |
| 2 | + |
| 3 | + |
| 4 | + |
1 | 5 | # Python Wrapper for [STag - A Stable, Occlusion-Resistant Fiducial Marker System](https://github.com/ManfredStoiber/stag)
|
2 | 6 |
|
3 | 7 | ## 📊 Comparison Between Different Marker Systems:
|
4 | 8 | [<img src="https://github.com/ManfredStoiber/stag/assets/47210077/668ca457-33dd-4ce7-8b94-662c7a5bb4d9" width="400" height="200" />](https://www.youtube.com/watch?v=vnHI3GzLVrY)
|
5 | 9 |
|
6 |
| -## 📋 Getting Started |
7 |
| -0. Install Prerequisites |
8 |
| - - [CMake >= 3.16](https://cmake.org/getting-started/) |
9 |
| - - On Linux: `apt install cmake` |
10 |
| - - [OpenCV 4](https://opencv.org/get-started/) for C++ |
11 |
| - - On Linux: `apt install libopencv-dev` |
12 |
| - - [Eigen 3](https://gitlab.com/libeigen/eigen) |
13 |
| - - On Linux: `apt install libeigen3-dev` |
14 |
| - - Run `pip install numpy` |
15 |
| - - On Linux: if during step 2.2 the error "numpy/ndarrayobject.h: No such file or directory" occurs, try one of following solutions: |
16 |
| - - Run `apt install python-numpy` or |
17 |
| - - Search for "ndarrayobject.h" (`find / -name ndarrayobject.h`) and create a symlink from its parent directory to "/usr/include/numpy" (e.g. `ln -s /usr/local/lib/python3.8/dist-packages/numpy/core/include/numpy /usr/include/numpy`) |
18 |
| - - Run `pip install opencv-python` |
19 |
| -1. Clone this repository recursively: `git clone --recursive https://github.com/ManfredStoiber/stag-python` |
20 |
| -2. Build |
21 |
| - 1. cd into project: `cd stag-python` |
22 |
| - 2. `pip install .` |
23 |
| -3. Run test app |
24 |
| - 1. `cd example` |
25 |
| - 2. `python example.py` |
26 |
| - |
27 | 10 | ## 📖 Usage
|
| 11 | +### Installation |
| 12 | +`pip install stag-python` |
| 13 | + |
28 | 14 |
|
29 |
| -For an example how to use this library, refer to [example.py](https://github.com/ManfredStoiber/stag-python/blob/master/example/example.py) |
| 15 | +### Example |
| 16 | +Note: in this example cv2 is used for loading the image. To use cv2, you need to install opencv-python: `pip install opencv-python` |
| 17 | +```Python |
| 18 | +import stag |
| 19 | +import cv2 |
| 20 | + |
| 21 | +# specify marker type |
| 22 | +libraryHD = 21 |
| 23 | + |
| 24 | +# load image |
| 25 | +image = cv2.imread("example.jpg") |
| 26 | + |
| 27 | +# detect markers |
| 28 | +(corners, ids, rejected_corners) = stag.detectMarkers(image, libraryHD) |
| 29 | +``` |
| 30 | + |
| 31 | +For a more comprehensive example refer to [example.py](https://github.com/ManfredStoiber/stag-python/blob/master/example/example.py) |
30 | 32 |
|
31 | 33 | ## 🏷 Markers
|
32 | 34 |
|
33 |
| -- Collection of markers: [Drive](https://drive.google.com/drive/folders/0ByNTNYCAhWbIV1RqdU9vRnd2Vnc?resourcekey=0-9ipvecbezW8EWUva5GBQTQ&usp=sharing) |
34 |
| -- Marker Generator: see [ref/marker generator](https://github.com/ManfredStoiber/stag/tree/master/ref/marker%20generator) for reference code for marker generation |
| 35 | +- Markers can be downloaded here: [Drive](https://drive.google.com/drive/folders/0ByNTNYCAhWbIV1RqdU9vRnd2Vnc?resourcekey=0-9ipvecbezW8EWUva5GBQTQ&usp=sharing) |
| 36 | +- Reference code for Marker Generator: [ref/marker_generator](https://github.com/ManfredStoiber/stag/tree/master/ref/marker_generator) |
| 37 | + |
| 38 | +## 🛠 Configuration |
| 39 | +Following parameters can be specified: |
| 40 | +- __`libraryHD`__: |
| 41 | + - Sets the "family" or "type" of used STag markers |
| 42 | + - Each library has a different amount of markers |
| 43 | + - Only the markers of the chosen library will be detected |
| 44 | + - The following HD libraries are possible: |
35 | 45 |
|
36 |
| -## 📔 Known Issues |
37 |
| -- Sometimes markers are detected multiple times |
38 |
| - - Workaround: only use one of the detections |
| 46 | + | __HD__ | 11 | 13 | 15 | 17 | 19 | 21 | 23 | |
| 47 | + |------------------|--------|-------|-----|-----|----|----|----| |
| 48 | + | __Library Size__ | 22,309 | 2,884 | 766 | 157 | 38 | 12 | 6 | |
| 49 | + |
| 50 | + - Specifies the used Hamming Distance, for further information refer to the [original paper](https://arxiv.org/abs/1707.06292) |
| 51 | + |
| 52 | + |
| 53 | +- __`errorCorrection`__: |
| 54 | + - Sets the amount of error correction |
| 55 | + - Has to be in range `0 <= errorCorrection <= (libraryHD-1)/2` |
| 56 | + - For further information refer to the [original paper](https://arxiv.org/abs/1707.06292) |
| 57 | + |
| 58 | +## 📋 Build From Source |
| 59 | +0. __Install__ Prerequisites |
| 60 | + |
| 61 | + [__CMake__ >= 3.16](https://cmake.org/getting-started/) |
| 62 | + - On Linux: `apt install cmake` |
| 63 | + |
| 64 | + [__OpenCV__ 4](https://opencv.org/get-started/) for C++ |
| 65 | + - On Linux: `apt install libopencv-dev` |
| 66 | + |
| 67 | + __NumPy__: `pip install numpy` |
| 68 | + - On Linux: if during step 2 the error `"numpy/ndarrayobject.h: No such file or directory"` occurs, try one of following solutions: |
| 69 | + - Run `apt install python-numpy` or |
| 70 | + - Search for "ndarrayobject.h" (`find / -name ndarrayobject.h`) and create a symlink from its parent directory to "/usr/include/numpy" (e.g. `ln -s /usr/local/lib/python3.8/dist-packages/numpy/core/include/numpy /usr/include/numpy`) |
| 71 | +1. __Clone__ this repository recursively: |
| 72 | + - `git clone --recursive https://github.com/ManfredStoiber/stag-python` |
| 73 | +2. __Build__ the project |
| 74 | + |
| 75 | + In the project directory, run the following command: |
| 76 | + |
| 77 | + - `pip install .` |
| 78 | +3. __Run__ the example |
| 79 | + 1. `cd example` |
| 80 | + 2. `python example.py` |
39 | 81 |
|
40 | 82 | ## 📰 Originally Published in the Following Paper:
|
41 | 83 |
|
42 | 84 | [B. Benligiray; C. Topal; C. Akinlar, "STag: A Stable Fiducial Marker System," Image and Vision Computing, 2019.](https://arxiv.org/abs/1707.06292)
|
43 | 85 |
|
44 |
| -Some figures from the paper: |
45 |
| - |
46 | 86 | <p align="center">
|
47 | 87 | <img src="https://user-images.githubusercontent.com/19530665/57179654-c0c11e00-6e88-11e9-9ca5-0c0153b28c91.png"/>
|
48 | 88 | </p>
|
|
0 commit comments