OpenCV Python Tutorial For Beginners 13 - Object Detection and Object Tracking Using HSV Color Space

  Рет қаралды 146,303

ProgrammingKnowledge

ProgrammingKnowledge

5 жыл бұрын

In this video on OpenCV Python Tutorial For Beginners, I am going to show How to do Object Detection and Object Tracking Using HSV Color Space. So we will be Implementing color and shape-based object detection and tracking using hue-saturation-value (HSV) color model. For Choosing the correct upper and lower HSV boundaries for color detection with`cv::inRange` (OpenCV) we will use trackbar.
Gist of code I used in this video (Python | Simple object tracking with OpenCV ) - gist.github.com/pknowledge/aa...
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!

Пікірлер: 119
@christopherwestcott3685
@christopherwestcott3685 5 жыл бұрын
These videos have gotten me up and running quickly with OpenCV. Thank you!!
@KyranFindlater
@KyranFindlater 5 жыл бұрын
wow, this is actually the first time i've seen these really handy integrated highgui trackbar features. that's super handy for my image processing prototyping!
@emoon777
@emoon777 Жыл бұрын
Your videos are incredible, I have been watching them all day, as I've been working on a CV project and this has been so helpful! You have done such a brilliant job
@thaumiel1903
@thaumiel1903 3 жыл бұрын
What happens in this video was just a magic. Thank you very much for these beneficial videos. Looking forward to next ones...
@joliver1981
@joliver1981 5 жыл бұрын
This is great! I can really use this method for a project I’m working on right now. Thank you!
@husseingharakhani8002
@husseingharakhani8002 4 жыл бұрын
This was my first time to work with OpenCV. Thank you so much.
@patirosa5548
@patirosa5548 4 жыл бұрын
l_b = np.array([102,165,183]) u_b = np.array([139,255,255]) Values that i found to the blue balls. Thanks for the videos!
@HM-cw8im
@HM-cw8im 3 жыл бұрын
Could you please give the values for the red color?
@Arnius_Music
@Arnius_Music Жыл бұрын
i felt like the first days that i enjoyed learning how to code. thank you💛
@rebekahhumphreys8081
@rebekahhumphreys8081 4 жыл бұрын
Hi, this video and series really helped me with a project that made my robot track and move towards a pink blob or shape. You are an amazing teacher because before this tutorial I did not know anything about OpenCV and with your help I made something super cool happen so thank you :)
@CrypticFate5
@CrypticFate5 3 жыл бұрын
how did you automate it?
@FakhryHTatanaki
@FakhryHTatanaki 3 жыл бұрын
@@CrypticFate5 U can implement a python program in Raspberry pi with a camera connected, it's a small computer that runs Linux where u can use its GPIO pins for various peripherals such as motors and sensors.
@keatonhezekiah8066
@keatonhezekiah8066 2 жыл бұрын
you probably dont give a damn but does anybody know of a way to get back into an Instagram account..? I was stupid lost the account password. I love any tips you can give me!
@wyatteaston1000
@wyatteaston1000 2 жыл бұрын
@Keaton Hezekiah instablaster ;)
@keatonhezekiah8066
@keatonhezekiah8066 2 жыл бұрын
@Wyatt Easton thanks for your reply. I found the site thru google and Im in the hacking process atm. Looks like it's gonna take a while so I will reply here later with my results.
@gioacchinopellerito2440
@gioacchinopellerito2440 3 жыл бұрын
Simply amazing, I am newby about opencv, nevertheless, the exemples managed on these video series are clear as crystal water. In a whole day, i feel as confident I can begin to handle a simple test by my own. Thanks so much
@atharvapatil9763
@atharvapatil9763 2 жыл бұрын
A more visible lower and upper bound for blue color detection is : l_b = np.array([95, 116, 50]) u_b = np.array([130, 255, 255])
@saidanianis1923
@saidanianis1923 4 жыл бұрын
i learn a lot from you , thanks for all the work that you done
@nevilparekh6400
@nevilparekh6400 4 жыл бұрын
Bravo... many thanks for amazing tutorials ..
@liliankotvan3165
@liliankotvan3165 4 жыл бұрын
I loved this video. Thank you very much!
@uchihaitachi3600
@uchihaitachi3600 4 жыл бұрын
Very helpful play list and especially i loved this video :)
@ridael-mehdawe4681
@ridael-mehdawe4681 4 жыл бұрын
so informative lesson, appreciated
@husen199730
@husen199730 5 жыл бұрын
Great work ! thank you please when will be the next video
@garvitgoyal5236
@garvitgoyal5236 Жыл бұрын
your videos are amazing. Thanku for such content and effort.
@Ghkfdvbj
@Ghkfdvbj 4 жыл бұрын
Hi, Thanks for posting this OpenCV videos. Here I have a doubt why should we use hsv image to mask, why can't we do same on normal bgr (original) image. is there any disadvantage. I wrote same code to mask on original bgr image and working fine (I used same image example you have used). Do we get any problem when I use some other image which has more different colours. Please reply.
@lamborghinicentenario2497
@lamborghinicentenario2497 4 жыл бұрын
Hello, Great video! Can this method be used to track a small black object (7.5cm radius) over a white background going at 75mph(33.5m/s) over a 10 meter frame length captured by the camera? Do you think it would be able to track such a fast small object?
@bhanupratap9667
@bhanupratap9667 4 жыл бұрын
you r doing great. Thanks
@joonauutela581
@joonauutela581 4 жыл бұрын
Love the way you produce python.
@maheepchaudhary4200
@maheepchaudhary4200 4 жыл бұрын
produce.....seriously bro hahahaahh
@Pilua_hanuman
@Pilua_hanuman 3 жыл бұрын
great work and nice explanation
@srinivasancheenu1908
@srinivasancheenu1908 3 жыл бұрын
well explained...and executed...
@bobbyleescott
@bobbyleescott 4 жыл бұрын
How would you use this and then have the camera only look at a specific location and tag it when it sees the color you are looking for. I want to put a box on the screen and then whenever the color flys by it I want to have a counter tick off and have that go continuously.
@bhavyaganatra8842
@bhavyaganatra8842 4 жыл бұрын
Amazing sir!!!
@qzorn4440
@qzorn4440 2 жыл бұрын
can you use the camera to detect the objects color values in HSV or BGR, then use these values along with the track-bar to fine tune the result? thank you great video...:)
@JNET_Reloaded
@JNET_Reloaded 5 жыл бұрын
How do I do face detection using open cv with mp4 vids?
@proturguenev1820
@proturguenev1820 4 жыл бұрын
thanks for the content!
@abhilashsaha6098
@abhilashsaha6098 5 жыл бұрын
Yogesh is back!
@lexxsonquayeson
@lexxsonquayeson 4 жыл бұрын
great one. please we need a practical video on fruits detection. thank you
@niranjanalagappan1202
@niranjanalagappan1202 4 жыл бұрын
just add the picture of the fruit with the same code and match its color
@niranjanalagappan1202
@niranjanalagappan1202 4 жыл бұрын
how can I add a counter with this so that I can count the number of objects I detection ?
@mohamedelaminebouhadjer3068
@mohamedelaminebouhadjer3068 5 ай бұрын
informative video thank u. i had problem i want to extract lower and upper indices for an object, if there is any method to applicate ??
@siddharthmishra8012
@siddharthmishra8012 4 жыл бұрын
Why do we need two same source as frame
@jeepjr
@jeepjr 2 жыл бұрын
Teacher, first congratulations for the channel. I need your help, I have a simple image with a range of 5 placements where the quantity is identified, how do I identify the biggest color type red and say where the X,Y is, and if you can help me, and only for create an alert?
@crisjadeagtang8244
@crisjadeagtang8244 5 жыл бұрын
is it possible to compare the brightness/whiteness of an object in an image(white object with green background) Thank you in advance 😀 I really really need your help.
@godwinp8211
@godwinp8211 5 жыл бұрын
nice work. I try to detect blue circle from real-time webcam and mark circle border on that blue target, I want to develop this in javascript and opencv.js, but HoughCircles not working for videos but it is working on an image, please guide we with this any example.
@omeralperensari7067
@omeralperensari7067 2 жыл бұрын
What can be done so that it does not detect another blue color. I am building an autonomous vehicle and performing color tracking. What can be done to prevent the vehicle from heading towards another object of the same color?
@uprisingstark8954
@uprisingstark8954 9 ай бұрын
thanks for this level tutorial sir but can you tell me how it is diffferen from the object detection with tensorflow api ?
@canaldojukiti
@canaldojukiti 2 жыл бұрын
Hi, at first, thank you so much for the video. I have a little question. I've trying to track white objects. I had tried to use the follow parameters = l_w = ([240,240,240]) , u_w = ([255,255,255)]. I was not successful. Can you help me with the parameters? What are the best one to detect white objects? Thank you!
@maheshmec1
@maheshmec1 2 жыл бұрын
very useful
@nygline7297
@nygline7297 3 жыл бұрын
Everything is working very fine and smoothly when I am working on Pycharm, but for some reason I had to switch over to Google Colab and when i ran cv2.namedWindow("Tracking") this is what i got "Your session crashed after requesting an X window. The X Window System is not available in Colab." Any suggestions would ,mean a lot ..Thanks
@shashanksharmadon4295
@shashanksharmadon4295 4 жыл бұрын
Thanks bro.,...
@JaikishanJaikumar
@JaikishanJaikumar 4 жыл бұрын
ur awesome sir
@amitkhan737
@amitkhan737 2 жыл бұрын
that's a great tutorial. thanks a lot. but isn't the maximum value for hue should be 179?
@giovaniaricetti8639
@giovaniaricetti8639 4 жыл бұрын
Wow, it was a excelent video. I'm going to follow your videos. I have a beginner question: how python IDE are you using?? Thank you.
@mitkoatanassov6350
@mitkoatanassov6350 4 жыл бұрын
He's using Pycharm
@rahuldhankhar168
@rahuldhankhar168 3 жыл бұрын
how do i find the upper and lower hsv values for a specific color??
@nowaykid100
@nowaykid100 5 жыл бұрын
Brilliant 🙏🏻
@arbjful
@arbjful 3 жыл бұрын
I want to detect a black color material placed on another black color material....Is this possible?? Do I have to do edge detection in this case??could you explain how??
@pottisuperfarmhk1327
@pottisuperfarmhk1327 4 жыл бұрын
Hi, our school lab is trying to develop a simple tool to help our vision impair students to recognize the color from testing results. Can you help us? Thx!
@fun-ih5sc
@fun-ih5sc 4 жыл бұрын
Sir/Anyone How cv2.inrange function is working could you please explain a bit. And 9:23 line no: 19 , why taking same image frame two times. Thank you in advance
@abdultaufiq2237
@abdultaufiq2237 3 жыл бұрын
if you got the answer then please tell me also
@adityaanand5686
@adityaanand5686 3 жыл бұрын
@@abdultaufiq2237 @Abdul Taufiq what is happening here is.. "mask=cv2.inrange(image,LB,UB)" It will give you a kind of filter. Means when you use "mask" on any image(line no 19 ) then any "pixel" of that image is whose value is in between "LB and UB" will be set to 255(white) otherwise it will be 0(black).
@NguyenNhan-yg4cb
@NguyenNhan-yg4cb 3 жыл бұрын
hey bro, how do you know the blue color is 82 51 51 133, please explain to me. Thank you very much
@AlexShoyhit
@AlexShoyhit 4 жыл бұрын
Great tutorial how can you draw rectangle around the object?
@maheepchaudhary4200
@maheepchaudhary4200 4 жыл бұрын
given in previous video
@airobot8733
@airobot8733 2 жыл бұрын
good
@noel154
@noel154 3 жыл бұрын
*thanks*
@makerspace421
@makerspace421 3 жыл бұрын
what program is he using
@Nilesh2sonu
@Nilesh2sonu 4 жыл бұрын
My trackbar doesn't show the values automatically like in the video. Also the sequence these bars appear in the window is not the same as that in program. That is not the case in this video. The code is exactly the same. Is it because of version difference of opencv? I'm at version 4.2.0
@smritipradhan6921
@smritipradhan6921 3 жыл бұрын
I am also facing the same issue . If you have came up with the solution please help
@engulfing_marubozu
@engulfing_marubozu 3 жыл бұрын
Please change the ouput screen's name and set it to your current project name/slide name
@sudharsanb9391
@sudharsanb9391 3 жыл бұрын
whenever i try to capture video it is giving this error.What to do ??pls help me [ WARN:0] global C:\projects\opencv-python\opencv\modules\videoio\src\cap_msmf.cpp (681) CvCapture_MSMF::initStream Failed to set mediaType (stream 0, (640x480 @ 30) MFVideoFormat_RGB24(unsupported media type)
@randalllionelkharkrang4047
@randalllionelkharkrang4047 4 жыл бұрын
I wrote the exact same code for the smarties example but its not dynamically changing the color, when i slide the track bar.
@surbhiagrawal3951
@surbhiagrawal3951 3 жыл бұрын
my code is also not working ..if u know the solution please let me know
@jaganramanikanth9578
@jaganramanikanth9578 3 жыл бұрын
@@surbhiagrawal3951 me too
@deepak223098
@deepak223098 3 жыл бұрын
use cv2.waitKey(1) : tracker will work :)
@HM-cw8im
@HM-cw8im 3 жыл бұрын
@@deepak223098 Thank you for this :D
@mohsin4397
@mohsin4397 4 жыл бұрын
what does line 5 mean?
@nirmitgangurde8561
@nirmitgangurde8561 3 жыл бұрын
Output is being displayed, no error, but still tracebar unable to detect color. Can anyone please help me with this?
@mitulpanchal2312
@mitulpanchal2312 4 жыл бұрын
May I know what bitwise_and doing here with the mask?
@cloudboysmusic5223
@cloudboysmusic5223 3 жыл бұрын
mask has range values for type of blue he is trying to detect, he and those values with the output from his video capture to only display the blue object
@rafidj7575
@rafidj7575 4 жыл бұрын
hi there.. every time i run the program and capture a video from the camera the video stops unless i keep pressing the space or the enter button to keep the video capturing ..anyone here knows the problem ?
@syedufaqhaider2796
@syedufaqhaider2796 3 жыл бұрын
In waitkey put 0 between the brackets like this : (0)
@meethansaliya4885
@meethansaliya4885 3 жыл бұрын
why are my hsv upper and lower points aree different ? in this video, for blue colour l_b = (110,50,50) and u_b =(130,255,255) while i tried, for blue colour l_b= (0,114,0) and u_b = (21,223,255) can anyone explain this?
@skywalker778
@skywalker778 4 жыл бұрын
Why did you read the image every iteration, Is this like, not good for your hard drive ?
@syedufaqhaider2796
@syedufaqhaider2796 3 жыл бұрын
Why my tracking window is not showing up
@madhavaprashath1453
@madhavaprashath1453 3 жыл бұрын
why to convert BGR to HSV color space ?
@lx4302
@lx4302 2 жыл бұрын
i flunked my project because of wrong hsv. i couldnt get the hsv ranges right :(.
@tedmosby9409
@tedmosby9409 4 жыл бұрын
if you go to a line you want to copy just Ctrl + D and it duplicates it , pycharms its wicked for linux ;)
@tretrei7967
@tretrei7967 4 жыл бұрын
Stop programming and start looking for a wife Ted!
@nadaalshaer2600
@nadaalshaer2600 4 жыл бұрын
I am getting this error (line 14, in hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV) # convert color to HSV cv2.error: OpenCV(4.1.1) C:\projects\opencv-python\opencv\modules\imgproc\src\color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor' any help guys I tried fixing it
@Yonosoyninguien
@Yonosoyninguien 4 жыл бұрын
Check is your image name is right
@lx4302
@lx4302 2 жыл бұрын
well actually its funny because i have used this code from so before i watched this
@nishantpratapsingh3172
@nishantpratapsingh3172 4 жыл бұрын
Why my tracker system does not change colour
@syedufaqhaider2796
@syedufaqhaider2796 3 жыл бұрын
Same problem bro
@engulfing_marubozu
@engulfing_marubozu 3 жыл бұрын
Please change the ouput screen's name and set it to your current project name/slide name
@Vformilyoner
@Vformilyoner 4 жыл бұрын
wow that's perfect body
@markgrindcore4935
@markgrindcore4935 4 жыл бұрын
If your tracker does not work, check if you pass anything inside cv2.waitKey(). (It strange, i know.....)
@IDixuu
@IDixuu 4 жыл бұрын
LOL thx i had that problem
@syedufaqhaider2796
@syedufaqhaider2796 3 жыл бұрын
Thanks i had the same problem 🙌 but bro why it's not showing when I'm putting zero in brackets instead of 1
@surbhiagrawal3951
@surbhiagrawal3951 3 жыл бұрын
@@syedufaqhaider2796 hey , i alo earlier write (0) ..after i changed to 1 ..its working ..any explanation for this
@tongruiwei5657
@tongruiwei5657 3 жыл бұрын
i think hue is between 0-180 in opencv-python
@tongruiwei5657
@tongruiwei5657 3 жыл бұрын
but ists np when u set 0-255, just talk about details
@bartekkubacki26
@bartekkubacki26 5 ай бұрын
17:39 little sussy
@nikhilrana8800
@nikhilrana8800 4 жыл бұрын
This code does not work for me.
@smritipradhan6921
@smritipradhan6921 3 жыл бұрын
Me too .. if you have solutions please help
@kuldeepkawar1104
@kuldeepkawar1104 Жыл бұрын
@@smritipradhan6921 type 1 in waitkey
@AbhishekPandey-rl8vz
@AbhishekPandey-rl8vz 4 жыл бұрын
I'm getting a TypeError: Expected Ptr for argument '%s' --> res= cv.bitwise_and(frame,frame,mask=mask) Pls resolve it
@abhishekdebnath8895
@abhishekdebnath8895 3 жыл бұрын
How S & V value become greater than 100
@jayprajapati1025
@jayprajapati1025 4 жыл бұрын
Why we are using ' _, ' in the following line " _, frame = cap.read() "
@karthikeshwar
@karthikeshwar 4 жыл бұрын
Because we don't need that value. If you need it, then just put a variable return, frame = cap.read()
@mitkoatanassov6350
@mitkoatanassov6350 4 жыл бұрын
it's just a bool value, which we don't rlly care about.
@rungekutta5732
@rungekutta5732 2 жыл бұрын
Only good thing is the English accent 😁😅🤡
OpenCV Python Tutorial For Beginners 14 - Simple Image Thresholding
13:09
ProgrammingKnowledge
Рет қаралды 70 М.
Follow @karina-kola please 🙏🥺
00:21
Andrey Grechka
Рет қаралды 25 МЛН
Super sport🤯
00:15
Lexa_Merin
Рет қаралды 19 МЛН
КАХА и Джин 2
00:36
К-Media
Рет қаралды 3,8 МЛН
ОДИН ДОМА #shorts
00:34
Паша Осадчий
Рет қаралды 6 МЛН
MacBook Laptop Computer Touchpad Trackpad Mouse Left Click Not Working Potential Solution Repair
2:05
It's Binh (Been) Repaired & Everything Reviewed
Рет қаралды 3,7 М.
the TRUTH about C++ (is it worth your time?)
3:17
Low Level Learning
Рет қаралды 588 М.
How to Install Putty (SSH Client) on Ubuntu Linux
4:40
LinuxTechi
Рет қаралды 924
Rust's Alien Data Types 👽 Box, Rc, Arc
11:54
Code to the Moon
Рет қаралды 131 М.
Java - Gráficos com JFreeChart - Download das bilbiotecas
1:25
Programinhas
Рет қаралды 1,5 М.
Follow @karina-kola please 🙏🥺
00:21
Andrey Grechka
Рет қаралды 25 МЛН