Filtre/probleme

Fermé
najah01_3 Messages postés 35 Date d'inscription dimanche 24 septembre 2006 Statut Membre Dernière intervention 17 juillet 2007 - 23 juin 2007 à 07:03
Twinuts Messages postés 5375 Date d'inscription dimanche 4 mai 2003 Statut Modérateur Dernière intervention 14 juin 2023 - 23 juin 2007 à 14:07
salam ,

voila mon code qui fait un detecteur horizoatal et vertical . mais le probleme est qu il ne donne pas le resultat siuhaitable . parfois il affiche l image tel quelle .

public int filterRGB(int x, int y, int rgb) {
if (y == 0) {
return rgb ;
}

if (x == 0) {
return rgb ;
}

int yprevious = y - 1 ;
if (yprevious < 0 ) {
yprevious = width - 1;
}

int xprevious = x - 1 ;
if (xprevious < 0 ) {
xprevious = height - 1;
}

int ypreviousRGB = data[width*x + yprevious] ;
int xpreviousRGB = data[x + xprevious*height] ;

int a1 = (rgb >> 24) & 0xFF;

int r1 = (rgb >> 16) & 0xFF;
int g1= (rgb >> 8) & 0xFF;
int b1= rgb & 0xFF;

int r2 = (ypreviousRGB >> 16) & 0xFF;
int g2 = (ypreviousRGB >> 8) & 0xFF ;
int b2 = ypreviousRGB & 0xFF;

int r3 = (xpreviousRGB >> 16) & 0xFF;
int g3 = (xpreviousRGB >> 8) & 0xFF ;
int b3 = xpreviousRGB & 0xFF;

int r4 = r2 - r1 ;
int g4 = g2 - g1 ;
int b4 = b2 - b1 ;

int r5 = r3 - r1 ;
int g5 = g3 - g1 ;
int b5 = b3 - b1 ;

int r6 =(int) (Math.sqrt((r4*r4)+(r5*r5)));
int g6 = (int)(Math.sqrt((g4*g4)+(g5*g5)));
int b6 = (int) (Math.sqrt((b4*b4)+(b5*b5)));

return ((a1<<24)+(r6 << 16) + (g6 << 8) + b6);
// return ((a1<<24)+(r5 << 16) + (g5 << 8) + b5);
}
}

1 réponse

Twinuts Messages postés 5375 Date d'inscription dimanche 4 mai 2003 Statut Modérateur Dernière intervention 14 juin 2023 111
23 juin 2007 à 14:07
Salut,

tu as déjà ouvert le sujet ICI alors merci d'arreter de flooder le forum.

sujet clos !

------------------------------------
"On n'est pas au resto : ici on ne fait pas dans les plats tout cuits ..."

OoWORAoO
0
Rejoignez-nous