|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.semanticmetadata.lire.ImageSearcherFactory
public class ImageSearcherFactory
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
| Field Summary | |
|---|---|
static int |
NUM_MAX_HITS
Default number of maximum hits. |
| Constructor Summary | |
|---|---|
ImageSearcherFactory()
|
|
| Method Summary | |
|---|---|
static ImageSearcher |
createColorOnlySearcher(int maximumHits)
Returns a new ImageSearcher with the given number of maximum hits which only takes the overall color into account. texture and color distribution are ignored. |
static ImageSearcher |
createDefaultCorrelogramImageSearcher(int maximumHits)
Create and return an ImageSearcher for the AutoColorCorrelogram
image feature. |
static ImageSearcher |
createDefaultSearcher()
Returns a new default ImageSearcher with a predefined number of maximum hits defined in the NUM_MAX_HITS |
static ImageSearcher |
createFastCorrelogramImageSearcher(int maximumHits)
Create and return an ImageSearcher for the AutoColorCorrelogram
image feature. |
static ImageSearcher |
createSimpleSearcher(int maximumHits)
Creates a new simple image searcher with the desired number of maximum hits. |
static ImageSearcher |
createWeightedSearcher(int maximumHits,
float colorHistogramWeight,
float colorDistributionWeight,
float textureWeight)
Returns a new ImageSearcher with the given number of maximum hits and the specified weights on the different matching aspects. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static int NUM_MAX_HITS
| Constructor Detail |
|---|
public ImageSearcherFactory()
| Method Detail |
|---|
public static ImageSearcher createSimpleSearcher(int maximumHits)
maximumHits -
public static ImageSearcher createDefaultSearcher()
NUM_MAX_HITS
public static ImageSearcher createColorOnlySearcher(int maximumHits)
maximumHits - defining how many hits are returned in max (e.g. 100 would be ok)
ImageSearcher
public static ImageSearcher createWeightedSearcher(int maximumHits,
float colorHistogramWeight,
float colorDistributionWeight,
float textureWeight)
extensive DocumentBuilder
is used.
maximumHits - defining how many hits are returned in maxcolorHistogramWeight - a weight in [0,1] defining the importance of overall color in the imagescolorDistributionWeight - a weight in [0,1] defining the importance of color distribution (which color where) in the imagestextureWeight - defining the importance of texture (which edges where) in the images
DocumentBuilderFactorypublic static ImageSearcher createDefaultCorrelogramImageSearcher(int maximumHits)
AutoColorCorrelogram
image feature. Be sure to use the same options for the ImageSearcher as you used for the DocumentBuilder.
maximumHits - number of hits returned.
public static ImageSearcher createFastCorrelogramImageSearcher(int maximumHits)
AutoColorCorrelogram
image feature. Be sure to use the same options for the ImageSearcher as you used for the DocumentBuilder.
maximumHits - number of hits returned.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||