Renaming images by time stamp (and does anyone have experience with spypoint manufactured cameras?)

284 views
Skip to first unread message

jasonwi...@u.boisestate.edu

unread,
Mar 23, 2018, 1:06:29 PM3/23/18
to camtrapR
Hi - I'm working on a project where we are studying the breeding phenology of a bird that nests in artificial boxes. In each box we have installed a game camera that takes 3 photographs per day so we can keep track of when they begin to nest. The file names for these images don't provide much information, so we would like to rename each JPG by its date and time stamp, and the camera that it came from. 

I installed camtrapR, ExifTools, and then ran through the tutorial on organizing raw camera trap images. No problem running the tutorial to rename the images and store them in a new folder. I'd like to do the same for our imagery, so I created a folder on my desktop with the raw images (ksphotosforcamtrapr), and within that folder I had a folder for each of our cameras. I created another folder to store the renamed files (raw_images_renamed). 

Here's the code I'm using (on a Mac):

library(camtrapR)

# raw image location
wd_images_raw <- file.path("/Users/Jay/Desktop/ksphotosforcamtrapr")


# destination for renamed images to be copied to
wd_images_raw_renamed <- file.path("/Users/Jay/Desktop/raw_images_renamed")       

renaming.table2 <- imageRename(inDir               = wd_images_raw,
                               outDir              = wd_images_raw_renamed,       
                               hasCameraFolders    = FALSE,
                               copyImages          = TRUE
)

renaming.table2

The output spits out an error that date/time can't be found from the images, and I'm wondering if that is a coding or file structure issue, or if it is related to the images themselves. The cameras were are using are made by spypoint, and the particular model is the link-evo 4. This particular model is connected to the cellular notework, and uploads photos to a website where we can then download them to our work computer. I just contacted the company to see if date and time are stored in a standard Exif format, but thought I'd make sure the code here was correct. Perhaps this info is stripped from the JPG file during the cell transmission process....

Thanks,

Jay

Juergen Niedballa

unread,
Mar 24, 2018, 12:16:56 PM3/24/18
to camtrapR
Hi Jay,
it is quite that the images are stripped of their metadata during upload. You can check with the function exifTagNames(). What exactly is the error message you get?
Is there a metadata tag called "DateTimeOriginal"? If in doubt, please post the output of exifTagNames(..., returnMetadata = TRUE).
Best,
Jürgen

jasonwi...@u.boisestate.edu

unread,
Mar 24, 2018, 6:24:47 PM3/24/18
to camtrapR
Hi Juergen,

Here's the error message I get after running the code above:

KS01 : 2 images
KS04 : 1 images
copying 0 images to /Users/Jay/Desktop/raw_images_renamed  ... This may take some time.
Error in `$<-.data.frame`(`*tmp*`, "CopyStatus", value = logical(0)) : 
  replacement has 0 rows, data has 3
