Package JDescriptors.fr.lip6.color

Examples of JDescriptors.fr.lip6.color.ColorVQDescriptorCreator


        listOfPatches = detector.getDescriptors(ColorVQFloatDescriptor.class, bfImg.getSubimage(0, move, bfImg.getWidth(), deltaMove));       
      }
      for(ColorVQFloatDescriptor i : listOfPatches)
      {
        //the descriptor
        Descriptor cvqfd = new ColorVQFloatDescriptor();
        cvqfd.setXmin(i.getXmin());
        cvqfd.setXmax(i.getXmax());
        cvqfd.setYmin(i.getYmin());
        cvqfd.setYmax(i.getYmax());
        cvqfd.setShape(i.getShape());
        float[] d = new float[quantizer.getBinNumber()];
     
        float surf = (i.getXmax() - i.getXmin())*(i.getYmax()-i.getYmin());
        for(int x = i.getXmin(); x < i.getXmax(); ++x)
          for(int y = i.getYmin(); y < i.getYmax(); ++y)
          {
            int[] color = r.getPixel(x, y, (int[])null);
            int index = quantizer.getBin(color);
            if(index >= 0 && index < d.length)
            {
              if(normalize)
                d[index] += 1.0f/surf;
              else
                d[index] += 1.0f;
            }
          }
     
        cvqfd.setD(d);
     
        list.add(cvqfd);
      }
    }
    if(DEBUG)
