00001 package testbench;
00002
00003 import java.io.File;
00004 import java.io.FileNotFoundException;
00005 import java.io.PrintWriter;
00006
00007 import commandline.Encoder.EncoderTypeSelector;
00008 import commandline.Encoder.NormalMeshEncoder;
00009 import commandline.Encoder.Iterators.MeshIteratorSelector;
00010 import commandline.Norm.NormenMaker;
00011
00012
00019 public class BaseMeshDistortion {
00020
00021 public BaseMeshDistortion() {
00022 super();
00023
00024 }
00025
00026
00027 public static void main(String[] args) throws FileNotFoundException{
00028
00029 String s =File.separator;
00030 String image_name="cameraman";
00031 int PSNR=30;
00032 String path_to_original_fig=Paths.getPathToImageDB()+image_name+".bmp";
00033 int COMPRESSIONTYPE=EncoderTypeSelector.GENERIC_COMPRESSION;
00034 String path_to_out_dir=Paths.pathToRateDistortionOutput;
00035
00036 int ORDERING_NORM=NormenMaker.L_2;
00037 int TESSELATION_NORM=NormenMaker.L_1;
00038
00039 float error=2;
00040
00041 String result_file_path=Paths.pathToRateDistortionOutput+s+image_name+ "_basemeshresult.m";
00042 File result_file=new File(result_file_path);
00043 PrintWriter printWriter=null;
00044 try {
00045 printWriter=new PrintWriter(result_file);
00046 } catch (FileNotFoundException e) {
00047
00048 e.printStackTrace();
00049 }
00050 printWriter.print("RES=[");
00051 for(float percentage=0.1f; percentage<=0.1f ; percentage+=0.1){
00052 for(int k =113;k<=113;k+=10){
00053 String[] command=new String[]{
00054 "-i", ""+path_to_original_fig,
00055 "-o" ,""+ path_to_out_dir,
00056 "-n", ""+image_name+"_"+(int)Math.floor(percentage*100)+"_"+k +"_",
00057 "-IT",""+MeshIteratorSelector.UNTIL_CERTAIN_MINIMAL_PSNR_REACHED,
00058 "-stop",""+PSNR,
00059 "-perc", ""+percentage,
00060 "-mb",
00061 "-k", ""+k,
00062 "-N", "80",
00063 "-L", "75",
00064 "-compressiontype", EncoderTypeSelector.getNameForCompressionType(COMPRESSIONTYPE),
00065 "-D", "12",
00066 "-maxr","1",
00067 "-Wnr",""+ORDERING_NORM,
00068 "-Wnt",""+TESSELATION_NORM
00069 };
00070 NormalMeshEncoder normalMeshEncoder= NormalMeshEncoder.commandline(command);
00071 String path_to_compressed_file=normalMeshEncoder.getConfiguration().getOutputDir()+normalMeshEncoder.getConfiguration().getOutputName()+".nob";
00072 File compressed=new File(path_to_compressed_file);
00073 printWriter.println("["+percentage+ " "+ k + " "+ compressed.length()+"]");
00074 printWriter.flush();
00075 }
00076 }
00077 printWriter.print("];");
00078 printWriter.close();
00079
00080
00081
00082
00083
00084
00085 }
00086
00087 }