コード例 #1
0
 def __create_camera(video_file_or_camera, fps, width, height):
     """Create the appropriate class using opencv or the raspberry Pi piCamera"""
     # For files nor non raspberry pi devices, use opencv, for real-time video on raspberry pi, use CameraRaspbian
     if os.path.isfile("/etc/rpi-issue") and video_file_or_camera == 0:
         return RaspberianGrabber(cv2, fps, width, height)
     else:
         return FrameGrabber(cv2, fps, width, height)
コード例 #2
0
def create_camera(video_file_or_camera, fps, width, height, logger):
    # For video files nor non raspberry pi devices, use open cv, for real-time video on raspberry pi, use CameraRaspbian
    if os.path.isfile("/etc/rpi-issue") and video_file_or_camera == 0:
        return RaspberianGrabber(cv2, fps, width, height, logger,
                                 video_file_or_camera)
    else:
        return FrameGrabber(cv2, fps, width, height, logger,
                            video_file_or_camera)
コード例 #3
0
from face_detector import FaceDetector
from frame_grabber import FrameGrabber
from imutils.video import FPS
import imutils
import datetime
import cv2

SHOW_GUI = True

left_offsetX = 900
right_offsetX = 1600
up_offsetY = 550
down_offsetY = 1350

# Start videostream, 0 for webcam, 1 for rtsp
frame_grabber = FrameGrabber(1)
frame_grabber.start()

# Initialize motion detector
motion_detector = MotionDetector()
num_frame_read = 0  # no. of frames read

# Initialize face detector
face_detector = FaceDetector()

# FPS calculation
fps = FPS().start()

print("[INFO] Start collecting face images.")

while True: