from imageio import imread from copy import deepcopy import matplotlib.pyplot as plt # Fonctions fournies (ne pas toucher) def retire(img, cols): for line, j in zip(img, cols): line.pop(j) def retire_colonne(img, j): retire(img, [j]*len(img)) img_interet_test = [[ 0.6, 0.4, 0.2, 0.5, 0.3, 0.2, 0.1 ], [ 0.7, 0.3, 0.2, 0.3, 0.4, 0.3, 0.5 ], [ 0.7, 0.3, 0.4, 0.2, 0.3, 0.2, 0.6 ], [ 0.6, 0.3, 0.5, 0.3, 0.1, 0.6, 0.5 ], [ 0.2, 0.4, 0.5, 0.3, 0.4, 0.7, 0.5 ]] # Fonction à compléter def convertir_gris(img): return [[ 0.0 ]] # à modifier def zones_interet(img_g): ... def recadre(img): ... def redimensionne(img): ... def imin(lst): ... def cols_1(img_interet): ... def transforme_1(img_interet): ... def somme_gradients(img_interet): ... def moins_interessante(img_interet): ... def transforme_2(img): ... def cumule(img_interet): ... def opt_cols(interets_cumules): ... def carve(img): ... def transpose(img): ... def renforce(img): ... # Chargement de l'image (ne changer que le chemin/nom de l'image) img = [[[c/255.0 for c in pxl] for pxl in line] for line in imread("/ressources/sc/bulle.png")] # Ajouter C: devant /ressources si vous êtes sous Windows # Tests img_g = convertir_gris(img) # Affichage de deux images côte à côte plt.figure(figsize=(8,3)) plt.subplot(121) plt.imshow(img) # Image originale à gauche plt.subplot(122) plt.imshow(img_g, cmap="gray", vmin=0.0, vmax=1.0) # Image en niveau de gris plt.show()