Saving Images and Metadata with PyTables

I use PyTables to store some images as Array and CArray . For each of these images, I also want to save some basic metadata (e.g. EXIF) .

I can imagine several approaches for storing both of these data formats: from storing metadata with the AttributeSet class for each Array / CArray to using Table for all metadata.

My question is: what is the best approach if I want to be able to efficiently query and retrieve images from the final hdf5 file for processing? For example, I would like to be able to extract snapshots taken at a specific time (12-3pm), and process this subset of data, and then insert copies into the database or replace existing arrays.

Thank you for help.

Best

Nick

[Edit (clarification): I am currently processing these images as NumPy arrays, and I hope to maintain this functionality]

+4
source share
1 answer

My understanding of PyTables documentation suggests the following.

Create a table. Create one column for each metadata you are interested in. If your images are the same size, and this is known at the time of creating the table, create a column of arrays and save them there. If the image sizes differ, create a column with a unique identifier for each image (the functional equivalent of the file name), then create a new group and create one array / frame per image that is identical to the one listed in the above table.

Another option would be to use lightweight RDMS (sqlite even) to store the table, which would make it easy to query / sort / etc, but save the actual image arrays in the h5 file.

+1
source

Source: https://habr.com/ru/post/1388680/


All Articles