L'image doit avoir été chargée dans la matrice, et dans ce cas, elle doit faire 256x256 pixels.
code: -- Fonction qui retourne l'intensité max des pixels d'une image function GetIntensiteMax(Matrice : in TypeMatrice) return integer is Resultat : integer := 0; i, j : integer := 0; begin while (i <= 255) and (j <= 255) and (Resultat /= 255) loop if character'pos(Matrice(i, j)) > Resultat then Resultat := character'pos(Matrice(i, j)); end if; if j = 255 and i < 255 then j := 0; i := i + 1; else j := j + 1; end if; end loop; return Resultat; end GetIntensiteMax; -- Fonction qui retourne l'intensité min des pixels d'une image function GetIntensiteMin(Matrice : in TypeMatrice) return integer is Resultat : integer := 255; i, j : integer := 0; begin while (i <= 255) and (j <= 255) and (Resultat /= 0) loop if character'pos(Matrice(i, j)) < Resultat then Resultat := character'pos(Matrice(i, j)); end if; if j = 255 and i < 255 then j := 0; i := i + 1; else j := j + 1; end if; end loop; return Resultat; end GetIntensiteMin; |