Esempio n. 1
0
  public PtsFileConverter(GetOpt opts) {
    FileInputStream fin;
    DataInputStream ins = null;
    FileWriter fout = null;
    try {

      String inFileString = opts.getString("infile");
      String[] inFiles = inFileString.split(",");
      fout = new FileWriter(opts.getString("outfile"), false);
      for (int i = 0; i < inFiles.length; i++) {
        fin = new FileInputStream(inFiles[i]);
        ins = new DataInputStream(fin);

        FeatureCategory type;
        if (opts.getString("type").equals("color")) {
          type = FeatureCategory.COLOR;
        } else if (opts.getString("type").equals("shape")) {
          type = FeatureCategory.SHAPE;
        } else {
          type = FeatureCategory.SIZE;
        }

        if (ins != null && fout != null) {
          convertFile(ins, fout, type);
        }
        ins.close();
        fin.close();
      }

    } catch (Exception ex) {
      System.err.println("ERR: " + ex);
      ex.printStackTrace();
    }
  }
Esempio n. 2
0
  public static void main(String[] args) {
    GetOpt opts = new GetOpt();

    opts.addBoolean('h', "help", false, "Show this help screen");
    opts.addString('i', "infile", null, "Input .pts file");
    opts.addString('o', "outfile", null, "Output feature vector file");
    opts.addString('t', "type", "shape", "Type of features to extract: {color, shape}");

    if (!opts.parse(args)) {
      System.err.println("ERR: " + opts.getReason());
      System.exit(1);
    }
    if (opts.getBoolean("help")) {
      opts.doHelp();
      System.exit(1);
    }

    PtsFileConverter pfc = new PtsFileConverter(opts);
  }