Using camtrapR with digiKam database file instead of image files

61 views
Skip to first unread message

Cara Appel

unread,
Jul 20, 2020, 7:56:45 PM7/20/20
to camtrapR
Hello, 

I am wondering if it's possible to import metadata tags and utilize the different functions of camtrapR using just a digiKam database file instead of the original images. For context, photos will be tagged on several different hard drives, and I'm wondering if I can just use the database files (digikam4.db) where the tags are stored instead of physically copying all of the photos to my computer. I hope that makes sense!

I have previously used the RSQLite package to extract info from the database file but would love to be able to combine this with camptrapR functions. Has anybody done this?

Thank you!

Cara

Juergen Niedballa

unread,
Jul 21, 2020, 4:10:42 AM7/21/20
to camtrapR
Hi Cara, 
in general, yes, it is possible to access the digiKam database directly, and there's some functions in camtrapR that do that already with the help of the RSQLite package (for extracting metadata from videos). But unfortunately it wasn't designed with your purpose in mind, and those functions are internal functions and not exported via the package namespace. That said, they can still be used with the prefix "camtrapR:::". 

See the function library here on github. The relevant functions for accessing and processing data directly from a digiKam database can be found there and include:
  • accessDigiKamDatabase
  • digiKamVideoHierarchicalSubject
  • processVideoArgument (this function calls accessDigiKamDatabase)
  • addVideoDateTimeOriginal
  • addVideoHierachicalSubject

You can check in the code of recordTable how they all work together.
Since these functions were designed for extracting metadata from videos, I cannot guarantee they will work straight away for images. You can try but may need to adapt them a little. 

A whole different solution for images stored in different locations would be to run the function recordTable() separately on each machine and then combine the resulting record tables (rbind). This should work as long as the different hard disks contain images from different camera trap stations. If they contain images from the same station there might be the possibility of duplicates or non-independent images showing up.

Best regards,
Jürgen

Cara Appel

unread,
Jul 21, 2020, 12:33:03 PM7/21/20
to camtrapR
Jürgen,

Thanks for the reply. That's very helpful! I will play around with the internal functions a bit. The hard drives all have photos from different camera trap stations, and I am making sure they are tagged using the same tag hierarchy, so your second suggestion may be simpler. 

Much appreciated!

Best regards,

Cara

Juergen Niedballa

unread,
Jul 21, 2020, 12:41:49 PM7/21/20
to camtrapR
Hi Cara, 
the topic has also been brought up in this other thread today, and there seems to be a problem in one of the internal function. It is almost solved (I hope), I'm just waiting for the confirmation from the person who asked that the new output is correct. So if you can wait a little, I'm hopeful that I can have an updated version in github later this week.
In your case the second option may indeed be simpler. If there should be differences in the metadata columns (which will make rbind complain when combining data.frames) you can use rbindlist from the data.table package instead.
Best regards,
Jürgen
Reply all
Reply to author
Forward
0 new messages