It sounds like you're after a method of tagging pictures and retrieving / searching these tags.
This is normally done with a database or some data structures that are not available in matlab (e.g. multi-index container). In matlab, what I would do is use a map. If you wanted to make it easy to find images associated with a certain tag, the tags would be the keys, the images associated with the tag, the values, would be a cell array:
keys = {'fruits', 'animals', 'apples', 'birds'};
values = {{'apple.jpg', 'orange.jpg'}, {'condor.jpg', 'elephant.jpg', 'koala.jpg', 'whale.jpg', 'penguins.jpg'}, {'apple.jpg'}, {'condor.jpg', 'penguins.jpg}};
tagimages = containers.Map(keys, values);
birdimages = tagimages('birds')
tagimages('Four legged') = {'elephant.jpg', 'koala.jpg'}
The issue with the above is that you duplicate the image strings a lot in the map (that can be worked around by storing indices to the cell array of filenames instead) and finding the tags associated with one image is not easy. Matlab unfortunately does not have a great deal of containers. To get something better, you'd have to use the database toolbox.
If what you want to do predominantly is find tags associated with an image, then you make the images the keys, and the tags the values:
keys = {'apple.jpg', 'orange.jpg', 'condor.jpg', 'elephant.jpg', 'koala.jpg', 'whale.jpg', 'penguins.jpg'};
values = {'fruit', 'apple'}, {'fruit'}, {'animal', 'bird'}, {'animal'}, {'animal'}, {'animal'}, {'animal', 'bird'}};
imagetags = containers.Map(keys, values);
appletags = imagetags('apple.jpg')
Best Answer