import matplotlib.pyplot as plt
import numpy as np


# On charge l'image et on la transforme en tableau
image_entree = plt.imread("Composite.png")
image = image_entree[:,:,0:3]
nb_lignes,nb_colonnes,_ = image.shape

# On crée notre image de sortie sous forme de tableau numpy
image_sortie = np.copy(image[:,:,0])

# On transforme l'image en image en nuances de gris
for i in range(nb_lignes):
    for j in range(nb_colonnes):
        image_sortie[i,j] = 0.2126*image[i,j,0] + 0.7152*image[i,j,1] + 0.0722*image[i,j,2]
image_sortie = image_sortie*255
        
# Définition de la fonction Seuil(X)
def Seuil(x) :
    Vseuil = 100
    if [Instruction 3.1] :
        return [Instruction 3.2]
    else :
        return [Instruction 3.3]

# Application de la fonction seuil à l'image et calcul de la moyenne
# REPERE 1
V_Moyenne = 0
N_pixel = [Instruction 3.7]
for i in [Instruction 3.4] :
    for j in [Instruction 3.5]:
        image_sortie[i,j] = [Instruction 3.6]
Pourcentage = [Instruction 3.9]
# REPERE 2

print(Pourcentage)