write_pose_metadata

write_pose_metadata#

rapidtools.data_sources.write_pose_metadata(image: Image | str | Path, destination: str | Path, camera: DroneCamera, quality: int = 92) → Path[source]#

Save a JPEG that carries camera as EXIF GPS tags and DJI-style XMP.

Useful for simulated flights and for writing refined poses back into photos, so that every tool reading DJI metadata (this package included) sees them.

Parameters:
  • image – The picture, or the path of one.

  • destination – JPEG file to write.

  • camera – Pose and lens to embed. relative_altitude_m and absolute_altitude_m are written when set, elevation_m otherwise.

  • quality – JPEG quality. Defaults to 92.

Returns:

pathlib.Path – The written file.

Example

>>> from PIL import Image
>>> camera = DroneCamera('a', 1.0, 2.0, 80.0, 90.0, -45.0, 64, 48, 60.0)
>>> path = write_pose_metadata(
...     Image.new('RGB', (64, 48)), 'pose_demo.jpg', camera
... )
>>> read_drone_image(path).pitch_deg
-45.0