Python Code:
from tkinter import*
import tkinter
root=Tk()
root.geometry("1600x800+0+0")
root.title("DIGIT RECOGNIZATION")
w = Label(root,text="DIGIT RECOGNIZATION",bg="blue",fg="white",height=2,width=1000,font="Arial 20 bold").pack(side=TOP)
canvas = Canvas(root, width = 1350, height = 600)
canvas.pack()
img = PhotoImage(file="image/test.png")
canvas.create_image(5,5, anchor=NW, image=img)
# Doctor Menu Start
def adminsignup():
filewin = Toplevel(root)
filewin.title("DIGIT RECOGNIZATION")
w = Label(filewin,text="DIGIT RECOGNIZATION",bg="blue",fg="white",font="Arial 10 bold").pack(side=TOP)
list1 = ["ID :", "PASSWORD :"]
L1=Label(filewin,text=list1[0],font="Arial 12 bold")
L1.pack()
E1 = Entry(filewin, bd =5)
E1.pack()
L2=Label(filewin,text=list1[1],font="Arial 12 bold")
L2.pack()
E2 = Entry(filewin, bd =5)
E2.pack()
def callback():
E3=E1.get()
E4=E2.get()
E5=E3
E5="saran"
E6=E4
E6="bala"
if E3==E5 and E4==E6:
filewin = Toplevel(root)
filewin.title("DIGIT RECOGNIZATION")
s= Label(filewin,text="DIGIT RECOGNIZATION",bg="blue",fg="white",font="Arial 10 bold").pack(side=TOP)
L6=Label(filewin,text="successfully Login")
L6.pack()
b1= Button(filewin,text="Handwritten Digit recognition ", width=50,bd=10,command=Appoint)
b1.pack()
else:
filewin = Toplevel(root)
filewin.title("DIGIT RECOGNIZATION")
s= Label(filewin,text="DIGIT RECOGNIZATION",bg="blue",fg="white",font="Arial 10 bold").pack(side=TOP)
L7=Label(filewin,text="Login Unsuccessful")
L7.pack()
b = Button(filewin,text="get", width=10,command=callback)
b.pack()
def Appoint():
from sklearn import datasets
from sklearn.svm import SVC
from scipy import misc
import tkinter
import cv2
import glob
filewin = Toplevel(root)
digits = datasets.load_digits()
features = digits.data
labels = digits.target
clf = SVC(gamma = 0.001)
clf.fit(features, labels)
path = "img\*.*"
for file in glob.glob(path):
print(file)
a= cv2.imread(file)
print(a)
c = cv2.cvtColor(a, cv2.COLOR_BGR2RGB)
cv2.imshow('Color image', c)
img = misc.imread(file)
img = misc.imresize(img, (8,8))
img = img.astype(digits.images.dtype)
img = misc.bytescale(img, high=16, low=0)
x_test = []
for eachRow in img:
for eachPixel in eachRow:
x_test.append(sum(eachPixel)/3.0)
print(clf.predict([x_test]))
L7=Label(filewin,text=clf.predict([x_test]))
L7.pack()
menubar = Menu(root)
Adminmenu = Menu(menubar, tearoff=0)
Adminmenu.add_command(label="SignUp", command=adminsignup)
Adminmenu.add_separator()
Adminmenu.add_command(label="Exit", command=root.quit)
menubar.add_cascade(label="ADMIN", menu=Adminmenu)
root.config(menu=menubar)
# Doctor Menu End
root.mainloop()
Output:
Code & Concept Copyrights@Saravanakumar from psktechnology
Comments
Post a Comment