Skip to content
Permalink
main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
import cv2
from deepface import DeepFace
url = "http://100.84.177.205:4747/video"
cap = cv2.VideoCapture(url)
while True:
ret, frame = cap.read()
cv2.imshow('Press Space to capture', frame)
if cv2.waitKey(1) & 0xFF == ord(' '): # Press space to capture
cv2.imwrite('./data/live_image.jpg', frame) # Save the captured image
break
cap.release()
cv2.destroyAllWindows()
obj = DeepFace.analyze(img_path="./data/live_image.jpg", actions=['age'])
print(obj)
age_restriction = 18
if obj[0]["age"] >= age_restriction:
print("Access granted.")
else:
print("Access denied. Age restriction not met.")