1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
| public class DiscriminantLignes {
static boolean match = true;
/**
* @return
*/
public static char Reconaissance() {
char recchar ;
//Booléen qui se mettra en true si la lettre est reconnue et activera le processus de communication
//Tableau de caractères, sachant que CorrLetter[i] correspond à Features[i].
char[] CorrLetter;
CorrLetter = new char[2];
CorrLetter[1] = 'A';
CorrLetter[2] = 'B';
//Tableau de string tel que les long de Features correspondent aux string de StringFeatures
String[] StringFeatures;
StringFeatures = new String[2];
StringFeatures[1] = "00110001100111001010111111100110001";
StringFeatures[2] = "11111100011000111111100111000110111";
//Je met ça en attendant de voir comment je récup le caractere ! ça représente
//l'image binarisée puis transformée en un string.
String recup = "11111100011000111111100111000110111";
// String recups = String.valueOf(recup);
while(match)
{
for(int j=0; j<3; j++){
int counter = 0;
for(int i=0; i<36; i++)
{
if (recup.charAt(i)== StringFeatures[j].charAt(i))
{counter++;}
}
if (counter > 32)
{match = false;
recchar = CorrLetter[j];}
}
System.out.println("Le caractère reconnu estt "+ recchar);
}
return recchar;
}
public static void main(String[] args)
{
char Caractere = Reconaissance();
System.out.println("le caractère reconnu est " + Caractere);
}
} |
Partager