Calculate real-world coordinates from camera images
Project description
Photogrammetry Target Locator
This tool calculates the real-world geographic coordinates (latitude, longitude, altitude) of a target point identified in a camera image, based on the camera's position, orientation, and intrinsic parameters.
Features
- Camera position and orientation input
- Camera intrinsic parameter configuration with FOV angles
- Target pixel coordinate specification
- Terrain elevation data from USGS Elevation Point Query Service (EPQS)
- WGS84 coordinate system
- Configurable via JSON
Installation
- Clone this repository
- Install the required dependencies:
pip install -r requirements.txt
Usage
- Configure your camera and target parameters in
config.json - Run the program:
python main.py
Alternatively, you can specify a different configuration file:
python main.py path/to/your/config.json
Configuration
The configuration file (config.json) contains the following parameters:
- Camera Position:
- Latitude, longitude, altitude
- Heading (0-360 degrees, clockwise from North)
- Camera Orientation: Roll, pitch, yaw (in degrees)
- Camera Intrinsics:
- Field of view (horizontal and vertical angles in degrees)
- Principal point (optional, defaults to image center)
- Sensor size (width and height in pixels)
- Target: Pixel coordinates in the image
Example configuration:
{
"camera": {
"position": {
"latitude": 37.7749,
"longitude": -122.4194,
"altitude": 100.0,
"heading": 45.0
},
"orientation": {
"roll": 0.0,
"pitch": -120.0,
"yaw": 0.0
},
"intrinsics": {
"field_of_view": {
"horizontal_degrees": 65.5,
"vertical_degrees": 46.4
},
"sensor_size": {
"width": 1920,
"height": 1080
}
}
},
"target": {
"pixel_coordinates": {
"x": 1200,
"y": 700
}
}
}
Position vs. Orientation
The difference between heading and yaw:
- Heading: The compass direction the camera platform is facing (0-360° clockwise from North)
- Yaw: The rotation of the camera relative to the platform's heading
For example, if your drone is flying north (heading = 0°) but the camera is rotated 45° to the right, you would set heading = 0° and yaw = 45°. The effective camera direction would be northeast.
Terrain Elevation
The program uses the USGS Elevation Point Query Service (EPQS) to provide accurate elevation data, which offers several advantages:
- Real-time data: Retrieves elevation data on demand
- No local files: No need to download and manage large DEM files
- Up-to-date information: Access to the most current elevation data
- Wide coverage: Covers the United States and many international locations
The system automatically handles:
- API request caching to improve performance
- Rate limiting to avoid service throttling
- Multiple retries for intermittent connectivity issues
- Graceful fallback to a default height of 0.0 meters if the service is unavailable
About USGS Elevation Point Query Service (EPQS)
The USGS EPQS provides elevation data for any point in the United States and many international locations. The service:
- Is free to use (with reasonable rate limits)
- Provides data from multiple elevation datasets
- Returns elevations in meters or feet
- Has a REST API that's easy to work with
Output
The program outputs the calculated target coordinates to the console and saves them to a JSON file with the same name as the input configuration file, but with _result.json appended.
Example output:
Target coordinates:
Latitude: 37.77375463 degrees
Longitude: -122.42089574 degrees
Altitude: 105.32 meters
Results saved to config_result.json
The altitude value reflects the accurate terrain height at the target location based on USGS elevation data.
Project details
Release history Release notifications | RSS feed
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 photogrammetry_target_locator-0.1.2.tar.gz.
File metadata
- Download URL: photogrammetry_target_locator-0.1.2.tar.gz
- Upload date:
- Size: 13.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
284063ef2972dd83ba6dfc98fd5420334eadeedc9bf7f4d9e68b0b7c0e4cfccb
|
|
| MD5 |
6c8ea5ad83cc1fbb0d49f1276a78d337
|
|
| BLAKE2b-256 |
7d3ed971be6b9de5dda1d6533de5a71990a9b5356c29021f192de28f77a87da0
|
File details
Details for the file photogrammetry_target_locator-0.1.2-py3-none-any.whl.
File metadata
- Download URL: photogrammetry_target_locator-0.1.2-py3-none-any.whl
- Upload date:
- Size: 13.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f249e9d1c7abce77a96e2f96ec464ba0c4f885ebc451c72c0e44777a6f939aa0
|
|
| MD5 |
987652ab66eebae33f4dce34c3301079
|
|
| BLAKE2b-256 |
0c9805a2488df55754d37ab89ff021bd117c364812470e9d7854d7c8b41b6bd9
|