Я пытаюсь получить изображения из потокового видео и получаю его в течение нескольких минут, но затем получаю следующую ошибку: cv2.error: OpenCV (4.1.1) C: \ projects \ opencv-python\ opencv \ modules \ imgproc \ src \ resize.cpp: 3720: ошибка: (-215: утверждение не выполнено)! ssize.empty () в функции 'cv :: resize' Мой код:
while True:
ret, frame = video_capture.read()
small_frame = cv2.resize(frame, (0, 0), fx=0.25, fy=0.25)
rgb_small_frame = small_frame[:, :, ::-1]
#
if process_this_frame:
face_locations = face_recognition.face_locations(rgb_small_frame, number_of_times_to_upsample=2)
face_encodings = face_recognition.face_encodings(rgb_small_frame, face_locations)
face_names = []
for face_encoding in face_encodings:
matches = face_recognition.compare_faces(known_face_encodings, face_encoding)
name = "None"
# #
# if True in matches:
# first_match_index = matches.index(True)
# name = known_face_names[first_match_index]
face_distances = face_recognition.face_distance(known_face_encodings, face_encoding)
best_match_index = np.argmin(face_distances)
if matches[best_match_index]:
name = known_face_names[best_match_index]
face_names.append(name)
if matches[best_match_index]:
adicionar_json()
process_this_frame = not process_this_frame
font = cv2.FONT_ITALIC
for (top, right, bottom, left), name in zip(face_locations, face_names):
top *= 4
right *= 4
bottom *= 4
left *= 4
Я пытаюсь получить потоковое видео с камеры rtsp