How the eVe Demo Works


A single servlet, VisualSearchServlet, uses three classes to dynamically build new HTML document pages based on search results: TextSearch, VisualSearch, and SearchParameter. Both TextSearch and VisualSearch are derived from an abstract base class, SearchEngine.

To process a visual search request, the VisualSearchServlet:

  1. creates an instance of MediaCollection and uses its open() method to load all images stored in the corresponding image database. The value supplied to the path argument in the open() method determines what images are loaded.  

  2. uses MediaCollection.getKeys to retrieve a list of the keys to the MediaObjects in the MediaCollection category.

  3. uses MediaCollection.getMediaObject to get a list of all the MediaObjects in the opened image database. Each retrieved MediaObject instance can be used as input to to find MediaObjects representing visually similar images.

Sample Code for Visual Search

String imagepath =   



MediaCollection mediaCollection = (MediaCollection)   

Eve.newMediaCollection(); imagepath );

long[] keys = mediaCollection.getKeys();

MediaObject[] mObjects = mediaCollection.getMediaObject( keys );

Int colorPercent = 100,shapePercent=0; texturePercent=0;objectPercent=0;

for ( int i = 0; i < mObjects.length(); ++i )


  SearchParameters sp = (SearchParameters) Eve.newSearchParameters();

  sp.setSearch(Eve.COLOR, true, (float)(colorPercent/100));

  sp.setSearch(Eve.SHAPE, true, (float)(shapePercent/100));       

  sp.setSearch(Eve.TEXTURE, true, (float)(texturePercent/100));

  sp.setSearch(Eve.REGION, true, (float)(objectPercent/100));

  MediaObject mo = mediaCollection.getMediaObject( mObject[i].getKey() );

  SearchResults[] results =, sp);