10 #ifndef CLASS_DSJALMIXER
11 #define CLASS_DSJALMIXER
35 int make(vector<DataType *> *list,
int width,
int height, vector<int> parameters,
int nParameters,
bool show_data){
45 int step = parameters[0];
48 unsigned int i, j, k, _h_, _w_;
52 int indexH[(height*width)];
53 int indexW[(height*width)];
54 for (
int i = 0, k=0; i < height; i=i+1)
56 for (
int j = 0; j < width; j=j+1, k=k+1)
63 string path =
"files/Dsjal.txt";
64 file.open(path.c_str(),ofstream::out| ofstream::trunc);
66 file << (height*width) <<
"\n";
68 indexH[0] = 0; _h_ = indexH[0];
69 indexW[0] = 0; _w_ = indexW[0];
71 for(i = 0, k = 0; i < height; i=i+1)
72 for(j = 0; j < width; j=j+1, k=k+1)
74 indexW[k+1] = (indexW[k]+step)%width;
75 indexH[k+1] = indexH[k] + (int)((indexW[k]+step)/width);
80 if(indexH[k+1] >= height)
82 indexH[k+1] = _h_ + (int)((_w_)/(width-1));
85 indexW[k+1] = (_w_+1)%width;
93 for(k=0;k<(width*height);k=k+1){
95 int fPos = ((indexH[k]*width)+indexW[k]);
97 list->at(fPos)=list->at(k);
99 file << k <<
"-" << fPos <<
"\n";
102 cout <<
"Dsjal Applied to Image\n";
110 int unmake(vector<DataType *> *list,
bool show_data){
115 vector<string> array;
117 string line, delimiter=
"-";
119 string path =
"files/Dsjal.txt";
120 file.open(path.c_str());
123 int width = atoi(line.c_str());
124 for(
int x=0;x<width;x++){
126 array.push_back(line);
128 for(
int x=0;x<width;x=x+1){
129 string s = array.back();
133 pos = s.find(delimiter);
134 token = s.substr(0, pos);
135 iPos = atoi(token.c_str());
136 s.erase(0, pos + delimiter.length());
137 pos = s.find(delimiter);
138 token = s.substr(0, pos);
139 fPos = atoi(token.c_str());
140 s.erase(0, pos + delimiter.length());
142 list->at(fPos)=list->at(iPos);
146 cout <<
"Dsjal undo to Image\n";
Clase que implementa el Método de entrelazamiento de DSJ-AL.
Clase abstracta que representa la estructura que debe tener todo procesamiento de imagen...
Clase que representa un tipo de dato que será paquetizado.
int unmake(vector< DataType * > *list, bool show_data)
int make(vector< DataType * > *list, int width, int height, vector< int > parameters, int nParameters, bool show_data)