# CoastSnap Automation - Batch download, registration and tagging
# CoastSnap Automation
## About this repo
This repo aims to automate the workflow to generate timelapses and do shoreline mapping with CoastSnap (Spotteron) images. It contains a couple of python/photoshop scripts that were written for the intended workflow: Download -> Register -> Tag -> Manually remove bad images in 'Registered'. See `workflow.pptx`, for a more informative schematic of the intended workflow. Batch downloading code is an extension on the Leaman CoastSnap Toolbox (http://git.wrl.unsw.edu.au:3000/chrisl/coastsnap.git)
This repo aims to automate the workflow to generate timelapses and do shoreline mapping with CoastSnap (Spotteron) images. Check out `workflow.pptx` for an informative schematic of the intended workflow. Batch downloading code is an extension on the Leaman CoastSnap Toolbox (http://git.wrl.unsw.edu.au:3000/chrisl/coastsnap.git)
This repo can:
* Download images stored on the Spotteron app service `batch_spotteron_download.bat`
* Register the downloaded images in photoshop `batch_photoshop_registration.bat`
* Tag registered images with the image date, time, tide and contributor `batch_tag_registered.bat`
* DOWNLOAD images stored on the Spotteron app service
* REGISTER the downloaded images in photoshop
* TAG registered images with the image date, time, tide and contributor
## Getting started
@ -51,28 +52,28 @@ path of the CoastsnapAuto/CoastSnap_DEMO directory.
### Update file paths
To run this code on the shared oneDrive CoastSnap directory:
1. Delete `coastsnap_sites.csv`
1. Delete or rename `coastsnap_sites.csv`
2. Rename `coastsnap_sites_ALL.csv` to `coastsnap_sites.csv`
3. Open `coastsnap_sites.csv` and change the path name in cell E2, to the oneDrive CoastSnap directory.
NOTE: `coastsnap_sites.csv` is called by all of the scripts in this repo. DON'T CHANGE THE STRUCTURE OF THE CSV, as it'll cause the registration.jsx scripts to die. Feel free to add more sites (rows) though.
NOTE: `coastsnap_sites.csv` is called by all of the scripts in this repo. DON'T CHANGE THE STRUCTURE OF THE CSV, as it'll cause the registration.jsx scripts to die. Feel free to add more sites (rows) and change the limits though.
### Updating repo with latest code
### Repo updates
If you want this repo's latest code, do the following:
1. Open your terminal and make sure you're in the directory you cloned the coastsnap repo into.
2. Ensure you have the coastsnap conda environment active: `activate coastsnap`
Script Logic: For every site in `coastsnap_sites.csv`, download the latest Spotteron images and save to Processed.
* Starts downloading from the most recent image and stops downloading for the site when an image has already been downloaded, to avoid overwriting images.
### Register images in photoshop
### 2. Photoshop image registration
#### Batch register
Run `batch_photoshop_registration.bat`
Run `2_batch_photoshop_registration.bat`
Script Logic: For every site in `coastsnap_sites.csv`, iterate through the sites' Processed images (Images/Site/Processed). For any image that hasn't already been photoshop registered (in Images/Site/Photoshop), register it.
@ -91,22 +92,27 @@ Script Logic: For every site in `coastsnap_sites.csv`, iterate through the sites
* Output images are all 1280px wide and will have the same aspect ratio as the sites' Target.jpg image
* Batch Size: Images are registered with the target and seed images, in batches of 15. This is set on line 13 of `photoshop_registration_all_sites.jsx` and can be changed. Images may be registered in smaller batch sizes if there are less than 15 images in the Site/Processed/Year folder.
### Tag images
### 3. Tag Images
#### Batch tag images
Run `batch_tag_registered.bat`
Run `3_batch_tag_registered.bat`
Script Logic: For every site in oneDrive CoastSnap directory, iterate through the sites' registered images (Images/Site/Photoshop). Tag the images with their Date, Time, Contributor and Tide (if tide data for site exists), suffix the filename with "_registered" and save at Images/Site/Registered.
* Starts tagging from the most recent image and stops for the site when an image has already been tagged. This way, the user can manually remove bad registered/tagged images, and they will not be automatically replaced.
* Retrieves tide data for the site from the .mat file specified in Database/CoastSnapDB.xlsx
#### Manual tagging
If you want a bit more control over your image tagging, you'll have to do it from the command line. `cd` to this repo and activate the coastsnap conda environment with `activate coastsnap`. Now `cd` to the `CoastsnapAuto/coastsnap` directory. From here, your options are:
1.
####
### Images Snapshot
### 4. Images Snapshot
Run `generate_images_snapshot.bat`
Generates `images_snapshot.csv` which contains information about the CoastSnap oneDrive Images directory. Columns include:
Generates `4_images_snapshot.csv` which contains information about the CoastSnap oneDrive Images directory. Columns include:
site | # processed | # photoshop | # registered | stability | most recently deleted