Lire - Lucene Image REtrieval 0.5.4 descriptionLire, the Lucene Image REtrieval library is a simple way to create a Lucene index of image features for content based image retrieval (CBIR).
The used features are taken from the MPEG-7 Standard: ScalableColor, ColorLayout and EdgeHistogram. Furthermore methods for searching the index are provided.
The LIRE library is part of the Caliph & Emir project and aims to provide the CBIR features of Caliph & Emir to other Java projects in an easy and light weight way.
Creating an Index
Use DocumentBuilderFactory to create a DocumentBuilder, which will create Lucene Documents from images. Add this documents to an index like this:
System.out.println(">> Indexing " + images.size() + " files.");
DocumentBuilder builder = DocumentBuilderFactory.getExtensiveDocumentBuilder();
IndexWriter iw = new IndexWriter(indexPath, new SimpleAnalyzer(), true);
int count = 0;
long time = System.currentTimeMillis();
for (String identifier : images) {
Document doc = builder.createDocument(new FileInputStream(identifier), identifier);
iw.addDocument(doc);
count ++;
if (count % 25 == 0) System.out.println(count + " files indexed.");
}
long timeTaken = (System.currentTimeMillis() - time);
float sec = ((float) timeTaken) / 1000f;
System.out.println(sec + " seconds taken, " + (timeTaken / count) + " ms per image.");
iw.optimize();
iw.close();
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());
}
Enhancements:
- An issue where the scalable color descriptor (color histogram) was not compliant to the MPEG-7 standard was fixed.
- The color only search was changed to use the color layout descriptor and a bug in the edge histogram descriptor was hunted down.
- The LireDemo GUI application has also been updated: A new function for creating image mosaics has been introduced and the indexing of digital photos is now faster than ever as only the EXIF thumbnails - if available - are used instead of the whole image.
Download now






最新评论
今天在电台上听到了,女主持人
学校有专门的tex模板, 本
喜欢,分享了!
新年快乐!
一般发国外期刊采用得到tex
我在的学校有一个博士维护的t
画图工具用matlab或者e
人工编号后期修改好麻烦;自动
真厉害。觉得这种Graphi
什么公司啊,丕子? 好久没