retrieval
Class SimilaritySearch

java.lang.Object
  extended by retrieval.SimilaritySearch

public class SimilaritySearch
extends java.lang.Object

Execute a similarity search in the database.

The scenario is as follows:

There are many skeleton object data in the database (stored in src/database/database.db), where the path to the shape image and the path to the skeleton image are stored (so that proper SkeletonObject instances can be created. The user might want to search for images in the database that are similar to a given image.

SimilaritySearch takes as query input the "ready-to-use" query skeleton object to be searched. It gets all database entries, parses the skeletons defined by those entries and executes PSGM for each of them, with reference to the specified query image.

All results are stored in a priority queue, in order according to the total costs to match the query and the target skeleton. The first entries in the queue are the most similar.

For example usages, see SearchGUI or SimilaritySearchTest


Field Summary
private static org.apache.log4j.Logger logger
          logger instance
 
Constructor Summary
SimilaritySearch()
           
 
Method Summary
static java.util.PriorityQueue<SimilaritySearchResult> getSimilarities(java.lang.String database, SkeletonObject so, SkeletonObject so_flipped, java.lang.String skeletonfilename, java.lang.String objectfilename, int nosp, double alpha)
          Given a skeleton object, this function searches the database in src/database/database.db, performes PSGM to the input skeleton and all skeletons in the database and saves the results in the order of their similarity in a priority queue.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private static org.apache.log4j.Logger logger
logger instance

Constructor Detail

SimilaritySearch

public SimilaritySearch()
Method Detail

getSimilarities

public static java.util.PriorityQueue<SimilaritySearchResult> getSimilarities(java.lang.String database,
                                                                              SkeletonObject so,
                                                                              SkeletonObject so_flipped,
                                                                              java.lang.String skeletonfilename,
                                                                              java.lang.String objectfilename,
                                                                              int nosp,
                                                                              double alpha)
                                                                       throws java.lang.ClassNotFoundException,
                                                                              java.sql.SQLException,
                                                                              java.io.IOException,
                                                                              InvalidSkeletonException,
                                                                              WrongUsageOfAlgorithmException,
                                                                              InvalidWeightFunctionGivenException,
                                                                              InvalidConfigParameterException
Given a skeleton object, this function searches the database in src/database/database.db, performes PSGM to the input skeleton and all skeletons in the database and saves the results in the order of their similarity in a priority queue.

Parameters:
so - the query skeleton object to be searched
nosp - the number of sample points
alpha - the weight factor for path lengths. The higher alpha is, the more important is that the path lengths are proportional.
skeletonfilename - - the path to the skeleton image of the query skeleton
objectfilename - - the path to the shape image of the query skeleton
Returns:
all entries of the database, ordered by similarity to the input skeleton
Throws:
java.lang.ClassNotFoundException - if the JDBC driver was not found
java.sql.SQLException - if an error occured during access to the database
java.io.IOException - if one of the files was not found
InvalidSkeletonException - if a skeleton seems to be broken
WrongUsageOfAlgorithmException - if errors occured during the execution of the algorithm
InvalidWeightFunctionGivenException - if no valid weight function could be extracted for the assignment algorithm
InvalidConfigParameterException