OdmConverter uses OpenDroneMap generated files to convert between geodetic coordinates and image coordinates and between image and orthophoto coordinates.
The content of a OpenDroneMap project. OpenDroneMap it self is not required.
Python3
OpenCV
python-magic (pip install python-magic)
numpy (pip install numpy)
pyquaternion (pip install pyquaternion)
- open a terminal in the folder where OdmConverter shall be.
- Clone the repository:
git clone git@github.com:egemose/OdmConverter.git
Import the OdmConverter class in a python file:
from odmConverter import OdmConverterOdmConverter(project, only_image_point2geodetic=False)Initialize the class for a given ODM project.
project: The path to the folder with the ODM project.
If only_image_point2geodetic is True "image_point2geodetic" is the only function working, but initializing is faster.
set_image(image_name)Use to tell the class the current image to work on.
Must be set before the first time image_point2geodetic or image2orthophoto is used.
image_name: is a string with the name of the image.
image_point2geodetic(u, v)Use to get the geodetic coordinate from image coordinates.
u, v: The image coordinates measured from top left. [pixels]
Returns: latitude [deg], longitude [deg]
geodetic2images(lat, lon)Use to get a list of images that can see the geodetic point
lat: latitude [deg]
lon: longitude [deg]
Returns: dictionary of images as keys and u, v as values.
image2orthophoto(u, v)Use to get the corresponding point in the orthophoto
u, v: The image coordinates measured from top left. [pixels]
Returns: x, y Orthophoto coordinates measured from top left. [pixels]
orthophoto2images(u, v)Use to get a list of images that can see the orthophoto point.
u, v: The orthophoto coordinates measured from top left. [pixels]
Returns: dict of images as keys and u, v af values.
show_coord_on_images(image_and_points, folder, color=(0, 0, 255))Use to visualize the found images and point from geodetic2images or orthophoto2images. Added as red circle around the point.
image_and_points: dict of images as keys and u, v af values.
folder: Place to save the images.
color: The color to draw with.
In exampleOdmConverter.py examples of how to use the OdmConverter class is showed.
Written by Henrik Dyrberg Egemose (hesc@mmmi.sdu.dk) as part of the InvaDrone project a research project by the University of Southern Denmark UAS Center (SDU UAS Center).
This project is licensed under the 3-Clause BSD License - see the LICENSE file for details.
- The code uses files generated in a OpenDroneMap project.
- The utm/geodetic converter is made by Kjeld Jensen (FroboMind).