Skip to main content

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

  1. Clone this repository
  2. Install the required dependencies:
pip install -r requirements.txt

Usage

  1. Configure your camera and target parameters in config.json
  2. 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.

Metadata

Release files for photogrammetry-target-locator 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for photogrammetry-target-locator 0.1.2
File Size Uploaded
photogrammetry_target_locator-0.1.2.tar.gz 13.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for photogrammetry-target-locator 0.1.2
File Interpreter ABI Platform
photogrammetry_target_locator-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 27.5 kB

Release files / photogrammetry_target_locator-0.1.2.tar.gz

Download URL photogrammetry_target_locator-0.1.2.tar.gz
Size 13.5 kB
Tags Source
SHA-256 checksum
How to use checksums
284063ef2972dd83ba6dfc98fd5420334eadeedc9bf7f4d9e68b0b7c0e4cfccb
BLAKE2b-256 checksum
How to use checksums
7d3ed971be6b9de5dda1d6533de5a71990a9b5356c29021f192de28f77a87da0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / photogrammetry_target_locator-0.1.2-py3-none-any.whl

Download URL photogrammetry_target_locator-0.1.2-py3-none-any.whl
Size 13.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f249e9d1c7abce77a96e2f96ec464ba0c4f885ebc451c72c0e44777a6f939aa0
BLAKE2b-256 checksum
How to use checksums
0c9805a2488df55754d37ab89ff021bd117c364812470e9d7854d7c8b41b6bd9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page