net.semanticmetadata.lire
Interface ImageSearcher

All Known Implementing Classes:
AbstractImageSearcher, CorrelogramImageSearcher, SimpleImageSearcher

public interface ImageSearcher

Searching in an Index

Use the ImageSearcherFactory for creating an ImageSearcher, which will retrieve the images for you from the index.

 IndexReader reader = IndexReader.open(indexPath);
 ImageSearcher searcher = ImageSearcherFactory.createDefaultSearcher();
 FileInputStream imageStream = new FileInputStream("image.jpg");
 BufferedImage bimg = ImageIO.read(imageStream);
 // searching for an image:
 ImageSearchHits hits = null;
 hits = searcher.search(bimg, reader);
 for (int i = 0; i < 5; i++) {
 System.out.println(hits.score(i) + ": " + hits.doc(i).getField(DocumentBuilder.FIELD_NAME_IDENTIFIER).stringValue());
 }
 

// searching for a document: Document document = hits.doc(0); hits = searcher.search(document, reader); for (int i = 0; i < 5; i++) { System.out.println(hits.score(i) + ": " + hits.doc(i).getField(DocumentBuilder.FIELD_NAME_IDENTIFIER).stringValue()); }

This file is part of the Caliph and Emir project: http://www.SemanticMetadata.net
Date: 01.02.2006
Time: 00:09:42

Author:
Mathias Lux, mathias@juggle.at

Method Summary
 ImageDuplicates findDuplicates(org.apache.lucene.index.IndexReader reader)
          Identifies duplicates in the database.
 ImageSearchHits relevanceFeedback(ImageSearchHits originalSearch, java.util.Set<org.apache.lucene.document.Document> positives, java.util.Set<org.apache.lucene.document.Document> negatives)
          Modifies the given search by the provided positive and negative examples.
 ImageSearchHits search(java.awt.image.BufferedImage image, org.apache.lucene.index.IndexReader reader)
          Searches for images similar to the given image.
 ImageSearchHits search(org.apache.lucene.document.Document doc, org.apache.lucene.index.IndexReader reader)
          Searches for images similar to the given image, defined by the Document from the index.
 ImageSearchHits search(java.io.InputStream image, org.apache.lucene.index.IndexReader reader)
          Searches for images similar to the given image.
 

Method Detail

search

ImageSearchHits search(java.awt.image.BufferedImage image,
                       org.apache.lucene.index.IndexReader reader)
                       throws java.io.IOException
Searches for images similar to the given image.

Parameters:
image - the example image to search for.
reader - the IndexReader which is used to dsearch through the images.
Returns:
a sorted list of hits.
Throws:
java.io.IOException - in case exceptions in the reader occurs

search

ImageSearchHits search(org.apache.lucene.document.Document doc,
                       org.apache.lucene.index.IndexReader reader)
                       throws java.io.IOException
Searches for images similar to the given image, defined by the Document from the index.

Parameters:
doc - the example image to search for.
reader - the IndexReader which is used to dsearch through the images.
Returns:
a sorted list of hits.
Throws:
java.io.IOException - in case exceptions in the reader occurs

search

ImageSearchHits search(java.io.InputStream image,
                       org.apache.lucene.index.IndexReader reader)
                       throws java.io.IOException
Searches for images similar to the given image.

Parameters:
image - the example image to search for.
reader - the IndexReader which is used to dsearch through the images.
Returns:
a sorted list of hits.
Throws:
java.io.IOException - in case the image could not be read from stream.

findDuplicates

ImageDuplicates findDuplicates(org.apache.lucene.index.IndexReader reader)
                               throws java.io.IOException
Identifies duplicates in the database.

Parameters:
reader - the IndexReader which is used to dsearch through the images.
Returns:
a sorted list of hits.
Throws:
java.io.IOException - in case the image could not be read from stream.

relevanceFeedback

ImageSearchHits relevanceFeedback(ImageSearchHits originalSearch,
                                  java.util.Set<org.apache.lucene.document.Document> positives,
                                  java.util.Set<org.apache.lucene.document.Document> negatives)
Modifies the given search by the provided positive and negative examples. This process follows the idea of relevance feedback.

Parameters:
originalSearch -
positives -
negatives -
Returns: