eVision Logo
Visual Search Technology Unleashing the power of visual ebusiness
News Technology & Products Business Solutions Developers About eVision

Also See:

eVe Demo

API Reference pdf

API Reference HTML


eVe Getting Started FAQ

eVe Technical FAQ

eVision Newsgroup

Discussion Boards

 home > developers > documentation > html demo implementation

How to create the
HTML Online Demo

About the Online Demo implementation of eVe

The Eve toolkit web demo is Java servlet-based web application where servlets are used to handle requests from the browser and dynamically construct the HTML pages delivered to the client web browser (see Figure 1 below).

The web demo consists of a single screen that allows the user to display sample images by category (e.g "Sunset", "Clothes", etc). Each of the sample images can be ‘clicked’ on, and similar images will be searched for and displayed on the same screen. The degree of similarity to the sample image to use in the search of the image database can be adjusted by the user.

eVe Web demo application overview
Figure 1. Demo application overview

Java servlets on the webserver use the Eve SDK toolkit to perform the visual searches. The three main classes in the Eve toolkit used are:

  • MediaCollection
    Represents the image database.

  • MediaObject
    Represents an image in the MediaCollection.

  • SearchResults
    A list of MediaObjects that satisfy the visual search criteria.

This next section shows the methods used in each of these classes.

Eve Interfaces

1. MediaCollection

  • open( String categoryPath ) – open the MediaCollection for a category specified by the path to where all images reside on disk.
  • getKeys - returns the keys for all MediaObjects in the MediaCollection.
  • getMediaObject( long key ) - returns the media object based a specific key.
  • search( MediaObject obj, SearchParameter parms ) - searches an opened MediaCollection for MediaObjects similar to ‘obj’.

2. MediaObject

  • getProperty( "originalFilename") – returns the file name for the image represented by the MediaObject.

3. SearchResults

  • getkey() – returns the key for a SearchResults object.
  • getSimilarity() – returns the similarity for a SearchResults object based on the search criteria.

4. SearchParameters

  • setSearch(int parm, Boolean ind, float percent) – set search criteria. ‘parm’ could dicate one of several factors such as color, shape, texture or object. The search parameter (color, shape, texture, or object) used in the search of the image database is fixed in the demo. However, the SDK allows adjustment of search parameters by the user.

Servlet Implementation

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, VisualSearchServlet first creates an instance of MediaCollection and uses its open method to load all images stored in the image database category pointed to by the path argument supplied to open. Next, MediaCollection.getKeys is used to retrieve a list of the keys to the MediaObjects in the MediaCollection category. Finally VisualSearchServlet uses MediaCollection.getMediaObject to get a list of all the MediaObjects in the opened category. Each retrieved MediaObject instance can be used as input to MediaCollection.search to find MediaObjects representing similar images.

The following is sample code to perform a visual search:

String imagepath =   
MediaCollection mediaCollection = (MediaCollection)   
mediaCollection.open( 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 = mediaCollection.search(mo, sp);