コード例 #1
0
ファイル: FileUtils.java プロジェクト: locked-fg/LIRE
 /**
  * Just opens an image with Java and reports if false if there are problems. This method can be
  * used to check for JPG etc. that are not supported by the employed Java version.
  *
  * @param f the file to check.
  * @return true if no exceptions are thrown bey the decoder.
  */
 public static boolean isImageFileCompatible(File f) {
   boolean result = true;
   try {
     BufferedImage img = ImageIO.read(f);
     ColorLayout cl = new ColorLayout();
     cl.extract(img);
   } catch (Exception e) {
     result = false;
   }
   return result;
 }
コード例 #2
0
  public ImageSearchHits search(BufferedImage image, IndexReader reader) throws IOException {
    ScalableColor sc = null;
    ColorLayout cl = null;
    EdgeHistogram eh = null;
    if (colorHistogramWeight > 0f) {
      sc = new ScalableColor();
      sc.extract(image);
    }
    if (colorDistributionWeight > 0f) {
      cl = new ColorLayout();
      cl.extract(image);
    }
    if (textureWeight > 0f) {
      eh = new EdgeHistogram();
      eh.extract(image);
    }

    float maxDistance = findSimilar(reader, cl, sc, eh);
    return new SimpleImageSearchHits(this.docs, maxDistance);
  }