In addition: Warning messages:
1: In imageRename(inDir = wd_images_raw, outDir = wd_images_raw_renamed,  :
  couldn't read DateTimeOriginal tag of  /Users/Jay/Desktop/ksphotosforcamtrapr/KS01/PICT0078_3242018100049AM9p1hB.JPG, /Users/Jay/Desktop/ksphotosforcamtrapr/KS01/PICT0077_3232018100056AMPhX02.JPG
2: In imageRename(inDir = wd_images_raw, outDir = wd_images_raw_renamed,  :
  couldn't read DateTimeOriginal tag of  /Users/Jay/Desktop/ksphotosforcamtrapr/KS04/PICT0079_3242018100049AMdGZDV.JPG

And the code and output for the exifTagNames command:

exifTagNames(inDir = wd_images_raw, 
             whichSubDir = 1,
             returnMetadata = TRUE)

Extracted metadata of: /Users/Jay/Desktop/ksphotosforcamtrapr/KS01/PICT0077_3232018100056AMPhX02.JPG
 [1] "[ExifTool]      ExifTool Version Number         : 10.87"                                      
 [2] "[File]          File Name                       : PICT0077_3232018100056AMPhX02.JPG"          
 [3] "[File]          Directory                       : /Users/Jay/Desktop/ksphotosforcamtrapr/KS01"
 [4] "[File]          File Size                       : 13 kB"                                      
 [5] "[File]          File Modification Date/Time     : 2018:03:24 16:19:53-06:00"                  
 [6] "[File]          File Access Date/Time           : 2018:03:24 16:23:34-06:00"                  
 [7] "[File]          File Inode Change Date/Time     : 2018:03:24 16:20:02-06:00"                  
 [8] "[File]          File Permissions                : rw-r--r--"                                  
 [9] "[File]          File Type                       : JPEG"                                       
[10] "[File]          File Type Extension             : jpg"                                        
[11] "[File]          MIME Type                       : image/jpeg"                                 
[12] "[File]          Image Width                     : 520"                                        
[13] "[File]          Image Height                    : 390"                                        
[14] "[File]          Encoding Process                : Baseline DCT, Huffman coding"               
[15] "[File]          Bits Per Sample                 : 8"                                          
[16] "[File]          Color Components                : 3"                                          
[17] "[File]          Y Cb Cr Sub Sampling            : YCbCr4:2:0 (2 2)"                           
[18] "[JFIF]          JFIF Version                    : 1.01"                                       
[19] "[JFIF]          Resolution Unit                 : None"                                       
[20] "[JFIF]          X Resolution                    : 1"                                          
[21] "[JFIF]          Y Resolution                    : 1"                                          
[22] "[Composite]     Image Size                      : 520x390"                                    
[23] "[Composite]     Megapixels                      : 0.203"  

I guess I should see DateTimeOriginal in this output chunk?

Thanks,

Jay

Juergen Niedballa

unread,
Mar 25, 2018, 4:52:19 AM3/25/18
to camtrapR
Hi Jay,
you are right, there should be DateTimeOriginal in the output. It looks like all the Exif data were removed from the images, as there is no entry starting with "[Exif] .... ".
Is any of File modification date/time or file access date/time  the correct date? Or is is part of the filename? I see 2018 in the file name. Unfortunately, there is nothing you can do with the standard camtrapR workflow in this situation.

Is there a data field in the images, showing date and time as text? There is some experimental code to extract that information using optical character recognition, but it is not complete and quite untested, and may not work, given the small size of your images.

In addition, the function does not handle this unforeseen condition well and throws an error with an unhelpful error message. I will try to fix this. 

Sorry I can't be of any more help here. It would be great if the camera manufacturer could fix this problem of stripping the images of their metadata.
Best,
Jürgen

jasonwi...@u.boisestate.edu

unread,
Mar 25, 2018, 10:04:56 AM3/25/18
to camtrapR
Hi Juergen,

The file modification date/time was correct as it showed an image that I added yesterday, and the file names from the raw images are somewhat informative as they include the date, but there is no information on the time of the image or what camera it came from. I imagine there is a way to add the folder or camera name to the images in Windows, but we'd still be lacking the time info.

The images themselves do show the date, time, and temperature in the bottom left corner (e.g., 3/24/2018 09:00), but like you said the images are pretty small. It is unfortunate that the date/time information is not stored in Exif format (or just lost during upload) on these cell cameras...we are also using some of spypoint's non-cell cameras, so I'll have to see if they behave any differently. 

Thanks for your help with this,

Jay

jasonwi...@u.boisestate.edu

unread,
Mar 26, 2018, 12:37:10 PM3/26/18
to camtrapR
Just an update: for anyone using spypoint cameras in the future, the models that transmit photos via cell networks strip the EXIF datetime info from the original photos as a means of saving on data. However, the images are also stored to an SD card, so we should be able to use camtrapR to process the images once the cards are recovered.

Juergen, I'll let you know if I have any difficulties once we download the images from the SD cards.

Thanks,

Jay

Juergen Niedballa

unread,
Mar 31, 2018, 1:50:35 AM3/31/18
to camtrapR
Hi Jason,
thank you for the update. Yes, once you get the images off the SD cards, you should be able to use camtrapR normally. 
It would be great if the manufacturer would keep Exif metadata during upload though, at the very least the DateTimeOriginal tag, so users have this crucial bit of information before recovering the cameras.
Best,
Jürgen

jasonwi...@u.boisestate.edu

unread,
May 13, 2018, 10:01:04 PM5/13/18
to camtrapR
I finally retrieved the SD cards for these cameras, and the functions in camtrapR to rename the images work great, thanks!

I had one other question though. We are downloading images from the SD cards every few months, and will drop the new images in the respective camera's folder. So my directory looks like this:

Raw_images > CA > CA01 for example, where CA01 is one of my camera station IDs in California. If I rename the raw images now, then run the code again after adding new images, will camtrapR try and rename and copy all of the images? Or just the new ones that I recently added?

Thanks,

Jay

Juergen Niedballa

unread,
May 15, 2018, 6:21:32 AM5/15/18
to camtrapR
Hi Jason, 
great to hear it works now. 

The function imageRename() will only copy images that are not yet present in the output directory containing the renames images. It will not overwrite images that exist in the output directory. In other words, you can rerun imageRename() with new raw data and the function will add on to your specified output directory, but not change the pictures that are present already. So the tags you may have assign to those images will not be affected when you rerun imageRename().

But please be aware that this is only the case if you do not further rename images after applying the function imageRename(). If you do, e.g. by appending the species name, running imageRename() again will copy those images again, and you will end up with 2 versions of the same image with different file names.

I will update the documentation to make this clear. 
Best,
Jürgen
Reply all
Reply to author
Forward
0 new messages