forked from ageitgey/face_recognition
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
9 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -195,19 +195,19 @@ def show_prediction_labels_on_image(frame, predictions): | |
process_this_frame = 29 | ||
print('Setting cameras up...') | ||
# multiple cameras can be used with the format url = 'http://username:password@camera_ip:port' | ||
url1 = 'http://admin:[email protected]:8081/' | ||
cap1 = cv2.VideoCapture(url1) | ||
url = 'http://admin:[email protected]:8081/' | ||
cap = cv2.VideoCapture(url) | ||
while 1 > 0: | ||
ret1, frame1 = cap1.read() | ||
if ret1: | ||
ret, frame = cap.read() | ||
if ret: | ||
# Different resizing options can be chosen based on desired program runtime. | ||
img1 = cv2.resize(frame1, (0, 0), fx=0.5, fy=0.5) | ||
# Image resizing for more stable streaming | ||
img = cv2.resize(frame, (0, 0), fx=0.5, fy=0.5) | ||
process_this_frame = process_this_frame + 1 | ||
if process_this_frame % 30 == 0: | ||
predictions1 = predict(img1, model_path="trained_knn_model.clf") | ||
# Image resizing for more stable streaming | ||
frame1 = show_prediction_labels_on_image(frame1, predictions1) | ||
cv2.imshow('camera1', frame1) | ||
predictions = predict(img, model_path="trained_knn_model.clf") | ||
frame = show_prediction_labels_on_image(frame, predictions) | ||
cv2.imshow('camera', frame) | ||
if ord('q') == cv2.waitKey(10): | ||
cap1.release() | ||
cv2.destroyAllWindows() | ||
|