

COLOR_RGB2GRAY ) # detect people in the image # returns the bounding boxes for the detected objects boxes, weights = hog. resize ( frame, ( 640, 480 )) # using a greyscale picture, also for faster detection gray = cv2. read () # resizing for faster detection frame = cv2. , ( 640, 480 )) while ( True ): # Capture frame-by-frame ret, frame = cap. VideoCapture ( 0 ) # the output will be written to output.avi out = cv2. startWindowThread () # open webcam video stream cap = cv2.

HOGDescriptor_getDefaultPeopleDetector ()) cv2. # import the necessary packages import numpy as np import cv2 # initialize the HOG descriptor/person detector hog = cv2. If you know how to use the command line, you can install them by typing: If not, you can follow these instructionsĪdd the following packages to anaconda: opencv numpy matplotlib I assume that you have already installed anaconda for python 3.X. That's actually where I first got in touch with OpenCV! The very nice blog from Adrian Rosebrock. Here are a few random things that you can do with it: Is the open source computer vision library, and it's super powerful. How to write a small script to perform person detection in a video stream from your webcam, or in one of your movies, with the HOG algorithm (Histograms of Oriented Gradients) How to install OpenCV, which provides simple tools for video input and output, and for machine learning Instead, we will use simple machine learning tools that can be evaluated really fast on a CPU. So they are certainly not adequate if your goal is to build a small home surveillance system that's running all the time. And for real time detection, one needs to go down to 40 ms / image or less, to be able to process video streams at 24 images / s.Īlso, powerful deep learning workstations are expensive, and they consume a lot of power. However, even with a GeForce GTX 1080 Ti, it takes 200 ms to detect objects in a single image.

YOLOv3 is the state-of-the-art object detection algorithm: It is very accurate and fast when evaluated on powerful GPUs, compared to other algorithms. Neural network, pre-trained to detect and identify objects in 80 categories (person, car, truck, potted plant, giraffe. , we have seen how to use deep learning to detect objects in an image. Today, we will write a program that can detect people in a video stream, almost in real-time (it will depend on how fast your CPU is.)
