News:

2023-08-10 - ExifTool version 12.65 released

Main Menu

Metadata Tagging Code

Started by escamilllaa, June 21, 2019, 01:14:11 PM

Previous topic - Next topic

escamilllaa

Hi, I'm a student in a Research Experiences for Undergraduates (REU) program. I'm currently using camera traps to investigate the behavioral responses of wildlife with respect to human recreational trail use. I am trying to use the ExifTool software to tag, write, and extract metadata from my camera trap images, which can then be applied to additional software programs using R Studio. I've read through the ExifTool website explaining the codes and tags, but I'm getting a little lost. I understand how to extract metadata from images and convert the metadata into a .csv file, but I'm still struggling with writing and tagging images with metadata (i.e. identifying wildlife species and counts of animals within an image, etc.). If anyone has a more general script or explanation of how to do this, I would greatly appreciate any help!!!

Thanks!
Angie

StarGeek

Your question is a little vague.  It's hard to help you deal with metadata regarding your images without know some of the specifics.  For example, if you had an image with several deer in it.  What is the data you want to put in the file?  How do you want to format it?  For example, if you want to just say "This image has 5 deer in it", then would simply be a description.  But if you had been tracking this herd and could identify the individual animals and wanted that data in the file, that would be more complicated, probably needing a hierarchy tag structure. 

You might also look around on the web for what other people might have done along these lines.  For example, I came across these pages which might be helpful.  I just noticed it mentions exiftool, maybe you already knew about them?  I'd specifically point out the "Identifying species and individuals..." one as it seems to talk about how to set up your metadata.

Identifying species and individuals in camtrapR
Organising raw camera trap images in camtrapR
Extracting Data from Camera Trapping Images
Data exploration and visualisation in camtrapR
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

escamilllaa

Hi, thanks for your response!

There is no identification of individuals, just general tagging. So, one image may be (1 deer, 1 fox), another image may be (2 humans, 1 dog), etc.
I just figured out how to use the software program "SetEXIFData," which allows me to add in a description to images to tag animals. Specifically with ExifTool, I am wondering how to add metadata that is extracted from images into a csv file that has already been created with existing metadata that was previously extracted from other images. In other words, convert metadata from images into a csv file and then repeat that process, but adding the newly extracted metadata onto the previously created csv file.

The links you suggested correspond with my analysis because I plan to import the csv files with cataloged metadata (from ExifTool) into camtrapR for further analysis. However, the data must be cataloged in some way prior to being imported to camtrapR, which is why I'm trying to edit and extract the metadata.

StarGeek

Sorry for the delay in getting back here.

First thing I would suggest is taking an image that you have filled out the metadata for using SetEXIFData.  The next thing would be to export the data from that image to a csv file. There are a lot of details covered by FAQ #12, but I'd suggest using a command like this
exiftool -csv -a -g1 TESTFILE.jpg >testfile.csv

This will dump all the metadata in the file into the csv file.  There is going to be a large amount items that you probably don't want to edit, such as camera make and model, time image was taken, etc.  I'm assuming that you're going to look at the csv file in a spreadsheet.  Look through the data and find the columns that have data that you will probably want to edit.  Copy the column headers for those items.  You'll use those to create the csv file that you would use to edit with.

You would then run a new command to create the CSV file to do the edits.  You command would be something like
exiftool -csv -a -g1 -HEADER1 -HEADER2 -HEADER3 /path/to/edit/directory >Edit.csv
Replace the HEADER# with the headers that had the data you wanted to edit.  Make sure there's a hyphen in front of it.  You have to make sure it's a hyphen and not a long dash, as I recall sometimes there's a setting on Macs that will "help" you by auto-correcting.  That should give you a file to edit with.

Once you're done editing, then you can merge the new data back into the files.  This is covered by FAQ #26. The command would be something like
exiftool -csv="/path/to/Edit.csv" /path/to/edit/directory -sep ", "
The -sep part is only if you have a keywords/subject column, because without it, the keywords would end up as a single long keyword, not multiple separate keywords.  If you had a comma in some of your keyword data, for example, "Smith, John", then some corrections need to be made to both the commands.

Hopefully that will be helpful.  It's hard to give you exact procedures as I don't know what fields you're entering data into and I can't see what SetEXIFData does as it appears to be a Mac program and I don't own a Mac.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).