package de.mpi.rgblab.apps;
import java.util.Vector;
import de.mpi.rgblab.color.ColorModel;
import de.mpi.rgblab.data.ColorReader;
import de.mpi.rgblab.data.Data;
import de.mpi.rgblab.optimizer.Optimizer;
import de.mpi.rgblab.utils.LogUtil;
import de.mpi.rgblab.utils.VisUtil;
public class ShellApp2 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
startShell(args);
}
public static void startShell(String[] args) {
System.out.println("Start");
if (args.length != 6) {
System.out.println("six parameters - distance to the screen, surround angle, file with the colors, data file, the log file, the RGB result file");
}
int radius = new Integer(args[0]).intValue();
String logFile = args[4];
String inputData = args[3];
String colorData = args[2];
String outputFile = args[5];
int distance = Integer.parseInt(args[0]);
int surroundAngle = Integer.parseInt(args[1]);
int radiusView = VisUtil.getViewRadius(distance);
int radiusSurround = VisUtil.getRadius(distance, surroundAngle);
Data data = new Data();
data.importData(inputData);
Vector<ColorModel> classColors = new Vector<ColorModel>();
classColors = ColorReader.getColorsAsColorModel(colorData);
if (classColors.size() < data.getClassNumbers()) {
System.out.println("The color file needs to have at least " + data.getClassNumbers() + " colors!");
return;
}
// data.computeSaliency(radius, classColors);
// data.computeVisibility(radius);
// data.export(args[2]);
Optimizer opt = new Optimizer(logFile); //, 0.60, 6);
classColors = opt.optimize(data, classColors, radiusView, radiusSurround);
LogUtil l = new LogUtil(outputFile, true);
for (int i =0; i< classColors.size(); i++) {
l.log(Integer.toString(Math.round((float)classColors.get(i).getDimension_1())));
l.log(",");
l.log(Integer.toString(Math.round((float)classColors.get(i).getDimension_2())));
l.log(",");
l.logln(Integer.toString(Math.round((float)classColors.get(i).getDimension_3())));
//l.logln("");
}
l.close();
System.out.println("End");
}
}