RSGISLib Drone Utilities

Sort Images

rsgislib.droneutils.split_photos_by_time(input_imgs, output_base_dir, time_split_secs=60, date_time_tag='DateTime', date_time_format='%Y:%m:%d %H:%M:%S', out_date_time_format='%Y%m%d_%H%M%S')

A function which splits a set of images (e.g., from drone surveys) by time. Where photos taken within the specified time window will be clustered together (default: 60 seconds). The photos are then copied into a new directory based on the start time of the cluster. Note, photos are copied and not moved from their current location.

Parameters:
  • input_imgs – a list of input images (e.g., glob.glob(”*.jpg”))

  • output_base_dir – the output base directory where the output directories will be created.

  • time_split_secs – The time difference in seconds for a new cluster to be created.

  • date_time_tag – the EXIF tag for the date / time of the acquisition. Default is ‘DataTime’ but this might be different for different cameras and therefore you might need to use the list_exif_info function to find the correct field.

  • date_time_format – The python datetime.strptime format string for the datetime provided in the EXIF metadata. Default: %Y:%m:%d %H:%M:%S

  • out_date_time_format – The python datetime.strftime format string for the used to create the output directory for the files. Note, this must be unique. Default: %Y%m%d_%H%M%S

Flightline Vectors

rsgislib.droneutils.create_flightline_vec(input_imgs: List[str], pts_vec_file: str, pts_vec_lyr: str, line_vec_file: str, line_vec_lyr: str, out_format: str = 'GPKG')

A function which takes a list input images, which have the GPS data within the EXIF data, and creates a vector layer of points with the key metadata and a line vector layer of the flightline. If the output vector file can take multiple layers (e.g., GPKG) then the same file can be provided for both pts_vec_file and line_vec_file.

Parameters:
  • input_imgs – List of input images

  • pts_vec_file – Output vector file for the photo points

  • pts_vec_lyr – Output vector layer for the photo points

  • line_vec_file – Output vector file for the flightline

  • line_vec_lyr – Output vector layer for the flightline

  • out_format – output vector format

rsgislib.droneutils.create_flightline_extern_gps_vec(gps_data_df, input_imgs_dir: str, pts_vec_file: str, pts_vec_lyr: str, line_vec_file: str, line_vec_lyr: str, out_format: str = 'GPKG')

A function which takes an external GPS dataset and the photo image files and creates a vector layer of points with the key metadata and a line vector layer of the flightline. If the output vector file can take multiple layers (e.g., GPKG) then the same file can be provided for both pts_vec_file and line_vec_file.

The input pandas DataFrame needs to have the following columns: image, lat, lon, alt, roll, pitch, yaw

The columns should be: image - image file name lat - latitude lon - longitude alt - absolute altitude roll - flight roll pitch - flight pitch yaw - flight yaw

Parameters:
  • gps_data_df – A pandas DataFrame with the external GPS data.

  • input_imgs_dir – The directory with input images

  • pts_vec_file – Output vector file for the photo points

  • pts_vec_lyr – Output vector layer for the photo points

  • line_vec_file – Output vector file for the flightline

  • line_vec_lyr – Output vector layer for the flightline

  • out_format – output vector format

Header Edits

rsgislib.droneutils.define_extern_gps_in_imgs(gps_data_df, input_imgs_dir: str, flying_height: float, gimbal_roll: float, gimbal_pitch: float, gimbal_yaw: float, overwrite: bool = False)

The input pandas DataFrame needs to have the following columns: image, lat, lon, alt, roll, pitch, yaw

The columns should be: image - image file name lat - latitude lon - longitude alt - absolute altitude roll - flight roll pitch - flight pitch yaw - flight yaw

Parameters:
  • gps_data_df – A pandas DataFrame with the external GPS data.

  • input_imgs_dir – The directory with input images

  • flying_height – The flying height of the drone to be used as the relative elevation

  • gimbal_roll – The gimbal roll angle (degrees)

  • gimbal_pitch – The gimbal pitch angle (degrees)

  • gimbal_yaw – The gimbal yaw angle (degrees)

  • overwrite – If True (Default: False) then the input images are overwritten