#########################################################################################
#           TP0 - Révisions de 1ière année (traitement d'image et graphes)              #
#########################################################################################

import matplotlib.pyplot as plt
import numpy as np

# Première partie
#################

# Question 1 :
##############
image_c = plt.imread("Chiffres_Couleur.png")

def convertir_image(img:np.ndarray) -> np.ndarray :
    img_g = np.zeros((len(img),len(img[0])))
    for i in range(len(img_g)):
        for j in range(len(img_g[0])):
            niveau_gris = 0.2126*img[i,j,0]+0.7152*img[i,j,1]+0.0722*img[i,j,2]
            img_g[i,j] = np.float32(niveau_gris)
    return img_g

image_g= convertir_image(image_c)


def affiche(img):                   # Fonction pour afficher l'image
    plt.close()                     # On ferme les images ouvertes
    plt.imshow(img,cmap='gray')     # On trace l'image (cmap='gray' car en niveau de gris)
    plt.show()                      # On montre l'image



# Question 2 :
##############

# def dim(img:np.ndarray) -> tuple :



# Question 3 :
##############

# def img_blanche(nl:int,nc:int) -> np.ndarray :




# Question 4 :
##############

# def convertir_N_B(img:np.ndarray,seuil:float) -> np.array :











# Question 5 :
##############

# def sym_horiz(img:np.ndarray) -> np.array :








# Question 6 :
##############

# def sym_verti(img:np.ndarray) -> np.array :








# Question 7 :
##############

# def rot_gauche(img:np.ndarray) -> np.array :








# Question 8 :
##############

# def rot_180(img:np.ndarray) -> np.array :



# Question 9 :
##############

# def rot_droite(img:np.ndarray) -> np.array :





