A1:笑得海潮 B3:冒泡的崔 D2:Cornell University,Computer Vision Group H2:冰河的博客 G3:丕子博客 K1:MLA CHINA K4:斯坦福视觉实验室 L4:MIT 机器学习实验室
现在的位置: 首页科研>正文
cat_ico37 category
Lire - Lucene Image REtrieval
发表于833 天前 科研 暂无评论 ⁄ 被围观 671 次+

Download now

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

给我留言


/ 快捷键:Ctrl+Enter

无觅相关文章插件,快速提升流量

不想听你唠叨×