Camera to geographic space image conversion
Project description
Camera2Geo: camera to geographic space image conversion
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.
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 4.x, 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.
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,
projection = "point",
elevation_surface = "local_file",
elevation_file = "/input/dem.tif",
no_data_value = 0,
replace_nodata_value = 1,
)
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 \
--projection point \
--elevation_surface local_file \
--elevation_file /input/dem.tif \
--no_data_value 0 \
--replace_nodata_value 1
Functionality
camera2geo()
-
Resolve Input Paths: Uses a glob pattern to search for one or many images.
-
Read EXIF Metadata: Uses the pure-Python
ExifReadpackage plus lightweight XMP parsing to extract GPS location, orientation, camera intrinsics, timestamp, and flight parameters. -
Determine Sensor Geometry: Includes camera presets for many popular drones that are automatically applied but the user can provide custom values.
-
Elevation & Camera Pose Refinement (optional):
projection="point"samples terrain at the camera point and projects to a flat plane.projection="mesh"intersects image rays against the elevation surface.elevation_surface="local_file"uses a supplied raster path.elevation_surface="opentopo_extent"downloads an OpenTopographySRTMGL1_Eraster for a WGS84 bounding box and uses that surface.- If RTK sidecar files are detected, refine camera altitude/orientation.
-
Image Correction & Enhancement (optional)
- Lens distortion correction
- Radiometric equalization
-
Geographic Coordinate Conversion: Computes ground footprint and projection based on camera model, orientation, and elevation, then reprojects into the target EPSG.
-
Output GeoTIFF Creation: Writes georeferenced TIFFs to the output directory; optionally writes as COG.
read_metadata()
Read metadata from one or more images with ExifRead and print the normalized metadata as YAML.
apply_metadata()
Apply or remove metadata on one or more images with exiv2. 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
-
Install QGIS
-
System requirements: Before installing, ensure you have the following system-level prerequisites:
- Python ≥ 3.10 and ≤ 3.12
- PROJ ≥ 9.3
- GDAL ≥ 3.10.2
QGIS Version: This plugin now targets QGIS 4.x only. Older QGIS releases are no longer supported.
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.
- 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
- System requirements: Before installing, ensure you have the following system-level prerequisites:
- 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
- Install camera2geo: You can automatically install the library via PyPI. (this method installs only the core code as a library):
pip install camera2geo
This installs ExifRead for metadata reads and exiv2 for the optional metadata-writing helper.
Source Installation
- Clone the Repository
git clone https://github.com/cankanoa/camera2geo.git
cd camera2geo
- System requirements: Before installing, ensure you have the following system-level prerequisites:
- 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
- Install Dependancies: The
pyproject.tomldefines 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 Support
This library was developed at the Spatial Data Analysis and Visualization Lab (SDAV) at the University of Hawaii at Hilo by Kanoa Lindiwe. Funding was partly provided by the Hau‘oli Mau Loa Foundation, in addition to the National Science Foundation EPSCoR grant 2149133, Change Hawaiʻi: Harnessing the Data Revolution for Island Resilience.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file camera2geo-1.1.0.tar.gz.
File metadata
- Download URL: camera2geo-1.1.0.tar.gz
- Upload date:
- Size: 69.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3c5a5e0ada61b6a23e473d387ffc736a78882247a63d75086ce427cd7174249c
|
|
| MD5 |
35f464aca81908060ea566b8ba6bb12f
|
|
| BLAKE2b-256 |
cfc904e46bb0ddfdceb0b1cb6957d58b53a28fff4576f6ca2208a926fd5ec2b8
|
Provenance
The following attestation bundles were made for camera2geo-1.1.0.tar.gz:
Publisher:
publish.yml on cankanoa/camera2geo
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
camera2geo-1.1.0.tar.gz -
Subject digest:
3c5a5e0ada61b6a23e473d387ffc736a78882247a63d75086ce427cd7174249c - Sigstore transparency entry: 1783386619
- Sigstore integration time:
-
Permalink:
cankanoa/camera2geo@b8c19a6d1bd825bb67646d251749dd3b3a8b5f70 -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/cankanoa
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b8c19a6d1bd825bb67646d251749dd3b3a8b5f70 -
Trigger Event:
push
-
Statement type:
File details
Details for the file camera2geo-1.1.0-py3-none-any.whl.
File metadata
- Download URL: camera2geo-1.1.0-py3-none-any.whl
- Upload date:
- Size: 78.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
345698eed72515f807c80251e0983ce9b5af868d389c493dfcf5a7aef7eccd3e
|
|
| MD5 |
24916644f4099efd73dba9fc2b519e40
|
|
| BLAKE2b-256 |
bdad5673723c3feff7c63b9e3471b8744147b2779289785d7b7dd9c35648ac54
|
Provenance
The following attestation bundles were made for camera2geo-1.1.0-py3-none-any.whl:
Publisher:
publish.yml on cankanoa/camera2geo
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
camera2geo-1.1.0-py3-none-any.whl -
Subject digest:
345698eed72515f807c80251e0983ce9b5af868d389c493dfcf5a7aef7eccd3e - Sigstore transparency entry: 1783386803
- Sigstore integration time:
-
Permalink:
cankanoa/camera2geo@b8c19a6d1bd825bb67646d251749dd3b3a8b5f70 -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/cankanoa
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b8c19a6d1bd825bb67646d251749dd3b3a8b5f70 -
Trigger Event:
push
-
Statement type: