cbr.service
Class PictureCentral

java.lang.Object
  extended byde.fhg.igd.semoa.service.AbstractService
      extended bycbr.service.PictureCentral
All Implemented Interfaces:
PicsFinder, PicsIndex, Service

public class PictureCentral
extends AbstractService
implements PicsIndex, PicsFinder

Manages a picture index and supports content based image retrieval on the index based on color coherence vectors. The index updates are atomic, in other words either an update transaction succeeds or it fails completely and the index keeps the state it had before the beginning of the transaction. Multiple concurrent reads are supported; writers are blocked until readers finished. While a writer is writing no readers are allowed.

This class is backed by a PicsStore and a ResourceStoreDelegate.

Version:
"$Id: PictureCentral.java 1913 2007-08-08 02:41:53Z jpeters $"
Author:
Volker Roth
See Also:
CCV, FeatureExtractor, PicsIndex, PicsFinder

Field Summary
static String NAME_IDX
          The name of the index file.
static String NAME_THUMBS
          The name of the directory in which thumbnails are kept.
static String NAME_TMP
          The name of the temporary index file.
private  PicsStore store_
          The PicsStore that is used to manage the index.
 
Fields inherited from class de.fhg.igd.semoa.service.AbstractService
REV_POSTFIX, REV_PREFIX
 
Constructor Summary
PictureCentral()
          Creates an instance.
PictureCentral(PicsStore store)
          Creates an instance which uses the given PicsStore in order to manage the index.
 
Method Summary
 String author()
          Returns the name of the author of the service.
 void delete(Iterator entries)
          Deletes the given picture entries from the picture index.
 PictureEntry[] find(FeatureVector v, float threshold, int max)
          Matches the given feature vector against the ones of the known Pictures and returns the picture entries of at most max pictures that have a normalised distance less than the given threshold to the query vector.
 PictureEntry[] find(Image im, float threshold, int max)
          Matches the given image against the stored images and returnes the entries of the max most similar pictures known.
 String info()
          Returns the informative string which should describe the service's essence in a sentence.
 void put(Iterator entries)
          Inserts the given picture entries into the existing index.
 String revision()
          Returns the revision number of this class as a string.
 void setIndexStore(File ifolder)
          Initializes this instance.
 
Methods inherited from class de.fhg.igd.semoa.service.AbstractService
checkDependencies, dependencies, docs, doPrivileged, doPrivileged, getACC, getEnvironment, majorVersion, minorVersion, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NAME_IDX

public static final String NAME_IDX
The name of the index file.

See Also:
Constant Field Values

NAME_TMP

public static final String NAME_TMP
The name of the temporary index file.

See Also:
Constant Field Values

NAME_THUMBS

public static final String NAME_THUMBS
The name of the directory in which thumbnails are kept.

See Also:
Constant Field Values

store_

private PicsStore store_
The PicsStore that is used to manage the index.

Constructor Detail

PictureCentral

public PictureCentral()
Creates an instance.


PictureCentral

public PictureCentral(PicsStore store)
Creates an instance which uses the given PicsStore in order to manage the index. The PicsStore must have been initialised correctly before calling this constructor.

Parameters:
store - The PicsStore to use for managing the index.
Method Detail

author

public String author()
Description copied from class: AbstractService
Returns the name of the author of the service. The format to be used should be John Doe <jdoe@zilch.net>.

Specified by:
author in interface Service
Specified by:
author in class AbstractService
Returns:
the String with the author's name.

revision

public String revision()
Description copied from class: AbstractService
Returns the revision number of this class as a string. This class provides default implementations of methods majorVersion(), minorVersion based on the assumption that this method returns a revision string as generated by rcs(1) for the template "$Revision: 1.7 $/$Date: 2007-08-08 04:41:53 +0200 (Wed, 08 Aug 2007) $".

Specified by:
revision in class AbstractService

info

public String info()
Description copied from class: AbstractService
Returns the informative string which should describe the service's essence in a sentence.

Specified by:
info in interface Service
Specified by:
info in class AbstractService
Returns:
the String with the service's short description.

setIndexStore

public void setIndexStore(File ifolder)
                   throws IOException
Initializes this instance.

Parameters:
ifolder - The folder in which the index is kept.
Throws:
IOException - if an I/O error occurs during initialisation.

find

public PictureEntry[] find(Image im,
                           float threshold,
                           int max)
                    throws IOException
Matches the given image against the stored images and returnes the entries of the max most similar pictures known. All returned picture entries represent pictures that have a distance from the query picture that is less than the given threshold. The threshold is normalised in the range [0.0,1.0] where 0 denotes identity (of feature vectors) and 1 denotes infinite distance.

Specified by:
find in interface PicsFinder
Parameters:
im - The query image.
threshold - The maximum distance retrieved pictures are allowed to have from the query image.
max - The maximum number of hits to return.
Throws:
NullPointerException - if the given picture is null.
IOException

find

public PictureEntry[] find(FeatureVector v,
                           float threshold,
                           int max)
                    throws IOException
Matches the given feature vector against the ones of the known Pictures and returns the picture entries of at most max pictures that have a normalised distance less than the given threshold to the query vector. If the feature vector is not of a supported type then an exception is thrown.

Specified by:
find in interface PicsFinder
Parameters:
v - The feature vector to match known picture entries against.
threshold - The maximum distance a picture in the result set is allowed to have from the query vector.
Throws:
UnsupportedAlgorithmException - if the given feature vector cannot be mapped to the supported ones.
IOException

put

public void put(Iterator entries)
         throws IOException
Inserts the given picture entries into the existing index. The distance value is ignored but all other fields should be provided.

Specified by:
put in interface PicsIndex
Parameters:
entries - The iterator that iterates over the picture entries that shall be inserted into the index.
Throws:
IOException

delete

public void delete(Iterator entries)
            throws IOException
Deletes the given picture entries from the picture index. Only the name and URL fields of the pictures to be removed need to be present in the entries.

Specified by:
delete in interface PicsIndex
Parameters:
entries - The iterator that iterates over the picture entries that shall be deleted from the index.
Throws:
IOException


Copyright © Fraunhofer Gesellschaft. All Rights Reserved.