Giter Site home page Giter Site logo

qaptadrone / gcp_aruco_generator Goto Github PK

View Code? Open in Web Editor NEW
8.0 1.0 1.0 75 KB

Create Aruco Markers to be used as Ground Control Points.

License: GNU General Public License v3.0

Python 100.00%
uav gcp python uas photogrammetry-tools aruco-markers

gcp_aruco_generator's Introduction

GCP ArUCo Marker Generator

This is a simple python tool that will help you generate Ground Control Points markers based on the ArUCo specification.

Marker example

This will create an SVG file, with a real sizing of the image (that is if you ask the tool to create a marker with a 1000mm side, that's exactly what it will do).

You then just have to send the corresponding file to a printer if you want it on a tarp or on a big sticker to make your own GCPs. You may have to convert it to a PDF file or a JPEG file. Check with your local printer.

Usage is simple and default settings are sane, but things can be customized very easily.

The complete list of parameters is as follows:

usage: create_marker.py [-h] [-b] [-c] [--center_alt] [--family]
                        [--family-count 10] [-i 0] [--id-color "darkcyan"]
                        [--margin 50] [-o ./] [-s 500] [--print-id]
                        [-t "4X4_50"] [--watermark "DO NO MOVE"]
                        [--watermark-color "black"]
                        [--watermark-sides "Side String"]
                        [--white-color "white"]

Generates ArUco Markers to be used as Grounds Control Points.
Default configuration is sensible. Output is highly customizable.
This tools creates SVG files that can be sent to a printer immediately.
The size parameter is important.

options:
  -h, --help            show this help message and exit
  -b, --border          Add a border around the marker. Default: False
  -c, --center          Add a center mark to the generated marker. Default:
                        False
  --center_alt          Alternative center mark. Creates a center mark that is
                        not an opposite image of the surrounding pixels.
                        Default: False
  -d "4X4_50", --dict "4X4_50"
                        ArUCo dictionary to use, one of 4X4_50, 4X4_100,
                        4X4_250, 4X4_1000, 5X5_50, 5X5_100, 5X5_250, 5X5_1000,
                        6X6_50, 6X6_100, 6X6_250, 6X6_1000, 7X7_50, 7X7_100,
                        7X7_250, 7X7_1000, ARUCO_ORIGINAL, APRILTAG_16h5,
                        APRILTAG_25h9, APRILTAG_36h10, APRILTAG_36h11.
                        Default: "4X4_50"
  --family              Generate the whole marker family (disregard the chosen
                        id). Default: False
  --family-count 10     Works with --family to generate a specific count of
                        markers from a specific family. The maximum number of
                        markers is defined by the chosen family. Default: None
  -i 0, --id 0          ID of ArUCo tag to generate. Default: 0
  --id-color "darkcyan"
                        Color of the id text (if printed with --print-id). Can
                        be any of the named SVG colors. Default: "darkcyan"
  --margin 50           Side margin in mm. Default: 50
  -o ./, --output ./    Path where the output image containing ArUCo marker
                        will be created. Default: ./
  -s 500, --size 500    Size in mm of the marker to be created. This size does
                        not take into account the margin. Default: 500
  --print-id            Print the id in the corner of the marker. Default:
                        False
  --watermark "DO NO MOVE"
                        Add a watermark around the marker on the four sides
                        around the marker. Default: None
  --watermark-color "black"
                        Color of the watermark text. Can be any of the named
                        SVG colors. Default: "black"
  --watermark-sides "Side String"
                        Change the watermark on the side of the marker to this
                        string. Default: None
  --white-color "white"
                        Color of the white part of the marker. Can be changed
                        to improve contrast. Can be any of the named SVG
                        colors. Default: "white"

For good size recommendations, please see
http://www.agt.bme.hu/on_line/gsd_calc/gsd_calc.html .

Setup and use

First installation

As this tool is written in python, we are going to use a virtual environment to setup the dependencies.

This tool is written to be used with python3 and to be used with Linux.

The following commands should be typed in a terminal to setup the environment:

git clone https://www.github.com/gromain/gcp_aruco_generator
cd gcp_aruco_generator
python3 -m venv venv
source venv/bin/activate
pip3 install -r requirements.txt

From this point on, the use of this tool is quite simple. You just type the command you need:

./marker_generator.py -c -b --print-id --id 1

Once you're done, just deactivate the virtual environment:

deactivate

Subsequent uses

If you need to create more markers, or use a different dictionary, you will need to activate the virtual environment again:

source venv/bin/activate
./marker_generator.py -c -b --print-id -s 800 --id 23

Once again, do not forget to deactivate the environment once you're done:

deactivate

Usage with Find GCP

This tool was created to ease the use of ArUCo marker as GCPs. After a flight you can use the Find GCP tool to find the markers in your pictures.

Inspirations

This project is similar to those others tools (yet different from them in several ways, mainly in that this tool creates a vectorized marker instead of a png):

Compatibility with geoBits

In theory, you should be able to generate geoBits markers. However, they use a custom dictionary for the markers. This dictionary has not been integrated in this tool and will not be, as we encourage the use of the standard dictionaries to improve interoperability. However, if someone wants to develop this functionality, you are very welcome to do so!

Development Roadmap

Here are some functionalities I'd like to develop for this tool. Suggestions are welcome!

  • Add direct to PDF output (with cairoSVG)
  • Add recommended parameters for FindGCP
  • Add a GUI and cross platform capabilities

gcp_aruco_generator's People

Contributors

gromain avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

gcp_aruco_generator's Issues

Default Use Fix

  • Current implementation doesn't produce any output in the svg with no arguments. Specifically you have to add -b to produce valid output. Maybe remove this switch.
  • set marker generator as executable
  • first line should be #!/usr/bin/env python3 to run on any system
  • Dictionaries up to 5X5 work for me. 6X6 and 7X7 get this error:
Total marker size is going to be 600mm
Ground Sampling Distance is a maximum of 10.4mm/pixels, fly accordingly
Your marker has been created and is available here ./6X6_100_0.svg .
Traceback (most recent call last):
  File "./marker_generator.py", line 699, in <module>
    generate_marker(marker_id)
  File "./marker_generator.py", line 382, in generate_marker
    svg.add(createPixels(svg, bits, datawidth, border, margin, white_color))
  File "./marker_generator.py", line 287, in createPixels
    if not border or bits[i * datawidth + j]:
IndexError: list index out of range
  • Dictionary arg should call 'upper' so that using "5x5_100" and "5X5_100" both work.

Line 225 - SyntaxError: invalid syntax

Running from command promt...
...\GitHub\gcp_aruco_generator>marker_generator.py -c -b --print-id --id 1

  File "...\GitHub\gcp_aruco_generator\marker_generator.py", line 225
    d=f"M{pixcount / 2} {pixcount / 2-circle_rad} A {circle_rad} {circle_rad} 0 0 0 {pixcount / 2-circle_rad} {pixcount / 2} L {pixcount / 2} {pixcount / 2}",
                                                                                                                                                            ^
SyntaxError: invalid syntax

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.