Commit 5e546cf3 authored by Claire Lemoine's avatar Claire Lemoine
Browse files

Merge branch 'master' of https://gitlab.ensimag.fr/lemoincl/tp3-image into master

parents b3cac5bc c2277b5e
......@@ -8,20 +8,35 @@
import cv2
import os
import sys
import tkinter.filedialog
import trouve
import cache
def main():
source_path = tkinter.filedialog.askopenfilename(
filetypes=[ ("jpeg", "*.jpg"),
("tiff", "*.tiff"),
def choisir(titre):
"""
Demande a l'utilisateur de choisir une image.
"""
impath = tkinter.filedialog.askopenfilename(
filetypes=[ ("jpeg image", "*.jpg"),
("tif image", "*.tif"),
("portable network g", "*.png")],
initialdir=os.path.basename(os.path.abspath(__file__)),
title="Image source")
if not source_path:
title=titre)
if not impath:
sys.stderr.write("Il faut selectionner un fichier!\n")
return
image = cv2.imread(impath)
if image == None:
sys.stderr.write("L'image est corronpue!\n")
return
return image
def main():
source = choisir("Image source")
cacher = choisir("Image a cahcher")
if __name__ == '__main__':
main()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment