Skip to content

D. unique names

this script gives every camera trap image a unique name based on the season, location and time folder it is stored in. This is important for the database as it allows to identify each image uniquely regardless of where it is stored.

Renaming the folders and Images serves 2 purposes:

  1. removing any spaces from image or folder names as these can get annoying for processing
  2. renaming images by their Season, Location and Time Folder so each image has a unique name regardless of where it is stored.

This is done with the following script:

$ dataOrganization/D_uniqeImageNaming.py

Input

the variables to define can be found in the Input section:

imageFolders = organized image folder same as given in the scripts above seasons = seasons where images need to be renamed (not doing all makes it faster)

How it works

  1. it removes all spaces from names
  2. It renames an image using the season, location, Time and original image name to create a new unique image name with XXX as a separator. So image 2011_dry_season/5.882683N_23.386233E_ccf_dry_ssu/2012-04-07_to_2012-04-08_B19b/PICT1609.JPG is renamed to SEASONXXX2011_dry_seasonXXXLOCATIONXXX5.882683N_23.386233E_ccf_dry_ssuXXXDATEXXX2012-04-07_to_2012-04-08_B19bXXXIMAGEXXXPICT1609.JPG. The storage place and original name can be restored from the unique image name. There is commented code at the bottom of the scripts that shows how.