Assume that in a MediaCollection you have images of boats
and cars, and that each image has an imageType
metadata tag
set to either car
or boat
. In addition, each
image also has a metadata tag of primaryColor
set to red
,
green
, or blue
. Thus, given a particular red
car, you can conduct a metadata search followed by a visual search as
follows:
// make
a new MediaCollection object and populate it from a collection on disk
MediaCollection
mc = Eve.newMediaCollection();
mc.open( directoryPath );
// find
all MediaObjects tagged as cars in the collection
SearchResults carResults[] = mc.metadataFind( "imageType",
"car" );
// get
a list of all objects tagged as red in the collection
SearchResults redResults[] = mc.metadataFind( "color",
"red" );
// combine
the two lists using a Boolean AND operation
SearchResults
worker = Eve.newSearchResults();
SearchResults target[] = worker.and( carResults, redResults
);
// load
the source image (the red car)
MediaObject
source = Eve.newMediaObject();
Source.loadFrom( myMediaObjectPath );
// perform
the visual search
SearchParameters
parameters = Eve.newSearchParameters();
Parameters.setSearch(
Eve.REGION, true, 1.0 );
SearchResults
finalResults[] = mc.search( source, parameters, target[] );