def __init__(self, win): ttk.Frame.__init__(self, win) frame0 = ttk.Frame(self) frame1 = ttk.Frame(self) frame2 = ttk.Frame(self) frame3 = ttk.Frame(self) frame4 = ttk.Frame(self) win.title("车牌对比识别") win.minsize(920, 600) self.center_window() self.s1 = StringVar() self.s2 = StringVar() self.pilImage = Image.open("pic/left.png") self.tkImage = ImageTk.PhotoImage(image=self.pilImage) self.image_ctl = tk.Label(frame0, image=self.tkImage) self.image_ctl.pack(side=LEFT) self.pilImage2 = Image.open("pic/right.png") self.tkImage2 = ImageTk.PhotoImage(image=self.pilImage2) self.image_ctl2 = tk.Label(frame0, image=self.tkImage2) self.image_ctl2.pack(side=RIGHT) frame0.pack(side=TOP, fill=tk.Y, expand=1) frame4.pack(side=TOP, fill=tk.Y, expand=1) frame1.pack(side=TOP, fill=tk.Y, expand=1) frame2.pack(side=TOP, fill=tk.Y, expand=1) frame3.pack(side=TOP, fill=tk.Y, expand=1) self.label = ttk.Label(frame1, text='图片1(左): ') self.label.pack(side=LEFT) self.input1 = ttk.Entry(frame1, textvariable=self.s1, width=30) self.input1.pack(side=LEFT) self.face_button1 = ttk.Button(frame1, text="选择文件", width=15, command=self.file1) self.face_button1.pack(side=RIGHT) self.cut_ctrl2 = ttk.Button(frame1, text="截图选取", width=15, command=self.cut_pic1) self.cut_ctrl2.pack(side=RIGHT) self.label2 = ttk.Label(frame2, text='图片2(右): ') self.label2.pack(side=LEFT) self.input2 = ttk.Entry(frame2, textvariable=self.s2, width=30) self.input2.pack(side=LEFT) self.face_button2 = ttk.Button(frame2, text="选择文件", width=15, command=self.file2) self.face_button2.pack(side=RIGHT) self.cut_ctrl3 = ttk.Button(frame2, text="截图选取", width=15, command=self.cut_pic2) self.cut_ctrl3.pack(side=RIGHT) self.clean_button = ttk.Button(frame3, text="清除显示信息", width=15, command=self.cut_clean) self.clean_button.pack(side=LEFT) self.url_face_button = ttk.Button(frame3, text="网络地址识别", width=15, command=self.url_p) self.url_face_button.pack(side=LEFT) self.file_pic_button = ttk.Button(frame3, text="本地文件识别", width=15, command=self.file_pic) self.file_pic_button.pack(side=RIGHT) self.match = ttk.Label(frame4, text='', font=('Times', '20')) self.match.pack() self.pack(fill=tk.BOTH, expand=tk.YES, padx="10", pady="10") self.predictor = predict.CardPredictor() self.predictor.train_svm()
def __init__(self, win): ttk.Frame.__init__(self, win) frame_left = ttk.Frame(self) frame_right1 = ttk.Frame(self) frame_right2 = ttk.Frame(self) top = ttk.Frame(self) win.title("车牌识别") win.minsize(850, 700) # win.wm_attributes('-topmost', 1) self.center_window() self.pic_path3 = "" self.cameraflag = 0 top.pack(side=TOP, expand=1, fill=tk.Y) reset_ctl = ttk.Button(top, text="重置窗口", width=10, command=self.reset) reset_ctl.pack(side=LEFT) L1 = ttk.Label(top, text='网络地址:') L1.pack(side=LEFT) self.p1 = StringVar() self.user_text = ttk.Entry(top, textvariable=self.p1, width=45) self.user_text.pack(side=LEFT) self.user_text.bind('<Key-Return>', self.url_pic2) url_ctl = ttk.Button(top, text="识别网络图片", width=20, command=self.url_pic) url_ctl.pack(side=RIGHT) self.pack(fill=tk.BOTH, expand=tk.YES, padx="10", pady="10") frame_left.pack(side=LEFT, expand=1) frame_right1.pack(side=TOP, expand=1, fill=tk.Y) frame_right2.pack(side=RIGHT, expand=0) #ttk.Label(frame_left, text='地址:').pack(anchor="nw") self.image_ctl = ttk.Label(frame_left) self.image_ctl.pack(anchor="nw") #ttk.Label(frame_right1, text='形状定位车牌位置:').grid(column=0, row=0, sticky=tk.W) from_pic_ctl = ttk.Button(frame_right2, text="来自图片", width=20, command=self.from_pic) from_pic_ctl2 = ttk.Button(frame_right2, text="路径批量识别", width=20, command=self.from_pic2) from_vedio_ctl = ttk.Button(frame_right2, text="打开/关闭摄像头", width=20, command=self.from_vedio) from_video_ctl = ttk.Button(frame_right2, text="拍照并识别", width=20, command=self.video_pic) from_img_pre = ttk.Button(frame_right2, text="查看预处理图像", width=20, command=self.show_img_pre) clean_ctrl = ttk.Button(frame_right2, text="清除识别数据", width=20, command=self.clean) exit_ctrl = ttk.Button(frame_right2, text="api再次识别", width=20, command=self.api_ctl) self.cut_ctrl = ttk.Button(frame_right2, text="截图识别", width=20, command=self.cut_pic) camera_ctrl = ttk.Button(frame_right2, text="开关摄像头实时识别(测试)", width=20, command=self.camera_flag) self.roi_ctl = ttk.Label(frame_right1) #self.roi_ctl.grid(column=0, row=1, sticky=tk.W) ttk.Label(frame_right1, text='形状定位识别结果:').grid(column=0, row=2, sticky=tk.W) self.r_ctl = ttk.Label(frame_right1, text="", font=('Times', '20')) self.r_ctl.grid(column=0, row=3, sticky=tk.W) self.color_ctl = ttk.Label(frame_right1, text="", width="20") self.color_ctl.grid(column=0, row=4, sticky=tk.W) self.cut_ctrl.pack(anchor="se", pady="5") camera_ctrl.pack(anchor="se", pady="5") from_vedio_ctl.pack(anchor="se", pady="5") from_video_ctl.pack(anchor="se", pady="5") from_pic_ctl2.pack(anchor="se", pady="5") from_pic_ctl.pack(anchor="se", pady="5") from_img_pre.pack(anchor="se", pady="5") clean_ctrl.pack(anchor="se", pady="5") exit_ctrl.pack(anchor="se", pady="5") ttk.Label(frame_right1, text='-------------------------------').grid(column=0, row=5, sticky=tk.W) #ttk.Label(frame_right1, text='颜色定位车牌位置:').grid(column=0, row=6, sticky=tk.W) self.roi_ct2 = ttk.Label(frame_right1) #self.roi_ct2.grid(column=0, row=7, sticky=tk.W) ttk.Label(frame_right1, text='颜色定位识别结果:').grid(column=0, row=8, sticky=tk.W) self.r_ct2 = ttk.Label(frame_right1, text="", font=('Times', '20')) self.r_ct2.grid(column=0, row=9, sticky=tk.W) self.color_ct2 = ttk.Label(frame_right1, text="", width="20") self.color_ct2.grid(column=0, row=10, sticky=tk.W) ttk.Label(frame_right1, text='-------------------------------').grid(column=0, row=11, sticky=tk.W) self.clean() self.apistr = None img_excel.create_excel() img_sql.create_sql() self.predictor = predict.CardPredictor() self.predictor.train_svm()
def __init__(self, win): ttk.Frame.__init__(self, win) frame0 = ttk.Frame(self) frame1 = ttk.Frame(self) frame2 = ttk.Frame(self) frame3 = ttk.Frame(self) frame4 = ttk.Frame(self) win.title("车牌搜索系统") win.minsize(850, 600) self.center_window() self.s1 = StringVar() self.s2 = StringVar() self.matchflag = 0 self.stopflag = 1 self.pic_path = "" self.pic_path3 = "" self.thread_run2 = False self.pilImage = Image.open("pic/searchl.png") self.tkImage = ImageTk.PhotoImage(image=self.pilImage) self.image_ctl = tk.Label(frame0, image=self.tkImage) self.image_ctl.pack(side=LEFT) self.pilImage2 = Image.open("pic/searchr.png") self.tkImage2 = ImageTk.PhotoImage(image=self.pilImage2) self.image_ctl2 = tk.Label(frame0, image=self.tkImage2) self.image_ctl2.pack(side=RIGHT) frame0.pack(side=TOP, fill=tk.Y, expand=1) frame4.pack(side=TOP, fill=tk.Y, expand=1) frame1.pack(side=TOP, fill=tk.Y, expand=1) frame2.pack(side=TOP, fill=tk.Y, expand=1) frame3.pack(side=TOP, fill=tk.Y, expand=1) self.label = ttk.Label(frame1, text='要查找的车牌') self.label.pack(side=LEFT) self.input1 = ttk.Entry(frame1, textvariable=self.s1, width=30) self.input1.pack(side=LEFT) self.face_button1 = ttk.Button(frame1, text="选择文件", width=15, command=self.file1) self.face_button1.pack(side=RIGHT) self.cut_ctrl2 = ttk.Button(frame1, text="截图选取", width=15, command=self.cut_pic1) self.cut_ctrl2.pack(side=RIGHT) self.label2 = ttk.Label(frame2, text='查找路径: ') self.label2.pack(side=LEFT) self.input2 = ttk.Entry(frame2, textvariable=self.s2, width=30) self.input2.pack(side=LEFT) self.face_button2 = ttk.Button(frame2, text="选择文件夹", width=15, command=self.file2) self.face_button2.pack(side=RIGHT) self.clean_button = ttk.Button(frame3, text="重置显示信息", width=15, command=self.cut_clean) self.clean_button.pack(side=LEFT) self.file_pic2_button = ttk.Button(frame3, text="快速识别", width=15, command=self.file_pic2) self.file_pic2_button.pack(side=LEFT) self.url_face_button = ttk.Button(frame3, text="停止识别", width=15, command=self.stop) self.url_face_button.pack(side=LEFT) self.file_pic_button = ttk.Button(frame3, text="开始识别", width=15, command=self.file_pic) self.file_pic_button.pack(side=RIGHT) self.match = ttk.Label(frame4, text='', font=('Times', '20')) self.match.pack() self.pack(fill=tk.BOTH, expand=tk.YES, padx="10", pady="10") self.predictor = predict.CardPredictor() self.predictor.train_svm()
def __init__(self, win): ttk.Frame.__init__(self, win) frame00 = ttk.Frame(self) frame0 = ttk.Frame(self) frame1 = ttk.Frame(self) frame2 = ttk.Frame(self) frame4 = ttk.Frame(self) frame5 = ttk.Frame(self) win.title("车牌认证系统") win.minsize(650, 570) self.s1 = StringVar() frame00.pack(side=TOP, fill=tk.Y, expand=1) frame0.pack(side=TOP, fill=tk.Y, expand=1) frame4.pack(side=TOP, fill=tk.Y, expand=1) frame1.pack(side=TOP, fill=tk.Y, expand=1) frame2.pack(side=TOP, fill=tk.Y, expand=1) frame5.pack(side=TOP, fill=tk.Y, expand=1) self.pilImage = Image.open("pic/identification.png") self.tkImage = ImageTk.PhotoImage(image=self.pilImage) self.image_ctl = ttk.Label(frame00, image=self.tkImage) self.image_ctl.pack(side=LEFT) self.text = ttk.Label(frame0, text='', font=('Times', '20')) self.text.pack() self.text2 = ttk.Label(frame4, text='', font=('Times', '20')) self.text2.pack() self.clean_button0 = ttk.Button(frame1, text="打开/关闭摄像头", width=15, command=self.video) self.clean_button0.pack(side=LEFT) self.url_face_button0 = ttk.Button(frame1, text="选择照片", width=15, command=self.pic) self.url_face_button0.pack(side=LEFT) self.input5 = ttk.Entry(frame2, textvariable=self.s1, width=23) self.input5.pack(side=LEFT) self.label5 = ttk.Button(frame2, text='添加认证', width=10, command=self.sql2) self.label5.pack(side=RIGHT) self.clean_button = ttk.Button(frame5, text="清除信息", width=15, command=self.clean) self.clean_button.pack(side=LEFT) self.url_face_button = ttk.Button(frame5, text="开始查询", width=15, command=self.sql) self.url_face_button.pack(side=LEFT) self.pack(fill=tk.BOTH, expand=tk.YES, padx="10", pady="10") self.center_window() self.pic_path = "" self.thread_run = False self.camera = None self.camera_flag = 0 self.thread_run2 = False self.create_sql2() self.predictor = predict.CardPredictor() self.predictor.train_svm()