'Face-Recognition OpenCV Python

Guys I am having a problem with FaceRec in python please help

main.py = https://pastebin.com/ST7DzBn4
simpleFaceRec = https://pastebin.com/a6aUVUbD

Error:

Traceback (most recent call last):
  File "E:\Documents\Python\FaceRecognitionOS\main.py", line 16, in <module>
    face_locations, face_names = sfr.detect_known_faces(frame)
  File "E:\Documents\Python\FaceRecognitionOS\simple_facerec.py", line 47, in detect_known_faces
    small_frame = cv2.resize(frame, (0, 0), fx=self.frame_resizing, fy=self.frame_resizing)
cv2.error: OpenCV(4.5.5) D:\a\opencv-python\opencv-python\opencv\modules\imgproc\src\resize.cpp:4052: error: (-215:Assertion failed) !ssize.empty() in function 'cv::resize'


Solution 1:[1]

In line 9 change this:

cap = cv2.VideoCapture(2)

to:

cap = cv2.VideoCapture(0)

And also this line 12:

while True:

to:

while cap.isOpened()

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 toyota Supra