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

  Рет қаралды 238,134

ProgrammingKnowledge

ProgrammingKnowledge

Күн бұрын

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 ) - gist.github.com/pknowledge/62...
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 ➡️ bit.ly/2vsuMaS ⚫️ bit.ly/2GOaeQB
Java Programming Course ➡️ bit.ly/2GEfQMf ⚫️ bit.ly/2Vvjy4a
Bash Shell Scripting Course ➡️ bit.ly/2DBVF0C ⚫️ bit.ly/2UM06vF
Linux Command Line Tutorials ➡️ bit.ly/2IXuil0 ⚫️ bit.ly/2IXukt8
C Programming Course ➡️ bit.ly/2GQCiD1 ⚫️ bit.ly/2ZGN6ej
C++ Programming Course ➡️ bit.ly/2V4oEVJ ⚫️ bit.ly/2XMvqMs
PHP Programming Course ➡️ bit.ly/2XP71WH ⚫️ bit.ly/2vs3od6
Android Development Course ➡️ bit.ly/2UHih5H ⚫️ bit.ly/2IMhVci
C# Programming Course ➡️ bit.ly/2Vr7HEl ⚫️ bit.ly/2W6RXTU
JavaFx Programming Course ➡️ bit.ly/2XMvZWA ⚫️ bit.ly/2V2CoAi
NodeJs Programming Course ➡️ bit.ly/2GPg7gA ⚫️ bit.ly/2GQYTQ2
Jenkins Course For Developers and DevOps ➡️ bit.ly/2Wd4l4W ⚫️ bit.ly/2J1B1ug
Scala Programming Tutorial Course ➡️ bit.ly/2PysyA4 ⚫️ bit.ly/2PCaVj2
Bootstrap Responsive Web Design Tutorial ➡️ bit.ly/2DFQ2yC ⚫️ bit.ly/2VoJWwH
MongoDB Tutorial Course ➡️ bit.ly/2LaCJfP ⚫️ bit.ly/2WaI7Ap
QT C++ GUI Tutorial For Beginners ➡️ bit.ly/2vwqHSZ
★★★ Online Courses to learn ★★★
Get 2 FREE Months of Unlimited Classes from skillshare - skillshare.eqcm.net/r1KEj
Data Science - bit.ly/2lD9h5L | bit.ly/2lI8wIl
Machine Learning - bit.ly/2WGGQpb | bit.ly/2GghLXX
Artificial Intelligence - bit.ly/2lYqaYx | bit.ly/2NmaPya
MERN Stack E-Degree Program - bit.ly/2kx2NFe | bit.ly/2lWj4no
DevOps E-degree - bit.ly/2k1PwUQ | bit.ly/2k8Ypfy
Data Analytics with R - bit.ly/2lBKqz8 | bit.ly/2lAjos3
AWS Certification Training - bit.ly/2kmLtTu | bit.ly/2lAkQL1
Projects in Java - bit.ly/2kzn25d | bit.ly/2lBMffs
Machine Learning With TensorFlow - bit.ly/2m1z3AF | bit.ly/2lBMhnA
Angular 8 - Complete Essential Guide - bit.ly/2lYvYRP
Kotlin Android Development Masterclass - bit.ly/2GcblsI
Learn iOS Programming Building Advance Projects - bit.ly/2kyX7ue
★★★ Follow ★★★
My Website - 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!

