22 int amount_forward_processing;
24 vector<ForwardProcessing*> forward_processing;
27 int main(
int argc,
char const *argv[])
30 cout <<
"This tools required minimum six parameters to work\n"
31 <<
"-URL of Picture\n"
32 <<
"-Forward Processing Methods\n"
33 <<
"-Type of Packetizer\n"
34 <<
"-Size of Packages\n"
35 <<
"-Channel of Simulation\n"
36 <<
"-Rebuilder Methods\n";
40 img.save(
"images/img_readed.bmp");
44 vector<DataType *> list = img.toList();
47 if(!fm.compare(FORWARD_METHOD)){
48 amount_forward_processing=stoi(argv[3]);
51 while(x<=amount_forward_processing){
52 int nArguments = stoi(argv[i+1]);
54 for(
int c=1;c<=nArguments;c++){
55 args[c-1]=stoi(argv[i+1+c]);
57 string fpname = argv[i];
60 cout <<
"The Forward Processing Method are not created\n";
63 int result = fp->make(&list,img.getWidth(),img.getHeight(),args,nArguments);
65 forward_processing.push_back(fp);
66 Images mixed(list,img.getType(),img.getWidth(),img.getHeight());
67 replace( fpname.begin(), fpname.end(),
'-',
'_');
68 string saved =
"images/img_mixed" + fpname+
".bmp";
69 mixed.save(saved.c_str());
73 cout <<
"The numbers of Parameters are not valid\n";
76 cout <<
"The Image need be squared (WxH)\n";
79 cout <<
"the byteOffset or the packetOffset need be mayor than 0\n";
90 string pkgname = argv[i];
91 p = PacketizerCreator::create(pkgname);
93 pkgs = p->imgToPackageList(list,stoi(argv[i+1]));
94 cout <<
"N-PACKAGES: " << pkgs.size() <<
"\n";
97 cout <<
"Packetizer are not created\n";
102 cout <<
"Packetizer are not defined\n";
106 RandomGenerator::generate(4,pkgs.size());
110 vector<Package> rcved = Channel::lossFromFile(
"files/loss_random.loss", pkgs);
111 cout <<
"N-PACKAGES-RECEIVED: " << rcved.size() <<
"\n";
112 vector <DataType *> pkgs_rcved = p->packageListToImg(rcved);
113 Images rbefore(pkgs_rcved,img.getType(),img.getWidth(),img.getHeight());
114 rbefore.save(
"images/img_received_before_unmixed.bmp");
116 for(
int j=forward_processing.size()-1;j>=0;j--){
117 forward_processing[j]->unmake(&pkgs_rcved);
120 Images received(pkgs_rcved,img.getType(),img.getWidth(),img.getHeight());
121 received.save(
"images/img_received.bmp");
125 string rbd = argv[i];
126 if(rbd.compare(REBUILDER_METHOD)){
127 cout <<
"Rebuilder Method has not defined\n";
131 Rebuilder* rbdr = RebuilderCreator::create(rbd);
133 rbdr->hidden(&received);
134 received.save(
"images/img_received_rebuilded.bmp");
137 cout <<
"Rebuilder isn't created\n";
142 cout <<
"Not Exists Rebuilder Method\n";
147 cout <<
"PSNR: " << metric->calculate(img,received) <<
"\n";
Clase abstracta que representa la estructura que debe tener todo procesamiento de imagen...
Clase que representa una Imagen.
Clase que define la estructuras que debe tener el paquetizador.
Clase que representa la Métrica PSNR.
Clase Abstracta que indica la forma que debe tener todo método de Ocultamiento de errores en Imágenes...