1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| public int[][] niveauGris(int [][] r,int [][] v,int [][] b){
int height=r.length;
int width= r[0].length;
int [][] ngris=new int [height][width];
for (int x = 0; x < height; x++)
for (int y = 0; y < width; y++)
ngris[x][y]=(r[x][y]+v[x][y]+b[x][y])/3 ;
return ngris; }
public int[][] niveauGrisReduite(int [][] ngris){
int height=ngris.length;
int width= ngris[0].length;
int [][] ngrisReduite=new int [height][width];
for (int x = 0; x < height; x++)
for (int y = 0; y < width; y++)
ngrisReduite[x][y]=ngris[x][y]/24 ;//Predre la valeur entiére
return ngrisReduite; } |