added flask framework, tambah karyawan page, scan absensi,and tambah karyawan open cv

This commit is contained in:
Naufalakram
2023-11-07 04:17:14 +08:00
parent 7a6ce35ef2
commit 23aec5c980
3186 changed files with 665236 additions and 44 deletions

37
app.py
View File

@ -1,32 +1,19 @@
import face_recognition
import cv2
import os
image_load = 'image1.jpg'
# image_data = 'faces/rika.png'
image_data = 'faces/rika.png'
# Open a video capture object
cap = cv2.VideoCapture(0)
# Load the images
image_load_path = os.path.join(os.getcwd(), image_load)
image_data_path = os.path.join(os.getcwd(), image_data)
image_load = face_recognition.load_image_file(image_load_path)
image_data = face_recognition.load_image_file(image_data_path)
while(True):
# Capture frame-by-frame
ret, frame = cap.read()
# Find the face locations and encodings in each image
image_load_face_locations = face_recognition.face_locations(image_load)
image_load_face_encodings = face_recognition.face_encodings(image_load, image_load_face_locations)
image_data_face_locations = face_recognition.face_locations(image_data)
image_data_face_encodings = face_recognition.face_encodings(image_data, image_data_face_locations)
# Display the resulting frame
cv2.imshow('frame',frame)
# Compare the face encodings
matches = face_recognition.compare_faces(image_data_face_encodings, image_load_face_encodings[0])
# Break the loop on 'q' key press
if cv2.waitKey(1) & 0xFF == ord('q'):
break
# Draw boxes around the faces in the image_load image
for (top, right, bottom, left), match in zip(image_load_face_locations, matches):
if match:
cv2.rectangle(image_load, (left, top), (right, bottom), (0, 0, 255), 2)
# Display the image with the boxes around the matching faces
cv2.imshow('Image', image_load)
cv2.waitKey(0)
# When everything done, release the capture and destroy the window
cap.release()
cv2.destroyAllWindows()