Sep-13-2019, 05:19 PM
I got it figured it out, and its working now! Thanks everybody for the help.
""" Importing libraries """ import cv2 import datetime import os """ Declaring variables """ cascPath = 'haarcascade_frontalface_default.xml' faceCascade = cv2.CascadeClassifier(cascPath) camera = cv2.VideoCapture('rtsp://ituser:[email protected]/mpeg4/media.amp') path = './Images' """ Do this while the camera is working """ while (camera.isOpened()): ret, frame = camera.read() gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) faces = faceCascade.detectMultiScale( gray, scaleFactor=1.2, minNeighbors=5, minSize=(30, 30) ) for (x, y, w, h) in faces: cv2.rectangle(frame, (x, y), (x + w, y + h), (0, 255, 255), 2) date = datetime.datetime.now() date = (date.strftime("%m-%d-%Y_%H%M%S")) jpeg = date + '.jpg' cv2.imwrite(os.path.join(path,jpeg), frame) cv2.imshow('SCA Server Room', frame) if cv2.waitKey(1) & 0xFF == ord('q'): break """ Finally, release the capture and close windows """ camera.release() cv2.destroyAllWindows()