View Full Code Here


   
    ArrayList<Descriptor> list = new ArrayList<Descriptor>();
   
    while(!line.startsWith("</image"))
    {     
      Descriptor d = null;
     
      //1. head
      String head = line.substring(line.indexOf("<")+1, line.indexOf(">"));
      String[] arguments = head.split(" ");
      Class c = Descriptor.class;
     
      for(String p : arguments)
      {
        if(p.startsWith("<"))
        {
         
        }
        else if(p.startsWith("class"))
        {
          String[] s = p.split("=");
          if(s.length > 1)
          {
            String descriptorClass = s[1].trim().replaceAll("\"", "");
            c = XMLReader.class.getClassLoader().loadClass(descriptorClass);
           
            d = (Descriptor<?>) c.newInstance();
          }
        }
        else if(p.startsWith("xmin"))
        {
          String[] s = p.split("=");
          if(s.length > 1)
          {
            String xmin = s[1].trim().replaceAll("\"", "");
            d.setXmin(Integer.parseInt(xmin));
           
          }
        }
        else if(p.startsWith("xmax"))
        {
          String[] s = p.split("=");
          if(s.length > 1)
          {
            String xmax = s[1].trim().replaceAll("\"", "");
            d.setXmax(Integer.parseInt(xmax));
           
          }
        }
        else if(p.startsWith("ymin"))
        {
          String[] s = p.split("=");
          if(s.length > 1)
          {
            String ymin = s[1].trim().replaceAll("\"", "");
            d.setYmin(Integer.parseInt(ymin));
           
          }
        }
        else if(p.startsWith("ymax"))
        {
          String[] s = p.split("=");
          if(s.length > 1)
          {
            String ymax = s[1].trim().replaceAll("\"", "");
            d.setYmax(Integer.parseInt(ymax));
           
          }
        }
        else if(p.startsWith("shape"))
        {
          String[] s = p.split("=");
          if(s.length > 1)
          {
            String shape = s[1].trim().replaceAll("\"", "");
            d.setShape(shape);
           
          }
        }
      }
     
     
      //2. body
      String body = line.substring(line.indexOf('>')+1, line.lastIndexOf('<')).trim();
      String[] values = body.split(",");
      try {
        d.initD();
        String dClass = d.getD().getClass().toString();
        //double
        if(dClass.equalsIgnoreCase("class [D"))
        {
          double[] v = new double[values.length];
          for(int i = 0 ; i < v.length; i++)
            v[i] = Double.parseDouble(values[i]);
         
          d.setD(v);
        }
        //float
        else if(dClass.equalsIgnoreCase("class [F"))
        {
          float[] v = new float[values.length];
          for(int i = 0 ; i < v.length; i++)
            v[i] = Float.parseFloat(values[i]);
         
          d.setD(v);   
        }
        else
        {
          System.out.println("NOT VALID CLASS");
        }
View Full Code Here

   
    String input = "";
    input = "";
    String output = "";
    String codebook = "";
    Coding coding = null;
    Pooling pooling = null;
    int knn = 0;
    Norm norm = null;
    String scales = "";
    boolean l1_vectors = false;
View Full Code Here

    String input = "";
    String output = "";
    String codebook = "";
    int nbsigmas = 5;
    int nbbins = 10;
    Norm norm = null;
    String scales = "";
    boolean l1_vectors = false;
   
    //option parsing   
      // create the parser
View Full Code Here

    String output = "";
    String codebook = "";
    Coding coding = null;
    Pooling pooling = null;
    int knn = 0;
    Norm norm = null;
    String scales = "";
    boolean l1_vectors = false;
   
   
   
View Full Code Here

    String input = "";
    input = "";
    String output = "";
    String codebook = "";
    Coding coding = null;
    Pooling pooling = null;
    int knn = 0;
    Norm norm = null;
    String scales = "";
    boolean l1_vectors = false;
   
View Full Code Here

    Runtime.getRuntime().gc();
    System.out.println(" free : "+(Runtime.getRuntime().freeMemory()/1000000)+" total : "+(Runtime.getRuntime().totalMemory()/1000000));
   
    // clustering
    ThreadedKMeans km = new ThreadedKMeans(instances, 50, 500,2);
   

    System.out.println("getting clusters...");
    double[][] centers = km.getCenters();
    double[] sigma = km.getMeanDistance();
    int[] pop = km.getPopulationInCluster();
   
    for(i = 0 ; i < centers.length; i++)
    {
      System.out.println("Cluster "+i+"("+pop[i]+")[+"+sigma[i]+"] : "+Arrays.toString(centers[i]));
    }
View Full Code Here

    Runtime.getRuntime().gc();
    System.out.println(" free : "+(Runtime.getRuntime().freeMemory()/1000000)+" total : "+(Runtime.getRuntime().totalMemory()/1000000));
   
    // clustering
    long time = System.currentTimeMillis();
    ThreadedKMeans km = new ThreadedKMeans(instances, nbCluster, 5000, Runtime.getRuntime().availableProcessors());
   

    System.out.println("getting clusters...");
    double[][] centers = km.getCenters();
    double[] sigma = km.getMeanDistance();
    int[] pop = km.getPopulationInCluster();
   
    System.out.println("done ("+(System.currentTimeMillis()-time)+").");
    System.out.println("Non empty clusters : "+centers.length);
   
    try
View Full Code Here

    Runtime.getRuntime().gc();
    System.out.println(" free : "+(Runtime.getRuntime().freeMemory()/1000000)+" total : "+(Runtime.getRuntime().totalMemory()/1000000));
   
    // clustering
    long time = System.currentTimeMillis();
    ThreadedKMeans km = new ThreadedKMeans(instances, nbCluster, 5000, Runtime.getRuntime().availableProcessors());
   

    System.out.println("getting clusters...");
    double[][] centers = km.getCenters();
    double[] sigma = km.getMeanDistance();
    int[] pop = km.getPopulationInCluster();
   
    System.out.println("done ("+(System.currentTimeMillis()-time)+").");
    System.out.println("Non empty clusters : "+centers.length);
   
    try
View Full Code Here

  /**
   * @param args
   */
  public static void main(String[] args) {
   
    ColorVQDescriptorCreator c = ColorVQDescriptorCreator.getInstance();
   
    //honeycomb patches
    HoneycombDetector detector = new HoneycombDetector(12, 12);
    c.setDetector(detector);
   
    int x = 10, y = 6, z = 4;
//    RGBColorQuantizer q =new RGBColorQuantizer(x, y, z);
    IHSColorQuantizer q = new IHSColorQuantizer(x, y, z);
    c.setQuantizer(q);
   
    c.setNormalize(true);
   
    ArrayList<ColorVQFloatDescriptor> d = c.createDescriptors(args[0]);
   
//    for(ColorVQFloatDescriptor f : d)
      System.out.println(XMLWriter.writeXMLString(d));
   
    System.out.println("size : "+d.size());
View Full Code Here

TOP

Related Classes of JDescriptors.fr.lip6.color.ColorVQDescriptorCreator

Copyright © 2018 www.massapicom. 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.