11 #ifndef CLASS_REBUILDERAVERAGE
12 #define CLASS_REBUILDERAVERAGE
14 #define max(a, b) ((a) > (b) ? (a) : (b))
15 #define min(a, b) ((a) < (b) ? (a) : (b))
40 int amount_channels = img->getType();
42 int w = img->getWidth()/img->getWidthBlock();
43 int h = img->getHeight()/img->getHeightBlock();
45 for(
int i = 0; i < h; i=i+1)
47 for(
int j = 0; j < w; j=j+1)
49 if(!matrix[i][j].isValid())
51 vector<int> add(amount_channels);
52 for(
int x=0;x<amount_channels;x++)
56 for(
int iBlock = max((
int)i-1,0); iBlock <= min(i+1,h-1) ; iBlock++)
57 for(
int jBlock = max((
int)j-1,0); jBlock <= min(j+1,w-1); jBlock++)
58 if((i != iBlock) || (j != jBlock))
59 if(matrix[iBlock][jBlock].isValid())
61 vector<Pixel> *e = (vector<Pixel>*)matrix[iBlock][jBlock].getExtras();
62 for(
int r=0;r<img->getHeightBlock();r++){
63 for(
int c=0;c<img->getWidthBlock();c++){
64 vector<int> chnls = e->at(r*(img->getWidthBlock())+c).getChannels();
65 for(
int x=0;x<amount_channels;x++){
75 for(
int x=0;x<amount_channels;x=x+1){
76 add[x]=(int)(add[x]/count);
78 DataBlock* db =
new DataBlock(amount_channels,add,img->getWidthBlock(),img->getHeightBlock());
84 }
while(isLossBlock(img));
86 cout <<
"The Image has been restored\n";
91 bool isLossBlock(
Images* img){
99 int w=img->getWidth()/img->getWidthBlock();
100 int h=img->getHeight()/img->getHeightBlock();
101 for (
int i = 0; i < h; ++i)
103 for (
int j = 0; j < w; ++j)
105 if(!matrix[i][j].isValid())
Clase que representa un Bloque de Píxeles.
Clase que implementa un método de ocultamiento de errores utilizando el promedio de sus vecinos más c...
virtual void hidden(Images *img, bool show_data)
Clase que representa una Imagen.
Clase Abstracta que indica la forma que debe tener todo método de Ocultamiento de errores en Imágenes...