Feature
Class FeatureInterface

java.lang.Object
  extended by Feature.FeatureInterface

public class FeatureInterface
extends java.lang.Object

Implements the interface for managing features.


Constructor Summary
FeatureInterface(FeatureManager.FeatureManager fm, java.lang.String tempPath)
          Query-only constructor (no RawDataManager is used).
FeatureInterface(RawDataManager rdm, FeatureManager.FeatureManager fm, java.lang.String tempPath)
          Basic constructor.
 
Method Summary
 Document.Image extractImage(javax.media.jai.PlanarImage image, Document.ImageID id)
          Given an image and its ID extracts its Windsurf features.
 Document.Image extractImage(java.lang.String url, Document.ImageID id)
          Given an image URL and its ID extracts its Windsurf features.
 boolean findID(Document.ImageID id)
          Checks whether an image with a given ID is contained in the feature DB.
 double getDistance(Document.ImageID id1, Document.ImageID id2)
          Computes the distance between two images, given their IDs.
 FeatureManager.FeatureManager getFeatureManager()
          Returns the FeatureManager in use.
 Document.ImageID getID(java.lang.String url)
          Checks whether an image with a given URL is contained in the feature DB.
 java.lang.String getImageURL(Document.ImageID id)
          Retrieves the URL of an image with a given ID.
 RawDataManager getRawDataManager()
          Returns the RawDataManager in use.
 java.util.Vector<QueryProcessor.SF.ScoredResultImage> kNNQuery(Document.ImageID id, int k, QueryProcessor.SF.ScoringFunction.ScoringFunction sf)
          Performs a k-NN query for a given image using a sequential scan.
 Document.Image retrieveImage(Document.ImageID id)
          Given an image ID retrieves its features from the DB.
 Document.ImageID storeID(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.
 Document.ImageID storeID(java.lang.String url, Document.ImageID id)
          Given an image URL retrieves its ID (if the image is in the DB) or stores it (and its features) in the DB.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FeatureInterface

public FeatureInterface(RawDataManager rdm,
                        FeatureManager.FeatureManager fm,
                        java.lang.String tempPath)
Basic constructor.

Parameters:
rdm - The RawDataManager to be used.
fm - The FeatureManager to be used.
tempPath - Directory used for storing temporary index files.

FeatureInterface

public FeatureInterface(FeatureManager.FeatureManager fm,
                        java.lang.String tempPath)
Query-only constructor (no RawDataManager is used).

Parameters:
fm - The FeatureManager to be used.
tempPath - Directory used for storing temporary index files.
Method Detail

getFeatureManager

public FeatureManager.FeatureManager getFeatureManager()
Returns the FeatureManager in use.

Returns:
The FeatureManager in use.

getRawDataManager

public RawDataManager getRawDataManager()
Returns the RawDataManager in use.

Returns:
The RawDataManager in use.

storeID

public Document.ImageID storeID(java.lang.String url,
                                Document.ImageID id)
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.
id - ID of the image to be inserted (null if this is given by the DB).
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.

storeID

public Document.ImageID storeID(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.

extractImage

public Document.Image extractImage(java.lang.String url,
                                   Document.ImageID id)
Given an image URL and its ID extracts its Windsurf features.

Parameters:
url - URL of the image to be processed.
id - ID of the image to be inserted.
Returns:
The extracted image.

extractImage

public Document.Image extractImage(javax.media.jai.PlanarImage image,
                                   Document.ImageID id)
Given an image and its ID extracts its Windsurf features.

Parameters:
image - JAI image to be processed.
id - ID of the image to be inserted.
Returns:
The extracted image (null if there is an error during feature extraction).

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.

findID

public boolean findID(Document.ImageID id)
Checks whether an image with a given ID is contained in the feature DB.

Parameters:
id - ID of the image to be searched.
Returns:
true if an image with the given ID exists in the features DB, false otherwise.

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.

getID

public Document.ImageID getID(java.lang.String url)
Checks whether an image with a given URL is contained in the feature DB.

Parameters:
url - URL of the image to be searched.
Returns:
The image ID if the image is contained in the DB, an invalid ID otherwise.

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.

kNNQuery

public java.util.Vector<QueryProcessor.SF.ScoredResultImage> kNNQuery(Document.ImageID id,
                                                                      int k,
                                                                      QueryProcessor.SF.ScoringFunction.ScoringFunction sf)
Performs a k-NN query for a given image using a sequential scan.

Parameters:
id - ID of the query image.
k - Number of requested results.
sf - Scoring function to be used.
Returns:
A vector of ScoredResultImages or null if the query image does not exist.