-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.py
More file actions
27 lines (23 loc) · 862 Bytes
/
example.py
File metadata and controls
27 lines (23 loc) · 862 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from tkinter import simpledialog
import tkinter
import cv2 as cv
import CreateDatabase
import EigenfaceCore
import Recognition
tk = tkinter.Tk()
tk.withdraw()
num = simpledialog.askinteger('Input of PCA-Based Face Recognition System', prompt='Enter test image name (a number between 1 to 10):', initialvalue=1, minvalue=1, maxvalue=10)
TestImage = num
TestImage = 'TestDatabase' + '/' + str(TestImage) + '.jpg'
im = cv.imread(TestImage)
T = CreateDatabase.CreateDatabase('TrainDatabase')
m, A, Eigenfaces = EigenfaceCore.EigenfaceCore(T)
OutputName = Recognition.Recognition(TestImage, m, A, Eigenfaces)
SelectedImage = 'TrainDatabase' + '/' + OutputName
SelectedImage = cv.imread(SelectedImage)
cv.imshow('Test Image', im)
cv.imshow('Equivalent Image', SelectedImage)
cv.waitKey(0)
cv.destroyAllWindows()
str = 'Matched image is :' + OutputName
print(str)