Skip to main content

Camera to geographic space image conversion

Project description

Camera2Geo: camera to geographic space image conversion

PyPI version QGIS Plugin License: AGPL v3 codecov DOI

Camera2Geo converts raw drone or camera images into georeferenced GeoTIFFs via image metadata and a camera model. This can be helpful to quickly view individual aerial images in GIS software, label image features in geographic space, and view images in full resolution rather than in orthomosaic resolution. Most common drone sensors automatically work but custom implementations are possible. The core functionality is built from Drone-Footprints but extended with additional features and an improved interface via a Python library, QGIS plugin, and CLI.

Please cite as: Lindiwe, K., Percival, J. E. H., & Perroy, R. (2025). Camera2Geo. Zenodo. https://doi.org/10.5281/zenodo.17578622

Usage

QGIS

In QGIS, images can be converted from geotagged photo points and automatically added as a temporary layer. In addition, there is a processing tool that can handle bulk processing. qgis_usage.gif

Python

In python, there is a simple function to process many images at once using glob input/output. An example is available in example_python.py

from camera2geo import *

camera2geo(
    input_images="/input/folder/*.JPG",
    output_images= "/output/folder/$.TIF",
    epsg = 4326,
    correct_magnetic_declination = True,
    cog = True,
    image_equalize = False,
    lens_correction = True,
    elevation_data = True,
)

CLI

In terminal, there is a simple fire based command line interface.

camera2geo \
  "/input/folder/*.JPG" \
  "/output/folder/$.TIF" \
  --epsg 4326 \
  --correct_magnetic_declination \
  --cog \
  --image_equalize \
  --lens_correction \
  --elevation_data

Functionality

camera2geo()

  1. Resolve Input Paths: Uses a glob pattern to search for one or many images.

  2. Read EXIF Metadata: Uses exiftool to extract GPS location, orientation, camera intrinsics, timestamp, and flight parameters.

  3. Determine Sensor Geometry: Includes camera presets for many popular drones that are automatically applied but the user can provide custom values.

  4. Elevation & Camera Pose Refinement (optional):

    • Use provided elevation raster or query for an online elevation API raster to sample ground position.
    • If RTK sidecar files are detected, refine camera altitude/orientation.
  5. Image Correction & Enhancement (optional)

    • Lens distortion correction
    • Radiometric equalization
  6. Geographic Coordinate Conversion: Computes ground footprint and projection based on camera model, orientation, and elevation, then reprojects into the target EPSG.

  7. Output GeoTIFF Creation: Writes georeferenced TIFFs to the output directory; optionally writes as COG.

read_metadata()

Read metadata from one or more images and print the results as YAML and return values. Each parameter includes all metadata source fields that contribute to its value (primary + fallback).

apply_metadata()

Apply or remove metadata on one or more images. If output_images is not provided, edits are applied in-place; otherwise, input files are copied first.

search_cameras()

Look up cameras by maker and model.

search_lenses()

Look up lenses compatible with the given camera.

Installation

QGIS Plugin Installation

  1. Install QGIS

  2. System requirements: Before installing, ensure you have the following system-level prerequisites:

  • exiftool
  • Python ≥ 3.10 and ≤ 3.12
  • PROJ ≥ 9.3
  • GDAL ≥ 3.10.2

Python Version: This plugin requires Python ≥ 3.10 and ≤ 3.13. QGIS ships with different versions of Python, to check, in the QGIS menu, go to QGIS>About gis. If your version of Python is not supported, you can update your QGIS (if available) or install it containerized with conda: conda create -n qgis_env python=3.12.9 "gdal>=3.10.2" "proj>=9.3" qgis -c conda-forge(may need to change package versions), conda activate qgis_env, then qgis to start the program.

Manual installation of EXIF Tool: The only system requirement that is not already installed with QGIS is exiftool which will need to be manually installed. It can be downloaded here but then must be moved to a folder where Python can find it, although, some installers do this automatically. If it's not moved automatically, you must move the exiftool executable (exe, etc) to a system path location listed, which can be found by going to in Plugin > Python Console and typingimport sys; sys.path. Then move the .exe (or other format) file to one of the folders listed and rename it (to exiftool.<extension>) if required (see install instructions in the downloaded EXIF Plugin for more info).

