21 string src=
"lena.jpg";
23 string folder_result=
"images/";
25 bool export_files=
false;
26 int wblock=1, hblock=1, package_size=27;
27 vector<ForwardProcessing *> fp;
28 vector<int> fp_narguments;
29 vector<string> fp_name;
30 vector<vector<int> > fp_arguments;
34 vector<Metric *> metrics;
37 double npkgo, npkgf, nepkgo, nepkgf;
39 #include "functions.h"
43 int main(
int argc,
char const *argv[])
45 readArguments(argc,argv);
47 file.open(
"files/results.txt",ios::app);
51 cout <<
"Arguments readed\n";
52 Images img(src,wblock,hblock,show_data);
53 vector<DataType *> list = img.toList();
54 int nwblock=(int)(img.getWidth()/img.getWidthBlock());
55 int nhblock=(int)(img.getHeight()/img.getHeightBlock());
56 for (
int i = 0; i < fp.size(); i=i+1)
58 int narg = fp_narguments[i];
59 vector<int> args = fp_arguments[i];
60 fp[i]->make(&list,nwblock,nhblock,args,narg,show_data);
66 vector<Package> pkgs = pktz->imgToPackageList(list,package_size,show_data);
68 nepkgo = pktz->getSizeElements();
69 vector<Package> rcved = chnl->simulate(pkgs);
73 cout <<
"Not exists packages received, end \n";
76 vector<DataType *> pkgs_rcved = pktz->packageListToImg(rcved,show_data);
77 nepkgf = pktz->getSizeElements();
80 file <<
"\% Pkg-Lost: " << 100-((npkgf*100)/npkgo) <<
"\t";
81 file <<
"\% Block-Lost: " << 100-((nepkgf*100)/nepkgo) <<
"\t";
85 Images aux(pkgs_rcved,img.getType(),img.getWidth(),img.getHeight(),img.getWidthBlock(),img.getHeightBlock(),show_data);
86 string path = folder_result+
"image_received_mixed.bmp";
87 aux.save(path.c_str());
89 for (
int i = fp.size()-1; i>=0; i=i-1)
91 fp[i]->unmake(&pkgs_rcved,show_data);
93 Images received(pkgs_rcved,img.getType(),img.getWidth(),img.getHeight(),img.getWidthBlock(),img.getHeightBlock(),show_data);
95 string path = folder_result+
"image_received_unmixed.bmp";
96 received.save(path.c_str());
98 rbd->hidden(&received,show_data);
100 string path = folder_result+
"image_received_rebuilded.bmp";
101 received.save(path.c_str());
103 for (
int i = 0; i < metrics.size(); i=i+1)
105 double met = metrics.at(i)->calculate(img,received,show_data);
107 file << metrics.at(i)->getName() <<
": " << met <<
"\t";
Clase que representa una Imagen.
Clase que define la estructuras que debe tener el paquetizador.
Clase Abstracta que indica la forma que debe tener todo método de Ocultamiento de errores en Imágenes...
Clase Abstracta que representa el Simulador de pérdida de paquetes.