Bonjour,
Voila je développe un mini tp sur la comparaison d'images et j'aimerais bien savoir :
Comment faire pour afficher une image a niveau de gris sachant que j'ai déjà
calculer les niveaux de gris d'une image sous forme d'un tableau à 2 dimensions ?
Et comment implémenter les matrices de cooccurrences (distance=1 et l'angle=0°,distance=1 et l'angle=90°,distance=1 et l'angle=45°
distance=1 et l'angle=135°)sachant que j'ai dejà calculé la matrice à niveaux de gris réduite
Voici mon code:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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; }
je vous remercie d'avance pour votre aide