Python dependencies: The plugin will attempt to automatically install all Python dependencies that it requires in the QGIS Python interpreter using QPIP. If it is unable to, the user must manually locate the QGIS python interpreter and install the libraries dependencies.

  1. Install camera2geo QGIS plugin:
  • Go to Plugins → Manage and Install Plugins…
  • Find camera2geo in the list, install, and enable it
  • Find the plugin in the toolbar to convert individual geophoto points temporarily or in the Processing Toolbox for bulk processing

Python Library and CLI Installation

  1. System requirements: Before installing, ensure you have the following system-level prerequisites:
  • exiftool.exe
  • Python ≥ 3.10 and ≤ 3.12
  • PROJ ≥ 9.3
  • GDAL ≥ 3.10.2
  • pip

An easy way to install these dependancies is to use Miniconda:

conda create -n camera2geo python=3.12 "gdal>=3.10.2" "proj>=9.3" -c conda-forge
conda activate camera2geo
  1. Install camera2geo: You can automatically install the library via PyPI. (this method installs only the core code as a library):
pip install camera2geo

Source Installation

  1. Clone the Repository
git clone https://github.com/cankanoa/camera2geo.git
cd camera2geo
  1. System requirements: Before installing, ensure you have the following system-level prerequisites:
  • exiftool.exe
  • Python ≥ 3.10 and ≤ 3.12
  • PROJ ≥ 9.3
  • GDAL = 3.10.2

An easy way to install these dependancies is to use Miniconda:

conda create -n camera2geo python=3.12 "gdal>=3.10.2" "proj>=9.3" -c conda-forge
conda activate camera2geo
  1. Install Dependancies: The pyproject.toml defines core dependancies to run the library.
pip install . # Normal dependencies
pip install -e ".[dev]"   # Developer dependencies

Development Guide

Contributing

All contributions are welcome. This library is licensed under a AGPL-3.0 license. Please be respectful when contributing. To suggest a feature please create an issue. Te report a bug please create an issue. To add code to the library, please create a pull request against main.

Code Formatting

This library uses black formatting. Pre commit will check formatting but if you want to manually you can use the following:

make check-format # Checks format
make format # Actually formats the code

Tests

All public functions in the Python library should have tests. They are automatically run when commiting to main and can be run locally with following command:

pytest

Building From Source

Use the following commands to build code:

make python-build # Python wheel
make qgis-build # Qgis zip plugin file

Publish to Github, Pypi, and QGIS

Publishing a new version to GitHub versions, Pypi library, and QGIS plugin is all done with the single command below. This will automatically make a GitHub tag which will trigger workflows for each publishing method.

make version version=1.2.3

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

camera2geo-1.0.2.tar.gz (63.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

camera2geo-1.0.2-py3-none-any.whl (71.5 kB view details)

Uploaded Python 3

File details

Details for the file camera2geo-1.0.2.tar.gz.

File metadata

  • Download URL: camera2geo-1.0.2.tar.gz
  • Upload date:
  • Size: 63.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for camera2geo-1.0.2.tar.gz
Algorithm Hash digest
SHA256 dcbb2ffed01a4b09335e8ff85722380603108cc6154b481912b2b868f15a20f5
MD5 c07417fd6aa95ee6bd809589d0861a19
BLAKE2b-256 7ef7bcf2b34760e5780df28bbfde161405b55904a542ebf9475c86a5243a1836

See more details on using hashes here.

Provenance

The following attestation bundles were made for camera2geo-1.0.2.tar.gz:

Publisher: publish.yml on cankanoa/camera2geo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file camera2geo-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: camera2geo-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 71.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for camera2geo-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 40df1a49faf5b34ac8fbc0764a413e7f6825fd8a124e9a0fec624f2d3da29247
MD5 64f433da57e112a2d721fa5354fa519f
BLAKE2b-256 ec56fc305b9d95a54ef39866cccc98ccf221a05792147003f5b8c04f2326247c

See more details on using hashes here.

Provenance

The following attestation bundles were made for camera2geo-1.0.2-py3-none-any.whl:

Publisher: publish.yml on cankanoa/camera2geo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page