# app.py import os import numpy as np import cv2 import matplotlib.pyplot as plt print("prétraitement des images...") photos = os.listdir("images/voitures") i=0 for photo in photos: path= os.path.join('images/voitures',photo) print (path) img = cv2.imread(path,1) #cv2.imshow("yes", img) img= cv2.resize(img, (100, 100)) img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) #cv2.imshow("yes", img) path= 'images/train/0/'+str(i)+'.png' print (path) cv2.imwrite(path,img) i=i+1 photos = os.listdir('images/maisons') i=0 for photo in photos: path= os.path.join('images/maisons',photo) print (path) img = cv2.imread(path,1) img= cv2.resize(img, (100, 100)) img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) #cv2.imshow("yes", img) path= 'images/train/1/'+str(i)+'.png' cv2.imwrite(path,img) i=i+1 print('termine') ''' img_half = cv2.resize(img, (100, 100)) #cv2.imshow('Half Image', img_half) cv2.imwrite("resized.jpg",img_half) #cv2.destroyAllWindows() '''