
Master motion detection with Python and OpenCV via background subtraction and algorithms like temporal median filter, mog, gmm, and knn; build monitoring, social-distance, and vehicle-counting projects.
Learn the intuition behind background subtraction, identifying foreground objects by comparing video frames to a learned static background, and generating a foreground mask for monitoring, tracking, and counting.
Learn how temporal median filter builds a grayscale background model from multiple frames and detects motion by comparing current frames to the median background using thresholds.
Install and configure Anaconda and PyCharm to support your motion detection course work, creating isolated Conda environments with Python 3.10, and testing a simple project file in PyCharm Community Edition.
Implement a temporal median filter in Python using NumPy and OpenCV to build a background model from 25 randomly selected video frames and save the results.
Explore implementing a temporal median filter to build a background model from 25 random frames, comparing mean and median, and saving the median frame for later object detection.
Finish implementing the temporal median filter by converting the background model to grayscale, computing frame differences, applying threshold (including otsu), and writing a binary motion video.
Explore four background-subtraction algorithms—mog, gmc, knn, and cnt—learn how they model background, classify foreground, and compare results using Gaussian mixtures, Bayesian inference, and frame counting.
Learn image preprocessing with morphological operations like erosion and dilation to remove noise and sharpen images for robust motion detection, including opening, closing, gradients, and kernel design in OpenCV.
Implement and test motion-detection algorithms GMG, MOG2, KNN, and CNT in Python with OpenCV, and set up preprocessing kernels for dilation, opening, and closing.
Continue the implementation by creating a get filter function that applies morphological operations, including closing, opening, and dilation, using a get kernel and an iterations parameter with optional combined sequences.
Implement and compare MOG, MOG2, KNN, and CNT background subtractors in OpenCV, tuning history, thresholds, and shadow detection for reliable motion segmentation.
Test motion detection using python and OpenCV by implementing background subtraction with MOG, GMC, KNN, and CNT, capturing and resizing video frames, and displaying results with OpenCV windows.
Explore how to finish implementing background subtraction using MOG, GMG, KNN, and CNT in Python and OpenCV, compare results, and refine masks with dilation, closing, opening, and bitwise operations.
compare motion detection algorithms, including gmg, mog, mog2, and knn, using python and opencv by counting white pixels in each frame and exporting results to a csv.
Compare algorithm quality by counting white pixels per frame to quantify detected objects, group results by algorithm with pandas, and visualize a bar chart to identify the best performer.
This lecture compares the performance of OpenCV background subtraction algorithms by processing 250 frames and measuring time with tick count, finding CMT to be the fastest.
Start building a motion detection system in Python using OpenCV by implementing background subtraction with the Gmmg algorithm, applying morphological operations and median blur, then tracking objects through garden video.
Learn the intuition behind edge and contour detection in motion detection using Python and OpenCV, using retrieval modes, hierarchy, and contour approximation to outline animals and ignore inner features.
Finish implementing motion detection by using OpenCV to find external contours, compute contour areas, draw bounding rectangles and contours, and display motion detected overlays for a simple security system simulation.
Detect social distancing in videos using OpenCV with background subtraction and contour analysis, applying min and max area thresholds to flag close groups with on-screen warnings.
Implement a vehicle counter using Python and OpenCV to count cars and trucks within a region of interest, using centroids and a validator class to track object age.
Continue implementing the vehicle counter by reading video frames and selecting the region of interest. Use bounding box dimensions and min and max area thresholds to filter objects.
Count vehicles in a selected ROI using OpenCV and Python by detecting contours, calculating centroids, and applying max age and unique IDs to prevent double counting, with background subtraction.
Finish implementing car counting with a validator, tracking object centroids, updating positions, and counting cars as they cross the bottom line within the bounding box; delete objects to prevent re-counting.
Count vehicles in video streams by distinguishing cars and trucks using area thresholds, centroids, and OpenCV visualization, with background subtraction and adjustable region lines, and options to save results.
Explore background subtraction techniques with a temporal median filter, compare mog, gmg, knn, and more algorithms, and apply image processing through three projects: motion detection, social distancing, and vehicle counting.
Access AI Expert Academy’s online courses in artificial intelligence and data science, covering machine learning, deep learning, computer vision, and algorithms, with certificates and monthly updates.
Motion detection is a sub-area of Computer Vision that aims to identify motion in videos or in real time. This type of application can be very useful, especially for security systems, in which it is necessary to detect suspicious movements such as a thief trying to enter the house. There are several other applications, such as: traffic analysis on highways, people detection/counting, animal tracking, cyclist counting, among others. A traffic control system can use these techniques to identify the number of cars and trucks that pass through the highway daily and at certain times, so then it is possible to carry out a road maintenance plan.
In this course you will learn in practice how to use background subtraction algorithms to detect movements in videos, all step by step and using Python programming language! Check out the main topics you are going to learn, as well as the hands-on projects:
Basic theoretical intuition about the following background subtraction algorithms: Temporal Median Filter, MOG (Mixture of Gaussians), GMG (Godbehere, Matsukawa and Goldbert), KNN (K Nearest Neighbors) and CNT (Count)
Comparison of quality and performance of each algorithm
Practical project 1: motion detector to monitor environments
Practical project 2: social distancing detector to identify possible crowds of people
Practical project 3: car and truck counter on highways
At the end of the course, you will be able to create your own motion detection projects!