I understand is to use an image feature extraction to get index,
According to the index to retrieve a photo gallery, find similar,
But I get online demo is this:
Boolean passed=false;
Args=new String [] {" E: \ \ workspaces \ \ simpleapp has \ \ images "}; Deposit//images directory, to change
If (args. Length & gt; 0 {
The File f=new File (args [0]).
Indexing System. Out. Println (" images in "+ args [0]).
If (f.e xists () & amp; & F.i sDirectory passed ())=true;
}
if (! Passed) {
System. The out. Println (" No directory given as the first argument. ");
System. Out.println (" Run \ "Indexer & lt; Directory> \ "to the index files of a directory.");
System. The exit (1);
}
//get all the images in the directory
ArrayListImages=FileUtils. GetAllImages (new File (args [0]), true);
//create a CEDD document generators and indexing all images
DocumentBuilder builder=DocumentBuilderFactory. GetCEDDDocumentBuilder ();
//create a Lucene indexing tool written
IndexWriterConfig conf=new IndexWriterConfig (LuceneUtils LUCENE_VERSION,
New WhitespaceAnalyzer (LuceneUtils LUCENE_VERSION));
IndexWriter iw=new IndexWriter (FSDirectory. Open (new File (" index ")), the conf);
//cycle index picture
For (IteratorIt=images. The iterator (); It. HasNext (); ) {
String imageFilePath=it. Next ();
System. The out. Println (" Indexing "+ imageFilePath);
Try {
BufferedImage img=ImageIO. Read (new FileInputStream (imageFilePath));
The Document Document=builder. CreateDocument (img, imageFilePath);
Iw. AddDocument (document);
} the catch (Exception e) {
System. Err. Println (" Error reading image or indexing it. ");
e.printStackTrace();
}
}
//close the write index tool
Iw. Close ();
System. The out. Println (" Finished indexing. ");
Why is it written in to a group of pictures to the index, should not use index to retrieve images
CodePudding user response:
Baidu search relevant keywords,CodePudding user response:
Is the search for a long time to come here