Bonsoir la famille, je travail sur un systeme de reconnaissance d'empreinte digitale et actuellemenet je bloque sur la phase de squelettisation de l'image de l'empreinte digitale. Je realise cet application en php
J'aimerai que vous m'aidiez a resoudre cela
Ceci est le fichier ou je stocke les fonction de condition
Et ici je teste ces fonctions la
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
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95 <?php function pixel_est_noir($Tableau, $x, $y) { if($Tableau[$x][$y] == 1) return true; else return false; } function pixel_a_2_a_6_voisin_noir($Tableau, $x, $y) { $voisin = ($Tableau[$x][$y-1] + $Tableau[$x+1][$y-1] + $Tableau[$x+1][$y] + $Tableau[$x+1][$y+1] + $Tableau[$x][$y-1] + $Tableau[$x-1][$y+1] + $Tableau[$x+1][$y] + $Tableau[$x-1][$y-1]); if ( $voisin >= 2 && $voisin <= 6) { return true; } else return false; } function pixel_a_au_moins_une_transition_blanc_noir($Tableau, $x, $y) { $Tableau2 = array(); $transition = 0; $Tableau2 = [ $Tableau[$x][$y-1],$Tableau[$x+1][$y+1],$Tableau[$x+1][$y],$Tableau[$x+1][$y-1],$Tableau[$x][$y-1],$Tableau[$x-1][$y-1],$Tableau[$x-1][$y],$Tableau[$x-1][$y+1],$Tableau[$x][$y+1] ]; for ($i=0; $i <= (count($Tableau2)-1) ; $i++) { if ($Tableau2[$i] == false && $Tableau2[$i+1] == true) { $transition = $transition+1; } } if ($transition == 1) { return true; } else return false; } function au_moins_p2_p4_p6_est_blanc($Tableau, $x, $y) { if (($Tableau[$x][$y-1] && $Tableau[$x+1][$y] && $Tableau[$x][$y+1]) == false) { return true; } else return false; } function au_moins_p4_p6_p8_est_blanc($Tableau, $x, $y) { if (($Tableau[$x+1][$y] && $Tableau[$x][$y+1] && $Tableau[$x-1][$y]) == false) { return true; } else return false; } function au_moins_p2_p4_p8_est_blanc($Tableau, $x, $y) { if (($Tableau[$x][$y-1] && $Tableau[$x+1][$y] && $Tableau[$x-1][$y]) == false) { return true; } else return false; } function au_moins_p2_p6_p8_est_blanc($Tableau, $x, $y) { if (($Tableau[$x][$y-1] && $Tableau[$x][$y+1] && $Tableau[$x-1][$y]) == false) { return true; } else return false; } ?>
Mais ca ne marche pas je ne sais pas pourquoi.
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
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83 <?php require 'FonctionSquelettisation.php'; $image = imagecreatefromjpeg('resultat.jpg'); $width = imagesx($image); $heigth = imagesy($image); $imgFinal = imagecreatetruecolor($width, $heigth); $Tableau = array(array()); $TableauCopie = array(array()); $TableauCopie1 = array(array()); for ($y=0; $y <$heigth ; $y++) { for ($x=0; $x <$width ; $x++) { $pixel = imagecolorat($image, $x, $y); $black = imagecolorallocate($image, 0, 0, 0); // Couleur noir $white = imagecolorallocate($image, 255, 255, 255); // couleur blanche $black2 = imagecolorallocate($imgFinal, 0, 0, 0); // Couleur noir $white2 = imagecolorallocate($imgFinal, 255, 255, 255); // couleur blanche if ($pixel == $black) { $Tableau[$x][$y] = 0; } elseif ($pixel == $white) { $Tableau[$x][$y]=1; } } $TableauCopie = $Tableau; } while ($pixel == false) { for ($y=0; $y < $heigth ; $y++) { for ($x=0; $x <$width ; $x++){ if (pixel_est_noir($TableauCopie,$x,$y) && pixel_a_2_a_6_voisin_noir($TableauCopie, $x, $y) && pixel_a_au_moins_une_transition_blanc_noir($TableauCopie, $x, $y) && au_moins_p2_p4_p6_est_blanc($TableauCopie, $x, $y) && au_moins_p4_p6_p8_est_blanc($TableauCopie, $x, $y)){ $TableauCopie1[$x][$y] = $TableauCopie[$x][$y]; } } } for ($y=0; $y <$heigth ; $y++) { for ($x=0; $x<$width ; $x++) { if (pixel_est_noir($TableauCopie,$x,$y) && pixel_a_2_a_6_voisin_noir($TableauCopie,$x,$y) && pixel_a_au_moins_une_transition_blanc_noir($TableauCopie,$x,$y) && au_moins_p2_p4_p8_est_blanc($TableauCopie,$x,$y) && au_moins_p2_p6_p8_est_blanc($TableauCopie,$x,$y)) { $TableauCopie1[$x][$y] = $TableauCopie[$x][$y]; } } } if (array_diff($TableauCopie1, $TableauCopie) == true) { break; } } for ($y=0; $y <$heigth ; $y++) { for ($x=0; $x <$width ; $x++) { if ($TableauCopie1[$x][$y] == 0) { imagesetpixel($imgFinal, $x, $y, $black2); } else imagesetpixel($imgFinal, $x, $y, $white2); } } imagejpeg($imgFinal,'Image/resultat.jpg'); imagedestroy($imgFinal); ?>
J'utilise une image binarisée et j'essaie de la convertir en tableau
Partager