Как соединить этот файл python с html файлом с помощью django? Пожалуйста, скажите мне, что я должен делать дальше? Я создаю распознавание лиц с помощью opencv в django.
import cv2 из time import sleep
def capturewebcam(image):
key = cv2. waitKey(1)
webcam = cv2.VideoCapture(0)
sleep(2)
while True:
try:
check, frame = webcam.read()
print(check) # prints true as long as the webcam is running
print(frame) # prints matrix values of each framecd
cv2.imshow("Capturing", frame)
key = cv2.waitKey(1)
if key == ord('s'):
cv2.imwrite(filename='studnet_images/saved_img.jpg', img=frame)
webcam.release()
print("Processing image...")
img_ = cv2.imread('saved_img.jpg', cv2.IMREAD_ANYCOLOR)
print("Image saved!")
break
elif key == ord('q'):
webcam.release()
cv2.destroyAllWindows()
break
except(KeyboardInterrupt):
print("Turning off camera.")
webcam.release()
print("Camera off.")
print("Program ended.")
cv2.destroyAllWindows()
break
Я пытался много раз, но не могу понять. Пожалуйста, помогите мне решить эту проблему.