python opencv(I) 使用python打開圖片
2020-03-07 17:25 作者:一心想當(dāng)網(wǎng)紅的李老師 | 我要投稿
# -*- coding: utf-8 -*-
"""
Created on Sat Mar ?7 17:10:00 2020
@author: liyan
"""
import tkinter
from tkinter.filedialog import askopenfilename
import CV2
import numpy as np
def openfile():
? ? file_path=askopenfilename()
? ? imgviewx=CV2.imread(file_path)
? ? CV2.namedWindow("東小東標(biāo)題")####opencv打開圖片
? ? CV2.imshow("東小東標(biāo)題",imgviewx) ?###圖片顯示在了另外的一個(gè)窗口
? ??
top=tkinter.Tk()
Button1=tkinter.Button(top, text ="選擇圖片", command = openfile)
Button1.pack(padx=5)
top.mainloop() ??
標(biāo)簽: