Feature
Class WrapperFeature

java.lang.Object
  extended by Feature.WrapperFeature
Direct Known Subclasses:
WrapperFeatureWindsurfMySQL, WrapperFeatureWindsurfTxt

public abstract class WrapperFeature
extends java.lang.Object

Implements an utility class for managing image features.


Field Summary
protected  FeatureInterface feat
          The Feature Interface
protected  long timeImgRetrieve
          Time spent in retrieving images from the DB
 
Constructor Summary
WrapperFeature()
           
 
Method Summary
 Document.ImageID extractImage(java.lang.String url)
          Given an image URL retrieves its ID (if the image is in the DB) or stores it (and its features) in the DB.
 double getDistance(Document.ImageID id1, Document.ImageID id2)
          Computes the distance between two images, given their IDs.
 FeatureManager.FeatureManager getFM()
          Returns the Feature Manager in use.
 java.lang.String getImageURL(Document.ImageID id)
          Retrieves the URL of an image with a given ID.
 RawDataManager getRDM()
          Returns the Raw Data Manager in use.
protected  java.util.Vector<Document.ImageID> getResultIDs(java.util.Vector<QueryProcessor.SF.ScoredResultImage> v)
          Retrieves the IDs of images in the result of a query.
 long getTime()
          Returns the time needed to retrieve images from the DB.
 void resetTime()
          Resets the time needed to retrieve images from the DB.
 Document.Image retrieveImage(Document.ImageID id)
          Given an image ID retrieves its features from the DB.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

feat

protected FeatureInterface feat
The Feature Interface


timeImgRetrieve

protected long timeImgRetrieve
Time spent in retrieving images from the DB

Constructor Detail

WrapperFeature

public WrapperFeature()
Method Detail

getTime

public long getTime()
Returns the time needed to retrieve images from the DB.

Returns:
The time needed to retrieve images from the DB (in milliseconds).

resetTime

public void resetTime()
Resets the time needed to retrieve images from the DB.


retrieveImage

public Document.Image retrieveImage(Document.ImageID id)
Given an image ID retrieves its features from the DB.

Parameters:
id - ID of the image to be searched.
Returns:
The requested image or null if such image is not found.

extractImage

public Document.ImageID extractImage(java.lang.String url)
Given an image URL retrieves its ID (if the image is in the DB) or stores it (and its features) in the DB.

Parameters:
url - URL of the image to be searched/stored.
Returns:
The image ID if the image is already in the DB, 0 if the feature extraction was successful, -2 if the URL is invalid, -3 if the image does not exist or is unreadable, -4 if the given ID is already assigned to another image, -5 if there is an error during feature extraction, -7 if there is an error in reading the image stream, -9 if there is an error in the RawDataManager, -11 if the image has an unrecognized format.

getDistance

public double getDistance(Document.ImageID id1,
                          Document.ImageID id2)
Computes the distance between two images, given their IDs.

Parameters:
id1 - ID of the first image.
id2 - ID of the second image.
Returns:
The value of the distance between the two images, if both images exist in the feature DB, the maximum distance value, otherwise.

getResultIDs

protected java.util.Vector<Document.ImageID> getResultIDs(java.util.Vector<QueryProcessor.SF.ScoredResultImage> v)
Retrieves the IDs of images in the result of a query.

Parameters:
v - Vector of query result images.
Returns:
Vector containing IDs of result images.

getImageURL

public java.lang.String getImageURL(Document.ImageID id)
Retrieves the URL of an image with a given ID.

Parameters:
id - ID of the image to be searched.
Returns:
The URL of the image with the given ID, if such image exists, null otherwise.

getFM

public FeatureManager.FeatureManager getFM()
Returns the Feature Manager in use.

Returns:
The Feature Manager in use.

getRDM

public RawDataManager getRDM()
Returns the Raw Data Manager in use.

Returns:
The Raw Data Manager in use.