Python OpenCV Color Detection Example

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello youtubers on pervasion this is our 16th video in OpenCV peyten open CV or open computer vision so in the previous video we have learned about simple eye detection in osep so this is from the previous example that you can watch my blog or getting the source code and more information about this or you can watch the video in this video I'm going to show you a simple color detection and open CV so I created and you fight and find also I have an image so you can see I have different images in here I want to do some color detection for example this blue one and also for the striped one I have already copied this image if you want that as soon as you can get this image from from my block ok now the first thing I need I'm going to import a CV to and after that I'm going to import numpy as NP so first let me talk about color space in Open City color spaces so as you know we have our DB color that is red green blue but in open CV we have a BG our color we have blue green and red not RGB this is video also there are if you have watched my colorist places video you can watch that because it's important we have more than 100 fighting 150 it was one rip 250 color spaces I often see that we can use them so but now let me just first I'm going to load my image source AV 2 dot image and my image name is IMG topped PNG like this okay after this now we need to convert because our this PNG image is it's an RGB color and we need to convert this to HSV it's another colored space in OpenCV HSV and CV to convert color and IMG and I want to convert this say v2 dot color underscore BGR to HSV so we are going to convert our video our color to HSV so now after this we need to determine our the lower range and the upper range of the color so so far the for determining a lower and upper range and you can use in details also you can use some more for example you can determine the range of color so now I have already determined let me write lower range and this is NP dot array in P dot array and I want to give it 110 50 and 50 so for the upper range and P dot array and I want to give it 130 255 and 255 okay so in this section I want let me bring the image oh yeah the image up I want to detect this blue one in here and here and here I want to detect these three in this image so this is the same color these three we now up I want to create a mask CV 2000 range add your HSV color and also add your lower range and also upper range in here okay after creating masks we need to show our real image and our mosque so CV to do not you show and this is our image and CV to dot M show and this is our mosque see v2 dot wait wait G and C B 2 dot destroy our windows like this okay so now this is my simple code for simple color detection let me run this okay so now you can see how you can see that we have one color in here we have two ticked it this is the other color and this is the another clue let me just detect this two red color and for this let me just change the these values to because we have another red says another volume one hundred sixty nine hundred and hundred and this is a one hundred eighty nine 189 255 255 so let me run this again yeah you can see that this is this one and the skullery this one so like this you can do simple our color detection in OpenCV if you have any question please let me know I will add a source to the video description you can subscribe to my channel and also you
Info
Channel: Parwiz Forogh
Views: 53,786
Rating: undefined out of 5
Keywords: Python OpenCV Color Detection Example, Python, OpenCV, OpenCV Color, OpenCV Color Detection, learn OpenCV, Color Detection Example, opencv for beginners, OpenCV tutorial, Open Computer Vision, learn Open Computer Vision
Id: sB9DjPH6Xmg
Channel Id: undefined
Length: 6min 21sec (381 seconds)
Published: Wed Jun 26 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.