Examples of GaborDescriptorCreator


Examples of JDescriptors.fr.lip6.texture.GaborDescriptorCreator

  {
    String im = args[0];
    String descOut = args[1];
   
   
    GaborDescriptorCreator creator = new GaborDescriptorCreator();
   
    Detector detector = new HoneycombDetector(6, 9);
    creator.setDetector(detector);
   
    long tim = System.currentTimeMillis();
    ArrayList<GaborDescriptor> listOfDesc = creator.createDescriptors(im);
    System.out.println("time : "+(System.currentTimeMillis()-tim));
   
//    System.out.println(XMLWriter.writeXMLString(listOfDesc));
    try {
      XMLWriter.writeXMLFile(descOut, listOfDesc, true);
    } catch (IOException e) {
      e.printStackTrace();
    }
   
    double[] mean = creator.getMeanGabor();
    for(int i = 0; i < mean.length; i++)
    {
      mean[i] /= creator.getNbProcessedDescriptors();
    }
    double std[] = creator.getStdGabor();
    for(int i = 0 ; i < std.length; i++)
    {
      std[i] = Math.sqrt(std[i]/creator.getNbProcessedDescriptors() - mean[i]*mean[i]);
    }
 
    System.out.println("nbDescs : "+creator.getNbProcessedDescriptors());
    System.out.println(" mean : "+Arrays.toString(mean));
    System.out.println(" std : "+Arrays.toString(std));
  }
View Full Code Here

Examples of JDescriptors.fr.lip6.texture.GaborDescriptorCreator

      System.out.println("orientation : "+orientation);
      System.out.println("low level counting : "+counting);
   
    int i = 0;
    //creation extracteur de gaborettes
    GaborDescriptorCreator creator = new GaborDescriptorCreator();
    Detector detector = new HoneycombDetector(spacing, scaling);
    creator.setDetector(detector);
    creator.setOrientation(orientation);
    creator.setCounting(counting);
   
    //processing all files
    String[] files = (new File(inDir)).list(new FilenameFilter(){


      public boolean accept(File dir, String name) {
        if(name.endsWith("lck"))
            return false;
        if(!name.endsWith("jpg") && !name.endsWith("JPG") && !name.endsWith("png") && !name.endsWith("PNG"))
          return false;
        return true;
      }});
    ArrayList<String> listOfImages = new ArrayList<String>();
    listOfImages.addAll(Arrays.asList(files));
   
    System.out.println(listOfImages.size()+" to do.");
   
    while(!listOfImages.isEmpty())
    {
      Collections.shuffle(listOfImages);
      String s = listOfImages.remove(0);
     
      System.out.println("processing "+s);
      long tim = System.currentTimeMillis();
     
      String outFileName = s.substring(0, s.lastIndexOf("."))+".gab";
      File outFile=  new File(outDir+"/"+outFileName+".xgz");
      if(outFile.exists())
      {
        System.out.println("already done.");
        continue;
      }
     
      String lockFileName = s+".lck";
      File lockFile = new File(lockFileName);
      FileLock ifl = (new FileOutputStream(lockFile)).getChannel().tryLock();
      if(ifl == null)
      {
        System.out.println("already in processing");
        continue;
      }
     
      //extract descriptors
      ArrayList<GaborDescriptor> list = creator.createDescriptors(inDir+"/"+s);
      XMLWriter.writeXMLFile(outDir+"/"+outFileName, list, true);
     
      ifl.release();
      lockFile.delete();
      System.out.println(s+" done ("+(System.currentTimeMillis()-tim)+")");
    }
   
    //formatting stat
    double mean[] = creator.getMeanGabor();
    double squareMean[] = creator.getStdGabor();
    for(i = 0 ; i < mean.length; i++)
    {
      mean[i] /= creator.getNbProcessedDescriptors();
      squareMean[i] /= creator.getNbProcessedDescriptors();
    }

    //printing stats
    System.out.println("writing stats");
    System.out.println("nb descriptors done : "+creator.getNbProcessedDescriptors());
//    objOut.writeInt(creator.getNbProcessedDescriptors());
    System.out.println("sum descriptor : "+Arrays.toString(mean));
//    objOut.writeObject(mean);
    System.out.println("sum square descriptors : "+Arrays.toString(squareMean));
//    objOut.writeObject(squareMean);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.