title
OpenCV Python Tutorial For Beginners 24 - Motion Detection and Tracking Using Opencv Contours

description
In this video on OpenCV Python Tutorial For Beginners, I am going to show How to Find Motion Detection and Tracking Using Opencv Contours. We will see what contours are. we will Learn to find contours, draw contours, we will see these functions : cv2.findContours(), cv2.drawContours(). In this project we are detecting and tracking motion using live sample video. The function retrieves contours from the binary image. The contours are a useful tool for shape analysis and object detection and recognition. Gist of code I used in this video (Motion Tracking and Detection Tutorial ) - https://gist.github.com/pknowledge/623515e8ab35f1771ca2186630a13d14 OpenCV is an image processing library created by Intel and later supported by Willow Garage and now maintained by Itseez. opencv is available on Mac, Windows, Linux. Works in C, C++, and Python. it is Open Source and free. opencv is easy to use and install. Starting with an overview of what the course will be covering, we move on to discussing morphological operations and practically learn how they work on images. We will then learn contrast enhancement using equalization and contrast limiting. Finally we will learn 3 methods to subtract the background from the video and implement them using OpenCV. At the end of this course, you will have a firm grasp of Computer Vision techniques using OpenCV libraries. This course will be your gateway to the world of data science. Feel the real power of Python and programming! The course offers you a unique approach of learning how to code by solving real world problems. #ProgrammingKnowledge #ComputerVision #OpenCV ★★★Top Online Courses From ProgrammingKnowledge ★★★ Python Programming Course ➡️ http://bit.ly/2vsuMaS ⚫️ http://bit.ly/2GOaeQB Java Programming Course ➡️ http://bit.ly/2GEfQMf ⚫️ http://bit.ly/2Vvjy4a Bash Shell Scripting Course ➡️ http://bit.ly/2DBVF0C ⚫️ http://bit.ly/2UM06vF Linux Command Line Tutorials ➡️ http://bit.ly/2IXuil0 ⚫️ http://bit.ly/2IXukt8 C Programming Course ➡️ http://bit.ly/2GQCiD1 ⚫️ http://bit.ly/2ZGN6ej C++ Programming Course ➡️ http://bit.ly/2V4oEVJ ⚫️ http://bit.ly/2XMvqMs PHP Programming Course ➡️ http://bit.ly/2XP71WH ⚫️ http://bit.ly/2vs3od6 Android Development Course ➡️ http://bit.ly/2UHih5H ⚫️ http://bit.ly/2IMhVci C# Programming Course ➡️ http://bit.ly/2Vr7HEl ⚫️ http://bit.ly/2W6RXTU JavaFx Programming Course ➡️ http://bit.ly/2XMvZWA ⚫️ http://bit.ly/2V2CoAi NodeJs Programming Course ➡️ http://bit.ly/2GPg7gA ⚫️ http://bit.ly/2GQYTQ2 Jenkins Course For Developers and DevOps ➡️ http://bit.ly/2Wd4l4W ⚫️ http://bit.ly/2J1B1ug Scala Programming Tutorial Course ➡️ http://bit.ly/2PysyA4 ⚫️ http://bit.ly/2PCaVj2 Bootstrap Responsive Web Design Tutorial ➡️ http://bit.ly/2DFQ2yC ⚫️ http://bit.ly/2VoJWwH MongoDB Tutorial Course ➡️ http://bit.ly/2LaCJfP ⚫️ http://bit.ly/2WaI7Ap QT C++ GUI Tutorial For Beginners ➡️ http://bit.ly/2vwqHSZ ★★★ Online Courses to learn ★★★ Get 2 FREE Months of Unlimited Classes from skillshare - https://skillshare.eqcm.net/r1KEj Data Science - http://bit.ly/2lD9h5L | http://bit.ly/2lI8wIl Machine Learning - http://bit.ly/2WGGQpb | http://bit.ly/2GghLXX Artificial Intelligence - http://bit.ly/2lYqaYx | http://bit.ly/2NmaPya MERN Stack E-Degree Program - http://bit.ly/2kx2NFe | http://bit.ly/2lWj4no DevOps E-degree - http://bit.ly/2k1PwUQ | http://bit.ly/2k8Ypfy Data Analytics with R - http://bit.ly/2lBKqz8 | http://bit.ly/2lAjos3 AWS Certification Training - http://bit.ly/2kmLtTu | http://bit.ly/2lAkQL1 Projects in Java - http://bit.ly/2kzn25d | http://bit.ly/2lBMffs Machine Learning With TensorFlow - http://bit.ly/2m1z3AF | http://bit.ly/2lBMhnA Angular 8 - Complete Essential Guide - http://bit.ly/2lYvYRP Kotlin Android Development Masterclass - http://bit.ly/2GcblsI Learn iOS Programming Building Advance Projects - http://bit.ly/2kyX7ue ★★★ Follow ★★★ My Website - http://www.codebind.com DISCLAIMER: This video and description contains affiliate links, which means that if you click on one of the product links, I’ll receive a small commission. This help support the channel and allows us to continue to make videos like this. Thank you for the support!

detail
{'title': 'OpenCV Python Tutorial For Beginners 24 - Motion Detection and Tracking Using Opencv Contours', 'heatmap': [{'end': 671.734, 'start': 637.769, 'weight': 0.889}], 'summary': 'Learn motion detection and object tracking in python using opencv to track and display rectangles around moving people, covering frame difference, grayscale conversion, contour detection, and achieving motion detection with contour area thresholds.', 'chapters': [{'end': 194.358, 'segs': [{'end': 58.711, 'src': 'embed', 'start': 0.922, 'weight': 0, 'content': [{'end': 5.907, 'text': 'hey guys, welcome to the next video on opencv tutorial for beginners using python.', 'start': 0.922, 'duration': 4.985}, {'end': 14.875, 'text': "in this video, i'm going to show you how you can create a very basic and simple motion detection and tracking system using python and opencv.", 'start': 5.907, 'duration': 8.968}, {'end': 20.479, 'text': 'So let me show you what we are going to achieve at the end of this video.', 'start': 16.015, 'duration': 4.464}, {'end': 25.882, 'text': 'So I have this video, which is a sample video.', 'start': 21.559, 'duration': 4.323}, {'end': 31.305, 'text': 'And you can see some people are walking around inside this video.', 'start': 26.602, 'duration': 4.703}, {'end': 41.334, 'text': 'Now what I want to do here is I want to show these rectangles around these moving people or persons.', 'start': 32.244, 'duration': 9.09}, {'end': 49.463, 'text': 'So this is tracking, and when some movement occurs, I also want to show this kind of status.', 'start': 42.095, 'duration': 7.368}, {'end': 53.867, 'text': 'that status is movement because somebody is moving inside the video.', 'start': 49.463, 'duration': 4.404}, {'end': 58.711, 'text': 'So if nobody is moving, the status will be blank.', 'start': 54.588, 'duration': 4.123}], 'summary': 'Create a basic motion detection and tracking system using python and opencv, showing rectangles around moving people and indicating movement status.', 'duration': 57.789, 'max_score': 0.922, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MkcUgPhOlP8/pics/MkcUgPhOlP8922.jpg'}, {'end': 126.967, 'src': 'embed', 'start': 92.02, 'weight': 1, 'content': [{'end': 100.867, 'text': 'So to start with, I have this basic code which just reads a video using video capture class.', 'start': 92.02, 'duration': 8.847}, {'end': 110.895, 'text': "And then if this video is valid, then I'm going to just show this frame by frame inside I'm sure window.", 'start': 101.447, 'duration': 9.448}, {'end': 117.68, 'text': "And I'm sure you might be knowing all this code because I've shown you, step by step,", 'start': 111.575, 'duration': 6.105}, {'end': 126.967, 'text': 'how to capture the video or how you can read the video frames using video capture method.', 'start': 117.68, 'duration': 9.287}], 'summary': 'Code reads and displays video frames using video capture class.', 'duration': 34.947, 'max_score': 92.02, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MkcUgPhOlP8/pics/MkcUgPhOlP892020.jpg'}], 'start': 0.922, 'title': 'Opencv motion detection and object tracking', 'summary': 'Focuses on creating a motion detection and tracking system in python using opencv to track and display rectangles around moving people in a video, with a status indication for movement, and introduces the objective of tracking individual movements and displaying rectangles around them using video capture method.', 'chapters': [{'end': 91.239, 'start': 0.922, 'title': 'Opencv motion detection tutorial', 'summary': 'Demonstrates how to create a basic motion detection and tracking system using python and opencv, aiming to track and display rectangles around moving people in a video, with a status indication for movement.', 'duration': 90.317, 'highlights': ['The tutorial focuses on creating a basic and simple motion detection and tracking system using Python and OpenCV.', 'The goal is to track and display rectangles around moving people in the video, along with a status indication for movement.', "The system will indicate 'movement' when somebody is moving inside the video and show a blank status when there is no movement."]}, {'end': 194.358, 'start': 92.02, 'title': 'Video frame tracking and object detection', 'summary': 'Demonstrates the basic code for reading a video frame by frame and introduces the objective of tracking the movement of individuals and displaying a rectangle around them using video capture method.', 'duration': 102.338, 'highlights': ["The code reads a video using video capture class and displays it frame by frame using the 'imshow' method.", 'The objective is to track the movement of individuals in the video and display a rectangle around them.', 'The chapter provides a step-by-step explanation of capturing video frames using the video capture method.']}], 'duration': 193.436, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MkcUgPhOlP8/pics/MkcUgPhOlP8922.jpg', 'highlights': ['The tutorial focuses on creating a basic and simple motion detection and tracking system using Python and OpenCV.', "The code reads a video using video capture class and displays it frame by frame using the 'imshow' method.", 'The goal is to track and display rectangles around moving people in the video, along with a status indication for movement.', 'The objective is to track the movement of individuals in the video and display a rectangle around them.', "The system will indicate 'movement' when somebody is moving inside the video and show a blank status when there is no movement.", 'The chapter provides a step-by-step explanation of capturing video frames using the video capture method.']}, {'end': 661.684, 'segs': [{'end': 222.7, 'src': 'embed', 'start': 194.778, 'weight': 0, 'content': [{'end': 206.445, 'text': "So, first of all I'm going to declare a variable diff and using cv2.abs diff method, so absolute difference.", 'start': 194.778, 'duration': 11.667}, {'end': 212.529, 'text': 'we are going to find out the difference between the first frame and the second frame.', 'start': 206.445, 'duration': 6.084}, {'end': 222.7, 'text': 'so this method, abs diff is for finding out the absolute difference between the first frame and the second frame.', 'start': 213.169, 'duration': 9.531}], 'summary': 'Using cv2.absdiff to find absolute difference between frames.', 'duration': 27.922, 'max_score': 194.778, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MkcUgPhOlP8/pics/MkcUgPhOlP8194778.jpg'}, {'end': 320.236, 'src': 'embed', 'start': 257.168, 'weight': 1, 'content': [{'end': 268.731, 'text': 'we are going to convert this BGR color to the grayscale mode and why we are finding out the grayscale mode of this diff?', 'start': 257.168, 'duration': 11.563}, {'end': 286.016, 'text': "because we are going to find out the contour in the later stages and in the last video we have learned that it's easier to find out the contours in the grayscale mode as compared to the colored mode or the BGR mode.", 'start': 268.731, 'duration': 17.285}, {'end': 295.039, 'text': 'So once we have this grayscale mode, we are going to just blur our grayscale frame.', 'start': 286.676, 'duration': 8.363}, {'end': 306.824, 'text': 'So we are going to just declare a variable called blur and then we are going to apply the Gaussian blur on our gray variable.', 'start': 295.239, 'duration': 11.585}, {'end': 311.367, 'text': 'So CV2 dot gaussian blur.', 'start': 306.864, 'duration': 4.503}, {'end': 314.891, 'text': 'the first parameter here will be gray.', 'start': 311.367, 'duration': 3.524}, {'end': 320.236, 'text': "so let's give this gray parameter which we have defined here.", 'start': 314.891, 'duration': 5.345}], 'summary': 'Converting bgr to grayscale for easier contour detection and applying gaussian blur.', 'duration': 63.068, 'max_score': 257.168, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MkcUgPhOlP8/pics/MkcUgPhOlP8257168.jpg'}, {'end': 413.805, 'src': 'embed', 'start': 350.011, 'weight': 3, 'content': [{'end': 362.015, 'text': 'And then the second variable will be thrash is equal to CV2 dot threshold and the first parameter which it takes is the source.', 'start': 350.011, 'duration': 12.004}, {'end': 373.1, 'text': 'so we are going to pass our blurred image as the source and then the second parameter here will be the threshold value.', 'start': 362.015, 'duration': 11.085}, {'end': 376.642, 'text': 'so we are going to just provide 20 here.', 'start': 373.1, 'duration': 3.542}, {'end': 381.284, 'text': 'then the maximum threshold value will be 255.', 'start': 376.642, 'duration': 4.642}, {'end': 386.87, 'text': 'Then the type will be cv2.threshBinary.', 'start': 381.284, 'duration': 5.586}, {'end': 394.517, 'text': 'So in the next step what we are going to do is we are going to dilate the thresholded image to fill in all the holes.', 'start': 386.97, 'duration': 7.547}, {'end': 398.861, 'text': 'This will help us to find out the better contours.', 'start': 394.957, 'duration': 3.904}, {'end': 401.542, 'text': 'So there is a method called cv2.dilate.', 'start': 399.201, 'duration': 2.341}, {'end': 408.843, 'text': 'So we are going to just declare a variable called dilated and then we are going to apply this method.', 'start': 401.562, 'duration': 7.281}, {'end': 413.805, 'text': 'So cv2.dilate which takes few arguments.', 'start': 408.863, 'duration': 4.942}], 'summary': 'Using cv2, applied threshold of 20 to blurred image for better contours.', 'duration': 63.794, 'max_score': 350.011, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MkcUgPhOlP8/pics/MkcUgPhOlP8350011.jpg'}, {'end': 552.924, 'src': 'embed', 'start': 521.573, 'weight': 5, 'content': [{'end': 528.694, 'text': 'so we are going to just say draw contours, and the first argument here will be frame one,', 'start': 521.573, 'duration': 7.121}, {'end': 534.415, 'text': 'because we want to apply all the contours on the original frame right.', 'start': 528.694, 'duration': 5.721}, {'end': 542.137, 'text': 'so we are going to apply all the contours which we have found using all these method on the frame one.', 'start': 534.415, 'duration': 7.722}, {'end': 552.924, 'text': 'then the second argument here will be the contour, so you can just give the contours here.', 'start': 542.957, 'duration': 9.967}], 'summary': 'Drawing contours on frame one using found methods.', 'duration': 31.351, 'max_score': 521.573, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MkcUgPhOlP8/pics/MkcUgPhOlP8521573.jpg'}, {'end': 661.684, 'src': 'embed', 'start': 637.769, 'weight': 6, 'content': [{'end': 649.957, 'text': 'So we are reading the new frame in the variable frame two and before reading the new frame we are assigning the value inside the frame two to the frame one.', 'start': 637.769, 'duration': 12.188}, {'end': 656.881, 'text': 'In this way, we are reading the two frames and finding out the difference between the two frames.', 'start': 650.277, 'duration': 6.604}, {'end': 660.103, 'text': "So let's run this code and let's see if it works or not.", 'start': 657.141, 'duration': 2.962}, {'end': 661.684, 'text': "Let's test this.", 'start': 660.764, 'duration': 0.92}], 'summary': 'Code reads two frames, compares them, and tests functionality.', 'duration': 23.915, 'max_score': 637.769, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MkcUgPhOlP8/pics/MkcUgPhOlP8637769.jpg'}], 'start': 194.778, 'title': 'Image processing fundamentals', 'summary': "Covers frame difference, grayscale conversion, image processing basics, contour detection, and frame comparison using opencv, including methods such as cv2.abs diff, gaussian blur, thresholding with 5x5 kernel and threshold value of 20, dilating images with 3 iterations, and finding contours with 'findcontours' method.", 'chapters': [{'end': 286.016, 'start': 194.778, 'title': 'Frame difference and grayscale conversion', 'summary': 'Explains how to find the absolute difference between two frames using cv2.abs diff method and then convert the difference into grayscale mode for easier contour detection.', 'duration': 91.238, 'highlights': ['The method cv2.abs diff is used to find the absolute difference between the first frame and the second frame, aiding in further processing (e.g., motion detection) (quantifiable data: method name, purpose)', 'The absolute difference obtained is then converted into grayscale mode using the cv2.cvtColor method, facilitating easier contour detection (quantifiable data: method name, purpose)']}, {'end': 442.111, 'start': 286.676, 'title': 'Image processing basics', 'summary': 'Discusses converting an image to grayscale, applying gaussian blur and thresholding to extract contours, including using a kernel size of 5x5 and a threshold value of 20, and dilating the thresholded image with 3 iterations.', 'duration': 155.435, 'highlights': ['Applying Gaussian blur with a kernel size of 5x5 and a sigma x value of 0 to the grayscale frame.', 'Thresholding the blurred image with a threshold value of 20 and a maximum threshold value of 255 using cv2.threshBinary.', 'Dilating the thresholded image with 3 iterations to fill in all the holes and improve contour detection.']}, {'end': 661.684, 'start': 442.191, 'title': 'Image processing: contour detection and frame comparison', 'summary': "Covers the process of finding contours in an image using the 'findcontours' method in opencv and applying the contours to the original frame with specific arguments, followed by reading and comparing two frames for differences in an image processing code.", 'duration': 219.493, 'highlights': ["The process involves finding contours using the 'findContours' method in OpenCV with specific arguments, such as mode and method, and drawing the contours on the original frame with specified color and thickness, potentially increasing or decreasing the number of iterations if needed.", 'The code involves reading and assigning values of two frames to find the difference between them, followed by testing the code for functionality and results.']}], 'duration': 466.906, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MkcUgPhOlP8/pics/MkcUgPhOlP8194778.jpg', 'highlights': ['The method cv2.abs diff is used to find the absolute difference between the first frame and the second frame, aiding in further processing (e.g., motion detection)', 'The absolute difference obtained is then converted into grayscale mode using the cv2.cvtColor method, facilitating easier contour detection', 'Applying Gaussian blur with a kernel size of 5x5 and a sigma x value of 0 to the grayscale frame', 'Thresholding the blurred image with a threshold value of 20 and a maximum threshold value of 255 using cv2.threshBinary', 'Dilating the thresholded image with 3 iterations to fill in all the holes and improve contour detection', "The process involves finding contours using the 'findContours' method in OpenCV with specific arguments, such as mode and method, and drawing the contours on the original frame with specified color and thickness, potentially increasing or decreasing the number of iterations if needed", 'The code involves reading and assigning values of two frames to find the difference between them, followed by testing the code for functionality and results']}, {'end': 1146.959, 'segs': [{'end': 697.914, 'src': 'embed', 'start': 662.245, 'weight': 4, 'content': [{'end': 671.734, 'text': 'So you can see now, there are these contours which are drawn around all the moving persons.', 'start': 662.245, 'duration': 9.489}, {'end': 679.083, 'text': 'Also, there are some contours which are drawn around this rope which is also moving right?', 'start': 672.335, 'duration': 6.748}, {'end': 690.109, 'text': 'So we have successfully determined the contours and we have already drawn these contours on the frame 1..', 'start': 679.643, 'duration': 10.466}, {'end': 693.671, 'text': 'But this was not the result we are looking for.', 'start': 690.109, 'duration': 3.562}, {'end': 697.914, 'text': 'We want to draw the rectangle around these moving persons.', 'start': 693.852, 'duration': 4.062}], 'summary': 'Contours drawn around moving persons and rope, aiming to draw rectangles.', 'duration': 35.669, 'max_score': 662.245, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MkcUgPhOlP8/pics/MkcUgPhOlP8662245.jpg'}, {'end': 974.885, 'src': 'embed', 'start': 947.359, 'weight': 1, 'content': [{'end': 956.221, 'text': 'Now, in the next step, we are going to just print some text on the image if some movement is observed.', 'start': 947.359, 'duration': 8.862}, {'end': 960.082, 'text': 'So we can just say CV2.putText.', 'start': 956.901, 'duration': 3.181}, {'end': 965.423, 'text': 'This also we have seen in the previous videos how to put text on an image.', 'start': 960.422, 'duration': 5.001}, {'end': 968.483, 'text': 'So this time the source will be our frame one.', 'start': 965.503, 'duration': 2.98}, {'end': 970.804, 'text': 'The second will be the text.', 'start': 969.024, 'duration': 1.78}, {'end': 974.885, 'text': "So we will just say status, let's say.", 'start': 970.964, 'duration': 3.921}], 'summary': 'Using cv2.puttext to print text on image when movement is observed.', 'duration': 27.526, 'max_score': 947.359, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MkcUgPhOlP8/pics/MkcUgPhOlP8947359.jpg'}, {'end': 1146.959, 'src': 'embed', 'start': 1097.057, 'weight': 0, 'content': [{'end': 1102.003, 'text': 'So in this case you can also increase the expected area.', 'start': 1097.057, 'duration': 4.946}, {'end': 1108.23, 'text': "Let's say we just want to find out the contours which are greater than 900.", 'start': 1102.023, 'duration': 6.207}, {'end': 1121.994, 'text': 'And we can now you can see these rectangles are drawn around these moving persons with the area which have the contour area more than 900.', 'start': 1108.23, 'duration': 13.764}, {'end': 1127.256, 'text': 'So you can remove these kind of noises from the frame using this area.', 'start': 1121.994, 'duration': 5.262}, {'end': 1143.014, 'text': 'So this was a very basic example how you can detect the motion and track your moving object inside your video using Python and OpenCV.', 'start': 1130.157, 'duration': 12.857}, {'end': 1146.959, 'text': "I hope you've enjoyed this video and I will see you in the next video.", 'start': 1143.554, 'duration': 3.405}], 'summary': 'Detect motion and track objects using python and opencv.', 'duration': 49.902, 'max_score': 1097.057, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MkcUgPhOlP8/pics/MkcUgPhOlP81097057.jpg'}], 'start': 662.245, 'title': 'Motion detection and object tracking', 'summary': 'Discusses motion detection and object tracking in videos using python and opencv, including contour iteration, bounding rect method, noise reduction, and achieving motion detection with contour area thresholds.', 'chapters': [{'end': 731.182, 'start': 662.245, 'title': 'Contour detection and noise removal', 'summary': 'Discusses the process of detecting contours around moving objects and removing noise, with a focus on drawing rectangles around the moving persons and removing unwanted contours.', 'duration': 68.937, 'highlights': ['Contours are drawn around all the moving persons, as well as around moving objects like a rope, with the aim to draw rectangles around the moving persons and remove unwanted contours.', 'The goal is to draw rectangles around the moving persons and remove noises, such as not drawing contours around the moving rope.']}, {'end': 1146.959, 'start': 731.182, 'title': 'Motion detection and object tracking', 'summary': 'Introduces how to detect and track moving objects in a video using python and opencv, including iterating over contours, applying bounding rect method, drawing rectangles, and putting text on the image to indicate movement, achieving noise reduction and motion detection with contour area thresholds.', 'duration': 415.777, 'highlights': ['The code iterates over all the contours in the video frame, applies the bounding rect method to obtain coordinates and dimensions of the contours, and then determines the area of the contour, drawing a rectangle if the area is greater than 700, achieving motion detection and tracking. (Relevant for motion detection and contour area thresholds)', 'By using the CV2.putText method, the code puts text on the image to indicate movement, specifying the text, position, font, color, and thickness, enhancing the visualization of motion detection results. (Relevant for indicating movement and enhancing visualization)', 'The chapter demonstrates how adjusting the contour area threshold, such as setting it to 900, can effectively remove noise and track moving objects with larger contour areas, providing a method for noise reduction and fine-tuning motion detection. (Relevant for noise reduction and fine-tuning motion detection)', 'The code provides a practical example of motion detection and object tracking using Python and OpenCV, showing the application of contour area thresholds to detect and track moving objects, offering a comprehensive overview of the motion detection process. (Relevant for practical application and comprehensive overview)']}], 'duration': 484.714, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/MkcUgPhOlP8/pics/MkcUgPhOlP8662245.jpg', 'highlights': ['The code provides a practical example of motion detection and object tracking using Python and OpenCV, showing the application of contour area thresholds to detect and track moving objects, offering a comprehensive overview of the motion detection process.', 'By using the CV2.putText method, the code puts text on the image to indicate movement, enhancing the visualization of motion detection results.', 'The chapter demonstrates how adjusting the contour area threshold, such as setting it to 900, can effectively remove noise and track moving objects with larger contour areas, providing a method for noise reduction and fine-tuning motion detection.', 'The code iterates over all the contours in the video frame, applies the bounding rect method to obtain coordinates and dimensions of the contours, and then determines the area of the contour, drawing a rectangle if the area is greater than 700, achieving motion detection and tracking.', 'Contours are drawn around all the moving persons, as well as around moving objects like a rope, with the aim to draw rectangles around the moving persons and remove unwanted contours.']}], 'highlights': ['The tutorial focuses on creating a basic and simple motion detection and tracking system using Python and OpenCV.', "The code reads a video using video capture class and displays it frame by frame using the 'imshow' method.", 'The method cv2.abs diff is used to find the absolute difference between the first frame and the second frame, aiding in further processing (e.g., motion detection)', 'The objective is to track the movement of individuals in the video and display a rectangle around them.', 'The code provides a practical example of motion detection and object tracking using Python and OpenCV, showing the application of contour area thresholds to detect and track moving objects, offering a comprehensive overview of the motion detection process.', 'By using the CV2.putText method, the code puts text on the image to indicate movement, enhancing the visualization of motion detection results.', "The system will indicate 'movement' when somebody is moving inside the video and show a blank status when there is no movement.", 'The chapter demonstrates how adjusting the contour area threshold, such as setting it to 900, can effectively remove noise and track moving objects with larger contour areas, providing a method for noise reduction and fine-tuning motion detection.', "The process involves finding contours using the 'findContours' method in OpenCV with specific arguments, such as mode and method, and drawing the contours on the original frame with specified color and thickness, potentially increasing or decreasing the number of iterations if needed", 'The code iterates over all the contours in the video frame, applies the bounding rect method to obtain coordinates and dimensions of the contours, and then determines the area of the contour, drawing a rectangle if the area is greater than 700, achieving motion detection and tracking.']}