Пікірлер: 217
@efekanefe442
@efekanefe442 4 жыл бұрын
You gave me hope dude.You are the man!Thank you so much for helping us about the topics that we can't easily learn from anybody.
@gyghfhyh7439
@gyghfhyh7439 Жыл бұрын
abi merhaba. Bir projeniz mi vardı? Neden ihtiyacınız oldu acaba bu tutoriallara? Şuanda bir bitirme projem var da, bende bu videoların içersinde kaybolmuş durumdayım.
@sauravsutradhar1395
@sauravsutradhar1395 4 жыл бұрын
You can change the thresh value in threshold function which eradicates the noise generated by the rope movement behind. I found a value of thresh=50 which worked fine for this input.
@peacecyebukayire5316
@peacecyebukayire5316 3 жыл бұрын
I've loved the video already before I even watch it a second:)
@kieno5754
@kieno5754 4 жыл бұрын
Thanks for this great tutuorial!
@jhonjaguer1488
@jhonjaguer1488 4 жыл бұрын
yhank you god bless you. you are the best teacher. you helpt me a lot
@myetis1990
@myetis1990 5 жыл бұрын
if you watch previous tutorials you will understand what is happening behind syntax briefly, first step, movement is difference between two frames second, difference has noises because of details and light on video so gaussian blurring is eliminating the noises, third, obtaining threshold from clean difference fourth, dilating for eliminating district small weak threshold lines which corrupt healthy threshold detection fifth, finding contours from clean threshold sixth, eliminating small contours which can not be a human by filtering contour area seventh, drawing rectangles for each detected contour on the frame, rectangle dimensions obtained from cv2.boundingRect(contour) that is it!
@omgleowtf
@omgleowtf 4 жыл бұрын
Cool, nice quick explanation, thanks!
@kunalgurtatta1813
@kunalgurtatta1813 4 жыл бұрын
Thanks for the simple explanation !
@emnaguermazi9406
@emnaguermazi9406 4 жыл бұрын
Great explanation
@jayasreegubbala3514
@jayasreegubbala3514 4 жыл бұрын
can you send the previous videos link
@kumarabhishek5652
@kumarabhishek5652 4 жыл бұрын
plz explain 6th point. where to look for. my code is still recognizing contour over ropes. ps: i am also getting this error: error: OpenCV(4.2.0) C:\projects\opencv-python\opencv\modules\core\src\arithm.cpp:669: error: (-209:Sizes of input arguments do not match) The operation is neither 'array op array' (where arrays have the same size and the same number of channels), nor 'array op scalar', nor 'scalar op array' in function 'cv::arithm_op'
@pedro_pinheiro
@pedro_pinheiro 3 жыл бұрын
Great video! Thank you for sharing!
@dhruuvvvv
@dhruuvvvv 5 жыл бұрын
Pls upload tutorial on creating own haar cascade classifier
@MarcosGarcia-mc8oj
@MarcosGarcia-mc8oj Жыл бұрын
Thanks for making these videos so easy to follow.
@myetis1990
@myetis1990 5 жыл бұрын
By evaluating the aspect ratio of each rectangle , we can determine whether it is a person or not. if Height/Width >1 then it may be a person elif Height/Width
@ayy4703
@ayy4703 4 жыл бұрын
Thanks :D
@HM-cw8im
@HM-cw8im 3 жыл бұрын
Thank you so much for this awesome tutorial!!
@HM-cw8im
@HM-cw8im 3 жыл бұрын
@Karaoke By K Thank you!
@anirudhkumar7477
@anirudhkumar7477 11 ай бұрын
That was amazing! Thank you so much
@umarqureshi2650
@umarqureshi2650 3 жыл бұрын
I added edited this line with w>h which makes sure no box with a width greater then its height will be detected (which helps with the rope not being detected): if cv2.contourArea(contour) < 900 or w > h:
@vigneshkathirkamar3113
@vigneshkathirkamar3113 4 жыл бұрын
how to select the "thresh" argument for cv2.threshold(). In this video it is mentioned as 20. Is there any criteria for arriving at a value?
@darshitjain5965
@darshitjain5965 4 жыл бұрын
Great Video!! Is there a way to use the concept in the video to count the number of people in the test-video??
@adrien123_
@adrien123_ 4 жыл бұрын
Hi, I'm developing a python speed tracking project and your video taught me a lot... Could I copy a part of your script to implement it in my project ? that would be cool...
@jonatapaulino
@jonatapaulino Жыл бұрын
Very good explanation. Congratulations. Do you have a video that counts these people after detection? Thanks for the video.
@menakakonara7957
@menakakonara7957 4 жыл бұрын
Really helpful,Thanks
@jadavpur4
@jadavpur4 3 жыл бұрын
Hi... Thank you for the tutorial.. It's impressive. I have one question. Can we make the animation of moving objects a function of time? the program will run and continuous animation will run??? Thank you
@chiral4055
@chiral4055 5 жыл бұрын
Thanks for this great tutuorial.
@ravenfly2739
@ravenfly2739 2 жыл бұрын
Thanks for that very helpful Video.
@redzalmahdin3477
@redzalmahdin3477 3 жыл бұрын
Thank you for the tutorial, I am curious, is it possible to use a stream video as the source video? if yes, how is it can be achieve?
@DecodingComputers
@DecodingComputers 5 жыл бұрын
Good tutorial
@elizabethsalas830
@elizabethsalas830 4 жыл бұрын
Hi, would this work to track multiple markers on a segmented object?
@logicawe
@logicawe 5 жыл бұрын
This is very inspiring content. Thank you for sharing.
@paterfamiliasgeminusiv4623
@paterfamiliasgeminusiv4623 3 жыл бұрын
Interesting. How could we differentiate between actual movement and camera movement?
@rakshitharakshi5968
@rakshitharakshi5968 4 жыл бұрын
can u tell me which algorithm ur using
@user-ge7jv6ed9d
@user-ge7jv6ed9d Жыл бұрын
Can you use this to create data points (X,Y) for that movement every second for example?
@diegoruza3732
@diegoruza3732 4 жыл бұрын
Hi. Thanks so much for this tutorial. It helps me a lot. Could you please show us how to take a screenshot of the frame when capture motion?
@guseechka
@guseechka 4 жыл бұрын
Did u resolve this question?
@osmanhussain6715
@osmanhussain6715 4 жыл бұрын
how can i know the area limit of small objects(here it was 700 or 900)
@mirzaabdulrehman428
@mirzaabdulrehman428 3 жыл бұрын
its worked thanks..
@riyushachannel4761
@riyushachannel4761 2 жыл бұрын
Work gan 👍🏻 ,thanks 🙏🙏 (Auto subscribe)
@muhammaddawoodarsalan5416
@muhammaddawoodarsalan5416 2 жыл бұрын
thanks dude appreciate it
@antoninsoulier6391
@antoninsoulier6391 Жыл бұрын
Thank you !
@aacasd
@aacasd 3 жыл бұрын
Which database would you prefer to store the data about a person, trace and time they were present in this video?
@nvdhairi
@nvdhairi 4 жыл бұрын
Can i know what is the difference between motion detection and object detection? Does it have differences?
@Anon-atg
@Anon-atg 3 жыл бұрын
You my friend are a legend
@Anon-atg
@Anon-atg 3 жыл бұрын
Super helpful guide, was looking for an input into my KcF tracker that wasn’t the traditional selectROI so used this and outputted the bounding boxes once they fitted my parameters
@umutcoskun4247
@umutcoskun4247 5 жыл бұрын
Thank you for this video. Question: Why are you showing frame1 and not frame2? Because frame2 should be closer to realtime picture
@Ghkfdvbj
@Ghkfdvbj 4 жыл бұрын
Hi, drawing contours ( or rectangles ) on frame is nothing but changing the frame itself. if we draw contours on frame2, in the next iteration frame2 will be frame1 and which not the original frame of video, its modified ( contours written frame) .
@TuanNguyen-wo2zq
@TuanNguyen-wo2zq 4 жыл бұрын
Can I ask if this is real-time or it has some delay? If delay, how much time does it behind from the real-time? Thank you
@theaveragepineapple8967
@theaveragepineapple8967 3 жыл бұрын
If you still want to know very minimal delay if any on my code from my web cam don’t notice any
@shaikhjunaid5577
@shaikhjunaid5577 2 жыл бұрын
I want to change my rectangle frame as im using live webcam and the previous code has (frame,(x,y),(x+w,y+h),(0,225,225),2) What values should i pick tor my live wecam so that full body can be detected
@ayushagarwal69
@ayushagarwal69 3 жыл бұрын
Awesome tutorial sir , althought harr cascade would be better
@shashanksharmadon4295
@shashanksharmadon4295 4 жыл бұрын
thanks bro........
@Kpsr
@Kpsr 4 жыл бұрын
i translated it all to C++ and it is compiling but unfortunately there is no contours drew edit: after debugging i realized that contours are shown only at first frame edit2: okay so after my investigation i found out that in C++ there might be a problem with "=" operator for Mat class and frame1=frame2 isnt working propely. i had to replace it for frame1=frame2.clone()
@anishbhurke847
@anishbhurke847 4 жыл бұрын
can we raise an alarm through code if any person comes near the lamppost ?? can u guide on same ??
@naveenbm3729
@naveenbm3729 2 жыл бұрын
Can you please let me know what is the unit for the area of rectangle you r using, for example 700…. Is it 700 mm^2 ? How can I get to know?
@mtkavak
@mtkavak 2 жыл бұрын
Thank you, how about consecutive images?
@antislit_4938
@antislit_4938 4 жыл бұрын
Do I need to use a avi can this work with mp4 i tried it but it doesn't work why is this
@gustavodslara
@gustavodslara 2 жыл бұрын
is it possible to do with real time video streamming? example: from my security cam
@mujeebsonlineacademy7962
@mujeebsonlineacademy7962 2 ай бұрын
which camera and components u have used for implementing as a hardware
@rohanverma321
@rohanverma321 4 жыл бұрын
Hey ! Where can I get a similar video?
@berberlim
@berberlim 2 жыл бұрын
Thank you so much bro your really helped me, you made my day
@justanothergoogleuser
@justanothergoogleuser 2 жыл бұрын
Hi! How to download/get the video mentioned in this video
@berberlim
@berberlim 2 жыл бұрын
@@justanothergoogleuser I used my own video
@abhijeetmandal434
@abhijeetmandal434 5 жыл бұрын
Super
@loektenbosch8110
@loektenbosch8110 3 жыл бұрын
After line 15, I get the following error: "ValueError: too many values to unpack (expected 2). The same as in the previous video where this technique is also used. Who can help me / point me in the right direction (yes, I already used Google).
@SadatSafawi
@SadatSafawi 3 жыл бұрын
how to see the accuracy of this code ?? Please help me with this
@ojoj335
@ojoj335 4 жыл бұрын
Thanks, great tutorial!!! Im trying to capture a window or part of the screen, is it possible to put this through cv2.videoCapture() ?
@sarathram3312
@sarathram3312 3 жыл бұрын
Why are we assigning frame2 to frame1 while drawing contours and again reading a new frame in frame2??
5 жыл бұрын
Hi, thanks for project but how can i change sensitivity?
@franklinjoe52
@franklinjoe52 3 жыл бұрын
You can do a lot of things such as tweaking the contour area selection. Turning it down from 700 will make it more sensitive to smaller movements and turning it up will make it less. Also, tweaking the minimum threshold in line 13 will tune it too
@philspaghet
@philspaghet 4 жыл бұрын
Top tip: replace 'vtest.avi' with '0' to use your native webcam!
@brainibruno1796
@brainibruno1796 4 жыл бұрын
yes but please without those ' ' , so just write cap = cv2.VideoCapture(0)
@mekukun4406
@mekukun4406 3 жыл бұрын
Hi! Where can I get the sample video shown in this video ?
@prasanthjavvaji
@prasanthjavvaji 3 жыл бұрын
How can I get the video file that have been given as input
@kraskagm
@kraskagm 4 жыл бұрын
When it is taking difference between two frames, shouldn't it be 0 because the same video input is used(captured)?
@anirudhpai5617
@anirudhpai5617 4 жыл бұрын
I do believe it is taking two frames directly one after the other.
@harshvirtomar6552
@harshvirtomar6552 4 жыл бұрын
Can I run it on collab?
@mvp2372
@mvp2372 2 жыл бұрын
Hello. Can it be applied when we are watching any video online?
@sidranasreen7932
@sidranasreen7932 10 ай бұрын
Can you provide the video which you have used in your code. Also can you please explain why have you used frame1
@Tushar-481
@Tushar-481 4 жыл бұрын
The approach is very excellent but the algorithm won't work if the people are not moving cuz when they will stop moving the will be no difference between two consecutive frames hence it won't detect the person. CAN U FIX THIS PROBLEM?
@mmtimberframing
@mmtimberframing 5 жыл бұрын
Got it to work, but unable to save the output. Can you please share where I would insert this within this particular source code?
@Ghkfdvbj
@Ghkfdvbj 4 жыл бұрын
Hi, Can you please try this below two lines before the while loop 1) fourcc = cv2.VideoWriter_fourcc(*'XVID') # for windows 2) out=cv2.VideoWriter('',fourcc, 20.0, (width, Hight)) # we should know the input video width and hight, we should give same width and hight of input video below line with in while loop after cv2.rectangle(frame1,(x,y),(x+w,y+h),(0,255,0),2) line 3) out.write(frame1) I have not tried this code, I hope it works.
@guseechka
@guseechka 4 жыл бұрын
How can i crop frames rectangle from video?
@serignediewrine7908
@serignediewrine7908 4 жыл бұрын
great
@anuragaher2400
@anuragaher2400 3 жыл бұрын
Can I get the video link? Could anyone help me with the pedestrians walking video?
@abdremo
@abdremo 5 жыл бұрын
Nice nice
@youssfinada3410
@youssfinada3410 4 жыл бұрын
mille merciiiiiiiiiiiii
@videoguy402
@videoguy402 3 жыл бұрын
I ran your code with a new video. In the video, along with the people, camera is also moving and the camera is just placed behind a possession. In that case, I am getting multiple rectangles for the same moving objects instead of one. Is there a way to solve this issue?
@pratikshamanave9709
@pratikshamanave9709 3 жыл бұрын
DO YOU HAVE MORE RECORDINGS TO TEST? CAN YOU MAIL THEM TO ME AT pratiksha.manave99@gmail.com?
@rajarshimandal3235
@rajarshimandal3235 3 жыл бұрын
Sir in the very starting of the mp4, why didn't opencv detect the person who was walking along the left side of the window on the narrow footpath?
@erikanderson6076
@erikanderson6076 3 жыл бұрын
The person is far away from the camera, and because of this the number of pixels that person takes up is below the area threshold set in the code. You see as that person comes into the foreground, they occupy more pixels and they start getting detected
@rajarshimandal3235
@rajarshimandal3235 3 жыл бұрын
@@erikanderson6076 yes I realized it later thanks😊
@kumarabhishek5652
@kumarabhishek5652 4 жыл бұрын
hey, i have been using webcam instead of video,why is it showing too many contours even though i have less motions in it??
@mohdsameer8609
@mohdsameer8609 3 жыл бұрын
will you please send me the coding for this i am non IT student
@Ricarrr
@Ricarrr 4 жыл бұрын
Congratulations on the great job. I would like to know how to put an ID on these people?
@franklinjoe52
@franklinjoe52 3 жыл бұрын
You should look more into face detection and recognition using the Haars Cascade algorithm. This script is for simple motion detection
@ayushagarwal69
@ayushagarwal69 3 жыл бұрын
umm , ig you could declare an int variable and then puttext that number on the coordinates on each rectangle and then when the loop is over , you could puttext at the top of screen :" j moving objects detected ", and then you could store that j somewhere (idk much about that ) . But nice idea , that way we can find the no of objects
@favourchianumba5823
@favourchianumba5823 3 жыл бұрын
i copied the code shown at the start into a google colab notebook and the video isnt showing up, anyone know why?
@saadaldossri5348
@saadaldossri5348 4 жыл бұрын
Good work, but could you put the code and the testing movie.
@willhawkins4112
@willhawkins4112 4 жыл бұрын
Any idea's on how to download a nice video to run this code on? I'm a nube to CV.
@jeff._.6262
@jeff._.6262 4 жыл бұрын
I assume you have already figured it out but If your just testing you don’t really need to download a video you can simply go to ex shutterstock/video and get the url to video ( using f11 or whatever button that gets you into the delvoper tab in your browser ) then just write that in cv.videoCapture(“the url”)
@MadeInFIFA10
@MadeInFIFA10 2 жыл бұрын
File "C:/Users/tasme/PycharmProjects/pythonProject1/main.py", line 15, in print(frame1.shape) AttributeError: 'NoneType' object has no attribute 'shape' Process finished with exit code 1 im having this problem will u pls help
@lylechen8881
@lylechen8881 4 жыл бұрын
13:25 How can you filter the countours just by the size of their boundings, rather than adjusting dilate threshold!
@Ghkfdvbj
@Ghkfdvbj 4 жыл бұрын
Hi , I just tried with different threshold without considering area of contours. As threshold value is increasing, we are losing tracking of object. We could tack movement of parts of a object ( like hands movement and head movement) . If we increase threshold and considering area, then we can't track object at all for small movements.
@lylechen8881
@lylechen8881 4 жыл бұрын
@@Ghkfdvbj Maybe Kalman filtering is needed. Anyway, calculating bounding area makes larger errors.
@arendelle_ok
@arendelle_ok 2 жыл бұрын
can i use vlc window panel as a motion capture ?. cuz i want be able to change the video source
@justanothergoogleuser
@justanothergoogleuser 2 жыл бұрын
Hi! How to download/get the video mentioned in this video?
@tprhse
@tprhse 3 жыл бұрын
how can I find video that you used
@tinoliterallydd8776
@tinoliterallydd8776 3 жыл бұрын
how to add a line that comes from the back?
@anupamadhikari6043
@anupamadhikari6043 3 жыл бұрын
Why we have None in dilute function
@akshaypendyala
@akshaypendyala 3 жыл бұрын
What if there are several moving objects other than just persons and ropes, let's say cars, birds, etc. How will you track only persons? It could have been awesome if you explained this Yolo and multi-threading for faster and accurate video processing.
@Satchi017
@Satchi017 2 жыл бұрын
Have you found the solution????
@akshaypendyala
@akshaypendyala 2 жыл бұрын
@@Satchi017 Nah, after doing this project, I was busy with other tasks.
@filiphessle5981
@filiphessle5981 5 жыл бұрын
First
@nicoestay6351
@nicoestay6351 5 жыл бұрын
Hi, great video! i have a question, how can i know how much people are in the input video?
@romazahrypa
@romazahrypa 5 жыл бұрын
you can extract contours.length or so if I am not mistaken if a countours is a list which should have its length
@superminecraft902
@superminecraft902 5 жыл бұрын
count++ in the for contour in contours
@Ghkfdvbj
@Ghkfdvbj 4 жыл бұрын
Hi, As we are working on frames, so we can find number of people equals to number of contours in each frame by adjusting contours area size ( one contour for one person)
@survivaldude29
@survivaldude29 3 жыл бұрын
After several hours I finally found the correct link to download opencv Edit: never mind ,it was still the wrong link ,it’s now been 3 hours.I’m just gonna waste my money on an actual security camera, even though it’s not necessary Because I can use codes.
@FaridCenreng-
@FaridCenreng- 3 жыл бұрын
How to enable auto suggest opencv on vscode?
@yunusyavuz6147
@yunusyavuz6147 3 жыл бұрын
thx
@fadhelalsuwaidi1221
@fadhelalsuwaidi1221 4 жыл бұрын
Hi Its wonderful video, can u make the camera record when the motion start, I mean record every motion, when camera detect someone moving start to record the video, it will be greate if u teach is how to do it.
@Sski85
@Sski85 4 жыл бұрын
Not sure if this is helpful. But "Blue Iris" software is capable of doing what you are asking. I have a pc running 6 cameras with it and works very well
@franklinjoe52
@franklinjoe52 3 жыл бұрын
Really appreciate your vids but please use dark mode. You'll thank me later
@nagashishsv843
@nagashishsv843 5 жыл бұрын
What's the use of taking difference between 2 frames??why it is needed..?? Please reply..
@blz1rorudon
@blz1rorudon 5 жыл бұрын
By taking the difference between the two frames, all intensity for parts of the video where things don't move will be reduced to zero (since their values are the same in both frames). The parts of the video where things DO move, however, will have different values in the two frames, and so the difference will result in a non-zero value. The resulting image -diff- will be low-intensity (0) wherever the two frames are the same(no movement) and it will have some intensity for those parts that are different (movement). In this way, diff only preserves the movement of the original video.
@dojomats
@dojomats 4 жыл бұрын
@@blz1rorudon does this mean that if there is any vibration on the webcam/camera, the whole data cant be used reliably to detect motion?
@sametakbeyaz5021
@sametakbeyaz5021 3 жыл бұрын
Is it possible to do it in the game?
@isaiahb8079
@isaiahb8079 5 жыл бұрын
How would i make this only track one person?
@myetis1990
@myetis1990 5 жыл бұрын
you can draw the contour rectangle of the person whom you selected, but you have to record last rectangle position on frame1 for finding the difference between last and current contour, set an algorithm that allows you to find a new contour rectangle on the current image by looking at contour rectangle on the last frame, simply you can take last 2 positions of the rectangle for estimating the current position of the object using linear extrapolation and when you detect a contour which is next to the estimated position, you can draw this contour rectangle, one problem you will encounter is that there may be two or more coinciding moving people. your algorithm may confuse in this situation and may decide to keep tracking another moving object, be careful. in this situation you will need specific morphological properties for specified person you are tracking. you can find many effective algorithms on google like Kalman etc. Kalman filtering for object tracking will help you. Kalman filtering is an estimator which finds possible contour position on current frame by filtering previous frames you will see that the Kalman method is a far enhanced method as to method i told you
@JuanRojas956
@JuanRojas956 4 жыл бұрын
Is there a way to do motion tracking with the boxes around the people with live video?
@Nanda-ho5eh
@Nanda-ho5eh 4 жыл бұрын
Do you have a idea. If you have please drop a hint
@paulsponagle3754
@paulsponagle3754 4 жыл бұрын
Capture live stream in stead of capturing the saved video. cap = cv2.VideoCapture(0) ==> 0 represents the first instance of videofeed, 1 would be second webcam.
@ayushagarwal69
@ayushagarwal69 3 жыл бұрын
use cap.VideoCapture(0) for live webcam
@hadjerBrioua
@hadjerBrioua Жыл бұрын
I am getting this error: Traceback (most recent call last): File "c:\Users\orange\Bureau\Learnings\openCv\basic_motion_detection.py", line 19, in diff = cv.absdiff(frame1, frame2) cv2.error: OpenCV(4.7.0) D:\a\opencv-python\opencv-python\opencv\modules\core\src\arithm.cpp:650: error: (-209:Sizes of input arguments do not match) The operation is neither 'array op array' (where arrays have the same size and the same number of channels), nor 'array op scalar', nor 'scalar op array' in function 'cv::arithm_op'
@magnetpen_1
@magnetpen_1 Жыл бұрын
how do you use your webcam
@shiwamjaiswal9653
@shiwamjaiswal9653 4 жыл бұрын
How do we decide the threshold value? Isn't it better to use OTSU's Binarization to calculate the threshold value
@rishabhkothari7901
@rishabhkothari7901 4 жыл бұрын
Can someone expalin me the use of line 17 and 18? frame1= frame2 ret, frame= cap.read() like what is their use exactly?
@noushadkhan360
@noushadkhan360 4 жыл бұрын
I want also brother
@vigneshkathirkamar3113
@vigneshkathirkamar3113 4 жыл бұрын
once your frame2 is assigned to frame1, now both frame1 and frame 2 will have same value, which will make 'diff' variable 0. Hence frame2 is set to new value using cap.read()
@dojomats
@dojomats 4 жыл бұрын
@@vigneshkathirkamar3113 hi vignesh, what is the importance of the "ret, " part?
Object Tracking with Opencv and Python
30:03
Pysource
Рет қаралды 600 М.
КОМПОТ В СОЛО
00:16
⚡️КАН АНДРЕЙ⚡️
Рет қаралды 30 МЛН
마시멜로우로 체감되는 요즘 물가
00:20
진영민yeongmin
Рет қаралды 34 МЛН
Slow motion boy #shorts by Tsuriki Show
00:14
Tsuriki Show
Рет қаралды 8 МЛН
Stay on your way 🛤️✨
00:34
A4
Рет қаралды 13 МЛН
Motion Detection Alarm System in Python
19:20
NeuralNine
Рет қаралды 38 М.
Motion Detection Tutorial using openCV Python (in Video) - with code
24:26
Make A Security Camera With Python
35:58
Tech With Tim
Рет қаралды 232 М.
Laser Tracker Targeting Test Platform Build
18:21
Clayton Darwin
Рет қаралды 17 М.
Object Detection using OpenCV | Python | Tutorial for beginners 2020
29:29
DeepLearning_by_PhDScholar
Рет қаралды 237 М.
Object Detection in 10 minutes with YOLOv5 & Python!
10:45
Rob Mulla
Рет қаралды 241 М.
КОМПОТ В СОЛО
00:16
⚡️КАН АНДРЕЙ⚡️
Рет қаралды 30 МЛН