Hello,
Based of the
simpleapplication which is provided on GitHub, I wanted to use the basic global features.
However, I noticed that indexing with an AutoColorCorrelogram Extractor would occasionally throw:
Exception in thread "Consumer-01" java.lang.ArrayIndexOutOfBoundsException: 3
at java.awt.image.ComponentSampleModel.getPixel(ComponentSampleModel.java:750)
at java.awt.image.Raster.getPixel(Raster.java:1519)
at net.semanticmetadata.lire.imageanalysis.features.global.AutoColorCorrelogram.hsvImage(AutoColorCorrelogram.java:230)
at net.semanticmetadata.lire.imageanalysis.features.global.AutoColorCorrelogram.extract(AutoColorCorrelogram.java:242)
at net.semanticmetadata.lire.builders.GlobalDocumentBuilder.extractGlobalFeature(GlobalDocumentBuilder.java:192)
at net.semanticmetadata.lire.builders.GlobalDocumentBuilder.getGlobalDescriptorFields(GlobalDocumentBuilder.java:210)
at net.semanticmetadata.lire.builders.GlobalDocumentBuilder.createDescriptorFields(GlobalDocumentBuilder.java:258)
at net.semanticmetadata.lire.indexers.parallel.ParallelIndexer$Consumer.run(ParallelIndexer.java:1186)
at java.lang.Thread.run(Thread.java:745)
This only happens for PNG files, though. The reason for this seems to be the additional 4th band/channel a PNG (Red/Blue/Green/Alpha) has, where other formats such as JPGs have only 3 (Red/Blue/Green). It looks like AutoColorCorrelogram.hsvImage() does not consider this possibility, always declaring:
// converting to HSV:
int[] hsv = new int[3];
convertRgbToHsv(r.getPixel(x, y, pixel), hsv);
My question: How can I still use AutoColorCorrelogram for PNGs?
Thanks for considering
Myrtha
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
my code for indexing:
public class Indexer {
public static void main(String[] args) throws IOException {
ParallelIndexer indexer = new ParallelIndexer(4, "index", args[0]);
//indexer.addExtractor(CEDD.class);
//indexer.addExtractor(FCTH.class);
indexer.addExtractor(AutoColorCorrelogram.class); //not working with png format (more than 3 bands/channels)
indexer.run();
System.out.println("Finished indexing.");
}
}