Skip to content

Instantly share code, notes, and snippets.

@santiagopuerta
Last active December 10, 2015 06:18
Show Gist options
  • Save santiagopuerta/4393680 to your computer and use it in GitHub Desktop.
Save santiagopuerta/4393680 to your computer and use it in GitHub Desktop.
Imagen i2(filas/reduccion,columnas/reduccion);
int fil=filas/reduccion;
int col=columnas/reduccion;
int med=0;
int aux=0;
int aux2=0;
int auxi=0;
int itfil=0;
int itcol=0;
cout << "Reduccion del tipo " << reduccion << "x"<< endl;
cout << "La imagen reducida saldra con " << fil << " filas y " << col << " columnas." << endl;
for(int i=0; i<fil; i+=reduccion){
for(int j=0; j<col; j+=reduccion){
for(int f=i; f<i+reduccion; f++){
for(int c=j; c<j+reduccion; c++){
med = med+valor_pixel(f,c);
}
}
med = med/(reduccion*reduccion);
i2.asigna_pixel(itfil,itcol,med);
itcol++;
if (itcol == col) {
itfil++;
itcol = 0;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment