(root)
| 99 | imagePath={"filename": ""}#保存点击事件之后的图片路径 |
| 100 | tkImage = '' |
| 101 | def selectFilename(root): |
| 102 | # 选择open文件进行识别 |
| 103 | global tkImage |
| 104 | #注意:选择的图片路径中不要包含中文,不然OpenCV读取图片的时候读取为空 |
| 105 | image_path1 = filedialog.askopenfilename(title='选择文件进行识别') |
| 106 | print(image_path1) |
| 107 | if image_path1: |
| 108 | canvas0, canvas1, canvas2 = Canvas_(root) |
| 109 | img1 = cv2.imread(image_path1) |
| 110 | print(type(img1)) |
| 111 | tkImage = showImage(img1) |
| 112 | canvas0.create_image(0, 0, anchor='nw', image=tkImage) |
| 113 | imagePath["filename"] = image_path1 |
| 114 | print(imagePath["filename"]) |
| 115 | else: |
| 116 | tkinter.messagebox.showwarning(title='警告',message='请选择文件') |
| 117 | |
| 118 | #关闭主界面时弹出的确认窗口 |
| 119 | def closeEvent(root): |
no test coverage detected