Tracking Objects | OpenCV Python Tutorials for Beginners 2020

Поділитися
Вставка
  • Опубліковано 11 вер 2024

КОМЕНТАРІ • 285

  • @murtazasworkshop
    @murtazasworkshop  2 роки тому +23

    If you are using the latest version of opencv contrib and you get the error
    AttributeError: module 'cv2' has no attribute 'TrackerMOSSE_create'
    use
    cv2.legacy.TrackerMOSSE_create()
    instead of
    cv2.TrackerMOSSE_create()

    • @proskurlandsky
      @proskurlandsky 2 роки тому +1

      but now it has no module legacy

    • @mangostain
      @mangostain 2 роки тому +5

      @@proskurlandsky please uninstall opencv-python and the install the opencv-contrib-python package
      pip uninstall opencv-python
      pip install opencv-contrib-python
      it worked for me

  • @douwebdevries
    @douwebdevries 4 роки тому +30

    When you get this error: OpenCV: camera failed to properly initialize!
    Try changing cap = cv2.VideoCapture(1) to cap = cv2.VideoCapture(0)

  • @TheNazbul
    @TheNazbul Рік тому

    in the whole youtube nobody is better than you when it comes to explanation. no one can explain each and every line you do sir. this indicates how much you like coding. thank you sir i learnt a lot from you.

  • @ChickenJY
    @ChickenJY 4 роки тому +3

    Dear Murtaza, a very big thanks for your help! Your video is sharp and crystal clear.

  • @kyriosabbes3737
    @kyriosabbes3737 4 роки тому +6

    Good work ☺️, we are waiting about YOLOv3 🔥🔥🔥

  • @antoniodome9306
    @antoniodome9306 4 роки тому +3

    Perfect for what i need, good luck with the next videos!

  • @aniketroy5865
    @aniketroy5865 3 роки тому

    You are really a savior for beginners like us, you provide us a headstart otherwise we had to bang our heads in long documents to get things done

  • @zrlcproject
    @zrlcproject 3 роки тому +7

    I have tried to install opencv-contrib-python but it has the same error and it can't. TrackMOSSE_crate ()
    like this:
    tracker = cv2.TrackerMOSSE_crate ()
    AttributeError: module 'cv2.cv2' has no attribute 'TrackerMOSSE_crate'

    • @hridaanshugusain474
      @hridaanshugusain474 3 роки тому

      same, but I've spelled create correct lol

    • @haniefknight
      @haniefknight 3 роки тому

      @@hridaanshugusain474 hi how about now, are you still have the same problem? ive just install opencv-contrib-python and it doesnt work

    • @haniefknight
      @haniefknight 3 роки тому +2

      tracker = cv2.legacy.TrackerMOSSE_create()
      i found on stack overflow

    • @hridaanshugusain474
      @hridaanshugusain474 3 роки тому

      @@haniefknight ok i will try this. thank you

    • @hridaanshugusain474
      @hridaanshugusain474 3 роки тому

      @@haniefknight this worked thank you

  • @playfifalikeapro9773
    @playfifalikeapro9773 3 роки тому +2

    thanks so much
    i just wanna ask you when I wanna run the code I see the error
    module 'cv2.cv2' has no attribute 'TrackerMOSSE_create'
    I am using Spyder IDE and I cant solve it
    plz help me
    thanks in advance

    • @PolarUVTeam
      @PolarUVTeam 3 роки тому +2

      Try
      tracker = cv2.legacy.TrackerMOSSE_create()
      and use only opencv-contrib-python library

  • @A3A3adamsan
    @A3A3adamsan 3 роки тому +10

    Even after adding opencv-contrib-python package (version 4.5), no MOSSE tracker was found, only MIL and GOTURN. Anyone knows why?

    • @anuraagsaxena7942
      @anuraagsaxena7942 3 роки тому +16

      change tracker = cv2.legacy_TrackerMOSSE.create()
      this might help

    • @bhanukadasanayaka3457
      @bhanukadasanayaka3457 3 роки тому

      @@anuraagsaxena7942 Thanks bro

    • @abeatperday9189
      @abeatperday9189 3 роки тому

      @@anuraagsaxena7942 thanks for this, it worked for me

    • @jishnupillai5295
      @jishnupillai5295 3 роки тому

      @@anuraagsaxena7942 thanks for this..it really helped. So what changes to be made if we are using another tracker?

    • @vinayakdhinde5606
      @vinayakdhinde5606 3 роки тому

      @@anuraagsaxena7942 Thanks Bro , It's working

  • @aykutsirma4260
    @aykutsirma4260 3 роки тому +1

    tracker = cv2.TrackerMOSSE_create()
    AttributeError: module 'cv2.cv2' has no attribute 'TrackerMOSSE_create'
    I have installed opencv-contrib-python as first and I have installed opencv-python too. However, once I uninstall the opencv-python and keep the opencv-contrib-python. Then python compiler gives error about "You don't have cv2"... Do you know how to solve this issue? thank you.

  • @hetthummar9582
    @hetthummar9582 3 роки тому +2

    if you get error
    " You might be loading two sets of Qt binaries into the same process. Check that all plugins are compiled against the right Qt binaries. Export DYLD_PRINT_LIBRARIES=1 and check that only one set of binaries are being loaded. Restarting kernel... "
    1.
    Make sure opencv-contrib-python-headless is installed
    (pip install opencv-contrib-python-headless)
    2.
    opencv-python, opencv-python-headless and opencv-contrib-python-headless version has to be same
    (For check version just write pip list|grep opencv-python)
    In my case all version are 4.3.0.36
    (pip install opencv-contrib-python-headless==4.3.0.36)

  • @ettiennegerwel6616
    @ettiennegerwel6616 3 роки тому

    Great tutorial! Very simple and clear. Awesome man.

  • @fahimkamalahmed3544
    @fahimkamalahmed3544 3 роки тому +2

    Simple but clear explanation. Thank you ☺️

  • @karthikeyaanar
    @karthikeyaanar 3 роки тому +1

    Excellent Tutorial. Keep it up !!!

  • @LeonardoJPaes
    @LeonardoJPaes Рік тому

    wow!! awesome tutorial. Thank you very much for your explanation and the way of introducing the subject and all the useful tools for beginners like me!

  • @Not0rious7
    @Not0rious7 4 роки тому +1

    Seriously, good work!!! This is a great intro.

  • @sanketyeru
    @sanketyeru 4 роки тому +3

    Your videos are awesome. I would like to request you to make a video on yolo detector combined with object tracker.

  • @DerinMalik
    @DerinMalik 5 місяців тому

    thanks you open new goals to us

  • @sujitvasanth2502
    @sujitvasanth2502 3 роки тому

    wonderful ! I love this - i didn't know opencv ad bui;t in trackers...your code is perfect..

  • @jollysaintthicc3920
    @jollysaintthicc3920 3 роки тому

    Love your stuff! keep up the good work!!!

  • @havehalkow
    @havehalkow 3 роки тому +1

    I'm not using PyCharm but Sublime Text and CMD. I pip installed the opencv-contrib-python package which was successfully done, however the error is still there

  • @ssaniljainn
    @ssaniljainn 3 роки тому +1

    Can you make a tutorial on Kalman Filters? Especially in object tracking for state estimation and in some cases, for the velocity estimation. The whole Computer Vision world, it seems, is looking out for the subject to be more implementable if clear. Would be grateful if you could do the honors :)

  • @GasherProdStudio
    @GasherProdStudio 2 роки тому +2

    For those who would have an error when initializing the tracker : use cv2.legacy.TrackerMOSSE_create() because now the trackers have been moved in the legacy class since OpenCV 4.5.1

  • @rashasalim1259
    @rashasalim1259 3 роки тому

    Thanks! This was really informative
    I would like to ask you for advice in case I needed the speed estimate of the moving object.
    Thanks!

  • @1phong.djk.392
    @1phong.djk.392 4 роки тому +3

    Thank you very much for upload wonderful tutorials. Keep going

  • @AbdullahJirjees
    @AbdullahJirjees 3 роки тому

    Hi, thanks a lot for this tutorial, I am following exactly what you doing but when I draw the square on the object it keeps showing LOST status, I am using VS Code and I installed pip install opencv-contrib-python to my environment.
    what I am missing??

  • @oleksandrromaniuk3557
    @oleksandrromaniuk3557 2 роки тому

    Thank you very much, very clear and with life example!

  • @rodrigobucrin7912
    @rodrigobucrin7912 4 роки тому +2

    Thank you for your quality contributions!

  • @AbdulHannan-dg8by
    @AbdulHannan-dg8by 3 роки тому +1

    Trackermosse create not present in cv2
    I am havin this error, tracKerMOSSE_create() attribute is not working.
    can anyone please help..
    I have a project and i really need this.

  • @theengineered1949
    @theengineered1949 2 роки тому +4

    Wonderful video. I am trying to make a motor move using the tracked object. How do you export the x,y,w,h ?

  • @leojax3275
    @leojax3275 2 роки тому

    Thank You Good Sir. Very good tutorial, very helpful. Have a wonderful day!

  • @josueperrit
    @josueperrit 2 роки тому +1

    Is there a way to know the first frame at which the bbox starts moving?

  • @siddharthrana512
    @siddharthrana512 Рік тому

    any course of computer vision include person tracking under multiple overlapping cameras , so that there id does not change when they move from one camera to other.

  • @selcukmisir2399
    @selcukmisir2399 4 роки тому

    Great videos again and again! Thanks

  • @abeerilyas8337
    @abeerilyas8337 7 місяців тому

    Sir, I would like some suggestion. How can we implement this if the object is moving and we are doing real time tracking?

  • @magelauditore333
    @magelauditore333 4 роки тому

    Great and very detailed explanation. Thanks a lot

  • @ingokaminski935
    @ingokaminski935 2 роки тому

    This helps me a lot... 👍 Thank you!!!

  • @dompower500
    @dompower500 3 роки тому +2

    Dear Sir, I am following all your training videos. Excellent and easy to follow. I always get positive result too. There are many tranining videos available in youtube for the same subject. But your videos are the best and error free. Thank you very much sir.
    My request: Pls can you also make a traning video for car license plate recognition using TF? thanks in advance. Also pls provide your email sir.

  • @sankasuvarna1764
    @sankasuvarna1764 4 роки тому

    Hi sir u can label the names the tracked images so that will be much better any way this is also a superb tutorial

  • @Mark-Zuckerberg
    @Mark-Zuckerberg 4 роки тому +11

    This code isn't working window is freeze on the first frame.

    • @murtazasworkshop
      @murtazasworkshop  4 роки тому

      It is suppose to freeze on the first frame so that you can select the object you want to track

    • @Mark-Zuckerberg
      @Mark-Zuckerberg 4 роки тому

      @@murtazasworkshop No it continuously freezes the 1st frame.

    • @emilio4961
      @emilio4961 4 роки тому

      @@Mark-Zuckerberg how did you fix it ??

    • @Poo1199-c1o
      @Poo1199-c1o 4 роки тому

      were u able to resolve it?

  • @teobong6939
    @teobong6939 4 роки тому +2

    It workn't. You put the tracker code outside the while loop so its just a picture with a rectangle on it

    • @AlmaasAAli
      @AlmaasAAli 4 роки тому

      How did you solve this? So that there is an image(from the camera) at the start while initialising the tracking.

    • @ahmedshiref4935
      @ahmedshiref4935 4 роки тому

      when you press enter it comes non frozen new screen

  • @elixpo
    @elixpo 2 роки тому

    I am not getting the open-cv contrib, it always says not available even after downloading by PIP too

  • @lobdooks
    @lobdooks 3 роки тому

    For some reason after I click "enter" when I select an object to track it gives me the error message for "cv.rectangle(img,(x,y),((x+w... (that thing)" that says "TypeError: function takes exactly 4 arguments (2 given)" how do I fix this?

  • @yashdggjs
    @yashdggjs 4 роки тому +2

    who are you mannn who are you awesome workss,ı really admire you

  • @gregoryM101
    @gregoryM101 4 роки тому +1

    Can you save these selected object for tracking and reuse it without having to select it again? Perhaps set up a library of objects that can be reused as needed?

    • @murtazasworkshop
      @murtazasworkshop  4 роки тому

      usually its detection and then tracking. so if tracking is lost detection can kick in again. The selected region could be saved but since tracking is sensitive to variance you might not get good results.

  • @kristaqvin
    @kristaqvin 4 роки тому +3

    The first frame is just an orange square. Then, after I press enter, it shows me the webcam video

  • @MrTomer157
    @MrTomer157 3 місяці тому

    Thank you so much sir!

  • @coolprojects5297
    @coolprojects5297 3 роки тому

    Thank you for nice work,,, but please when I run the code it stuck and the camera did not update the view why did this happen?

  • @nadiamumtaz6270
    @nadiamumtaz6270 3 роки тому

    Thanks for sharing but i m facing one issue, that it misses the target but still says tracking instead of lost? Why

  • @hemanthy2835
    @hemanthy2835 3 роки тому

    For the same application can we have a circular tracker instead of a rectangular one? If so, how?

  • @josephadamu2723
    @josephadamu2723 4 роки тому +1

    hello please i have a question concerning filters (gaussian, median, bilateral and averaging) associated with OpenCV. I have seen some tutorials using gaussian blur for object detection i would like to know why this particular filter is used for object detection, why is it the best and what are the features that differ from other 3 filters that i have mentioned.

    • @murtazasworkshop
      @murtazasworkshop  4 роки тому +1

      Median Filter is to remove Salt Pepper Noise
      Bilateral gives a painting feel. It uses weighted average of surrounding pixels.
      Guassian filter uses convolution . This means futher pixels get lower weights
      Averaging. uses single averaged value for all surrounding pixels.
      It depends on the situation . Guassian is good but it is slower than Averaging.

  • @j4s0n67
    @j4s0n67 3 роки тому +2

    how do you install opencv2-contrib-pyhton on terminal?

    • @abhaysharma1139
      @abhaysharma1139 3 роки тому +2

      just type "pip install opencv-contrib-pyhton" in your command prompt

  • @aronhegedus
    @aronhegedus 3 роки тому

    really useful tutorial, thank you!
    It would. be useful for beginners to tell them where they could go if they get stuck (google, or documentation)

    • @easonvictor3749
      @easonvictor3749 2 роки тому

      speaking of which, do you know why my external camera wouldn't pick up any feed besides the gray void of absolotly nothin?

  • @technoshamanarchist
    @technoshamanarchist 2 роки тому

    Thank you for this wonderful tutorial! However, the page for the code is no longer available :(

  • @ramonsgames8529
    @ramonsgames8529 3 роки тому +1

    it says NameError: name 'tracker' is not defined

  • @enarm5947
    @enarm5947 3 роки тому

    "Status: Tracking" shows when the tracker is working, but when it loses an object. Is the "status" changing?

  • @einjhellace
    @einjhellace 3 роки тому

    Is it possible to do this using 2 cameras, perpendicular to each other, showing the XY coordinate for one and YZ on the other?

  • @zack-ow9yl
    @zack-ow9yl 4 роки тому

    I am not able to add the OpenCV package because the plus sign isn't highlighted when I click "Python Interpreter." Also, can you make a video on tracking multiple objects at once?

  • @flexiadmin
    @flexiadmin Рік тому

    awesome tutorial for my plane crazy plane ciws tracking

  • @CrjaseMechaEngr
    @CrjaseMechaEngr 3 роки тому

    Thank you. Great tutorial.

  • @prajjwal1642
    @prajjwal1642 2 роки тому

    sorry sir but the cv2.TrackerMOSSE_create() function is not working in other ide s. can you give an alternative? also a request to build a project on social distancing using opencv

  • @teezhenquan5855
    @teezhenquan5855 3 роки тому

    Love your work. Can you share tracking with C++ as well

  • @ahmadmaleh
    @ahmadmaleh 3 роки тому

    Hi, Is it possible to know all pixels of the detected object? because I want to change the object color after that.

  • @tjssr8261
    @tjssr8261 2 роки тому

    Sir, this video helped me a lot. Thank you so much. I am using Spyder for Python. Where can I see the values of the x, y ,w and h in my window?
    PLease help me sir.

  • @lusher00
    @lusher00 2 роки тому

    selectROI only gives me a black box to draw on. Even if I just select a black region is continues to show me a black frame.

  • @shravannanjunda
    @shravannanjunda 4 роки тому +2

    If it was controlled with servo motors ...pan and tilt it would be awesome

    • @murtazasworkshop
      @murtazasworkshop  4 роки тому +1

      ill look into that

    • @munibmarwan
      @munibmarwan Рік тому

      I'm trying to work on something similar ..

    • @munibmarwan
      @munibmarwan Рік тому

      @@murtazasworkshop I'm trying to work on something similar, is there anything you can add might help me to take the first step in it? .. Thank you for your time.

  • @selenaycakc9584
    @selenaycakc9584 3 роки тому

    Great thanks Sir! I have a question: how can I add a custom trained model to this code? can anyone help me? my own model is ready with yolov4.

  • @twinklewolf6794
    @twinklewolf6794 4 роки тому +2

    Awesome keep going🔥🔥
    But why did u delete arduino tutorial?

    • @murtazasworkshop
      @murtazasworkshop  4 роки тому +2

      Thanx. They are not ready yet

    • @twinklewolf6794
      @twinklewolf6794 4 роки тому +1

      @@murtazasworkshop
      so when you finish them all u gonna upload them again?
      hope so cuz those two videos were amazing tutorial to be honest❤️

    • @murtazasworkshop
      @murtazasworkshop  4 роки тому +2

      @@twinklewolf6794 Yes

    • @twinklewolf6794
      @twinklewolf6794 4 роки тому +1

      @@murtazasworkshop
      Can't wait 🔥🔥🔥

  • @afifabinteislam4675
    @afifabinteislam4675 3 роки тому

    And when I installed OpenCV-contrib-python for the first time, my video was not capturing and I got panicked. then uninstalled it and installed it again. then it worked. I don't know any other way to solve the issue. if you do, please let me know

  • @satya5561
    @satya5561 3 роки тому

    Can you please help me to find vision based vibration on any object using python

  • @AjibesinSamson
    @AjibesinSamson 3 роки тому

    If I want to track objects in a video and make use of a detector such as YOLOv4, how can I go about it?

  • @Owlzon
    @Owlzon 2 роки тому

    Why "success,imag=" not just "img="?
    (I'm new to python)

  • @manoubilahbib2572
    @manoubilahbib2572 2 роки тому

    Hey !
    How can i install the package that contains all the trackers on thonny python IDE because i am using a raspberry pi ?

  • @milesgiehtbrock8510
    @milesgiehtbrock8510 3 роки тому

    how do we implement trackers into robotics? The output coordinates tell a robot arm to go to that position for example.

  • @alexhernandez8550
    @alexhernandez8550 4 роки тому

    some advice I would not recommend using cv2 to capture the screen use mss also I would try PyGLM or numpy for better performance .

  • @samirakhrif3098
    @samirakhrif3098 4 роки тому +1

    hello.please can you enplane in video haw calcul speed of the cars

  • @alaaasd571
    @alaaasd571 4 роки тому +2

    AttributeError: module 'cv2.cv2' has no attribute 'TrackerMOSSE_create' ------can you help me please?

    • @cristoferrivera8504
      @cristoferrivera8504 4 роки тому +1

      i have the same error, also I have opencv-contrib-python

    • @vs-cw1wc
      @vs-cw1wc 4 роки тому +1

      Have you got this solved? I am encountering the same problem.

    • @techpowercoders8009
      @techpowercoders8009 4 роки тому

      It is TrackerMOSSE_create(). You have missed () I guess

    • @vs-cw1wc
      @vs-cw1wc 4 роки тому

      @@techpowercoders8009 Added the brackets, still the same problem. Any other ideas?

    • @techpowercoders8009
      @techpowercoders8009 4 роки тому

      @@vs-cw1wc have you installed the Python- contrib module told in the video?

  • @ohnoooooo3831
    @ohnoooooo3831 4 роки тому

    hey thanks.
    but if we have the same problem with the trackerCSRT_create but on spyder(anacondaà.
    how can we solve it ?

  • @nishantgarg3688
    @nishantgarg3688 2 роки тому +1

    thanks bhai

  • @mustafaaslan1520
    @mustafaaslan1520 2 роки тому

    i use win 10 and help me pls cv2.error: OpenCV(4.6.0) D:\a\opencv-python\opencv-python\opencv\modules\highgui\src\window.cpp:1267: error: (-2:Unspecified error) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Cocoa support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function 'cvShowImage'

  • @saltanatseitzhan625
    @saltanatseitzhan625 4 роки тому

    great video! also, how could one track multiple objects?

  • @carloscusiter2972
    @carloscusiter2972 4 роки тому +2

    How would you track multiple objects?

    • @AlmaasAAli
      @AlmaasAAli 4 роки тому

      This would be interesting to see.

  • @almostworthy2973
    @almostworthy2973 3 роки тому

    hey how do i do the same but my source is a mp4 file.

  • @thienduyen2518
    @thienduyen2518 3 роки тому

    Thanks Pro!

  • @oladapoafolabi274
    @oladapoafolabi274 Рік тому

    I want to learn how to set up Robot arm performing orientation identification, pick and place cube object using artificial intelligence in webots simulation environment

  • @SAMETELMACI
    @SAMETELMACI 3 роки тому

    ı have a vs code, can ı use this, because ı still error like about 6:33

  • @nouramged5765
    @nouramged5765 4 роки тому

    I don’t hava web camera and i want to use my phone’s camera how can i do that?

  • @kj4051
    @kj4051 4 роки тому

    Thanks for great project. But how to get cv2.selectROI while in the loop?

  • @pinehteshapple3666
    @pinehteshapple3666 4 роки тому

    can we use mobile camera instead of webcam

  • @FoodKannadaVlog
    @FoodKannadaVlog 2 роки тому

    'cv2' has no attribute 'TrackerMOSSE_create'
    I
    got this type of error. installing the pip install opencv-contrib-python I install this library still get the same error so. please tell me what extra library can install

    • @acfromspace
      @acfromspace 2 роки тому

      The attribute moved to the legacy api, so in order to access it it has to be "cv2.legacy.TrackerMOSSE_create()" instead of "cv2.TrackerMOSSE_create()"

  • @thaibaohuynh1298
    @thaibaohuynh1298 2 роки тому

    Can you share the video you used to test?

  • @dennisasamoah2213
    @dennisasamoah2213 3 роки тому

    great video as always

  • @ponrajs5396
    @ponrajs5396 4 роки тому

    Hi bro, how could I count no of object in the frame with tracking.

  • @amitdutta3875
    @amitdutta3875 3 роки тому

    Is its possible to calculate distance
    using openCV???

  • @thienduyen2518
    @thienduyen2518 3 роки тому

    You are the Best! Haha!

  • @TECHNICALHUBInfo
    @TECHNICALHUBInfo 4 роки тому

    Hello sir. Sir how to detect any bird or any small object plzzz guide me

  • @santoshgujar5237
    @santoshgujar5237 2 роки тому

    Thank you, Sir

  • @user-xo2iu8ne3j
    @user-xo2iu8ne3j 3 роки тому

    Doesn't this program determine the distance?

  • @muhammadafifhidayat2566
    @muhammadafifhidayat2566 3 роки тому

    I follow ur code but when i run, it does not show video, just a capture or maybe first frame