OpenCV Python Tutorial #5 - Colors and Color Detection

Поделиться
HTML-код
  • Опубликовано: 11 май 2024
  • Welcome to this video in the OpenCV tutorial series! In this one, I'll be talking about colors and how to detect them. We can even detect specific colors from our video feed and only display those colors. We'll also go over color display methods like RGB, BGR, and HSV.
    💻 AlgoExpert is the coding interview prep platform that I used to ace my Microsoft and Shopify interviews. Check it out and get a discount on the platform using the code "techwithtim" algoexpert.io/techwithtim
    📄 Relevant Documentation: opencv-python-tutroals.readth...
    📝 Code For This Series: github.com/techwithtim/OpenCV...
    🔍 Playlist: • OpenCV Python Tutorials
    ⭐️ Timestamps ⭐️
    00:00 | Introduction
    00:45 | HSV Color
    06:40 | Masks
    ◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️
    💰 Courses & Merch 💰
    💻 The Fundamentals of Programming w/ Python: tech-with-tim.teachable.com/p...
    👕 Merchandise: teespring.com/stores/tech-wit...
    🔗 Social Medias 🔗
    📸 Instagram: / tech_with_tim
    📱 Twitter: / techwithtimm
    ⭐ Discord: / discord
    📝 LinkedIn: / tim-ruscica-82631b179
    🌎 Website: techwithtim.net
    📂 GitHub: github.com/techwithtim
    🔊 Podcast: anchor.fm/tech-with-tim
    🎬 My RUclips Gear 🎬
    🎥 Main Camera (EOS Canon 90D): amzn.to/3cY23y9
    🎥 Secondary Camera (Panasonic Lumix G7): amzn.to/3fl2iEV
    📹 Main Lens (EFS 24mm f/2.8): amzn.to/2Yuol5r
    🕹 Tripod: amzn.to/3hpSprv
    🎤 Main Microphone (Rode NT1): amzn.to/2HrZxXc
    🎤 Secondary Microphone (Synco Wireless Lapel System): amzn.to/3e07Swl
    🎤 Third Microphone (Rode NTG4+): amzn.to/3oi0v8Z
    ☀️ Lights: amzn.to/2ApeiXr
    ⌨ Keyboard (Daskeyboard 4Q): amzn.to/2YpN5vm
    🖱 Mouse (Logitech MX Master): amzn.to/2HsmRDN
    📸 Webcam (Logitech 1080p Pro): amzn.to/2B2IXcQ
    📢 Speaker (Beats Pill): amzn.to/2XYc5ef
    🎧 Headphones (Bose Quiet Comfort 35): amzn.to/2MWbl3e
    🌞 Lamp (BenQ E-reading Lamp): amzn.to/3e0UCr8
    🌞 Secondary Lamp (BenQ Screenbar Plus): amzn.to/30Dtafi
    💻 Monitor (BenQ EX2780Q): amzn.to/2HsmUPZ
    💻 Monitor (LG Ultrawide 34WN750): amzn.to/3dSD7tS
    🎙 Mic Boom Arm (Rode PSA 1): amzn.to/30EZw9m
    🎚 Audio Interface (Focusrite Scarlet 4i4): amzn.to/2TjXsih
    💸 Donations 💸
    💵 One-Time Donations: www.paypal.com/donate?hosted_...
    💰 Patreon: / techwithtim
    ◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️
    ⭐️ Tags ⭐️
    - Color detection in OpenCV
    - Colors OpenCV
    - HSV OpenCV
    - Python
    - Computer vision
    - Cameras and video capture
    ⭐️ Hashtags ⭐️
    #OpenCV #Python #CameraCapture

Комментарии • 87

  • @SadSack963
    @SadSack963 2 года назад +35

    For others like me who struggled to create the numpy array:
    I kept getting
    > Unsupported depth of input image:
    > 'VDepth::contains(depth)'
    > where
    > 'depth' is 4 (CV_32S)
    This indicates that the numpy array consists of 32 bit signed integers which are not supported by cvtColor.
    You should create your array like this, specifying datatype uint8:
    bgr_color = np.array([[[blue, green, red]]], dtype=np.uint8)

  • @TheDtkxiang
    @TheDtkxiang 3 года назад +5

    I was looking into machine vision and this video's content on mask and hsv inspired me on the direction i should move in.
    If this had appeared earlier, i would not have wasted time figuring out canny and harris corner detection.
    Not that they are bad, just that I prefer simple solutions that I have full understanding of.
    Keep up the great work.

  • @CubixCreations
    @CubixCreations 3 года назад +9

    Another amazing video Tim, thank you!

  • @labscience8271
    @labscience8271 Год назад +19

    1:11
    HSV = Hue, Saturation, Value
    HSL = Hue, Saturation, Lightness
    Both are a bit different from each other.

  • @alexanderwang2484
    @alexanderwang2484 2 года назад

    This is such a well made tutorial series.

  • @ntechplayz6155
    @ntechplayz6155 Год назад

    Love the way you explain things, well done!!!

  • @smoothrain
    @smoothrain 3 года назад +3

    Hello Tim you’re such an amazing youtuber keep it up👏👏👏👏. From Kenya love you❤️💖

  • @timsosnora2151
    @timsosnora2151 3 года назад +2

    Thank you so much for your tutorials !!!!

  • @Doraredora
    @Doraredora 3 года назад +2

    You deserve this 🙏 Tim proud to be your subscriber

  • @theebookkeeper
    @theebookkeeper 3 года назад +1

    this is educative. great work.

  • @JuANdELAMANaNA695
    @JuANdELAMANaNA695 2 года назад +14

    the HSV colors do not match what all the color pickers say, and i cant find one that goes from 0-255, all use degrees and %. i dont know how to get any correct HSV colors

  • @arjunsahlot
    @arjunsahlot 3 года назад +31

    HSV stands for hue, saturation, value. 1:10

    • @ryuzu438
      @ryuzu438 3 года назад +3

      lmao i was gonna comment that ahahaha

  • @johngroebe9373
    @johngroebe9373 9 месяцев назад

    Great set of tutorials!! I guess that before displaying the images regular on the screen the color scheme should be converted back from HSV to BGR?

  • @index-zero
    @index-zero 3 года назад

    Awesome as always 👍

  • @chuchumuruplayz6866
    @chuchumuruplayz6866 3 года назад

    Just Wanted To Say I Love Your Videos! Can You Do A Tutorial On The Game Show Countdown Conundrum, It Would Be Very Much Appreciated. Keep Up The Good Work!

  • @acm1812
    @acm1812 3 года назад

    Great video Tim!👍

  • @fionanathanson6580
    @fionanathanson6580 3 года назад

    Awesome video Tim 👍

  • @jaimehernandezprado6356
    @jaimehernandezprado6356 2 года назад

    Great tutorials. Is there one for shadow detection and substraction?

  • @SAMETELMACI
    @SAMETELMACI 3 года назад

    youre awesome dude, please keep going

  • @drydenstewartinc.7710
    @drydenstewartinc.7710 3 года назад +2

    Hey Tim, I have an idea for a tutorial I would love it if you would consider it. How to get open cv and a pyttsx3 python chat bot working together. I'm trying on my own as a beginner programmer to build a personal assistant robot that can function offline, I want to be able to ask it to identify an object, not having to display it on a screen but to verbally respond to what the object is. also, I want to incorporate s.l.a.m. into it ( I already bought 2 identical webcams for stereo vision), so it can map its environment and remember that map and update that map each time it passes through that location. It might be a bit of a challenge I'm sure, but you really have simplified so much for me so far, I really hope you will accept this!

  • @edwardedward7765
    @edwardedward7765 3 года назад +8

    Hello Tim, how are you ? Last time you talked about MS VSC and it was very helpful. Many thanks ^_^

  • @parthkabra4968
    @parthkabra4968 3 года назад

    i am watching this in a flow!!

  • @naokimc
    @naokimc 2 года назад +2

    now i finally know how green screen works, yay!

  • @johnvincentrajc6282
    @johnvincentrajc6282 2 года назад

    Very Interesting video series

  • @learnwithnawf246
    @learnwithnawf246 3 года назад +1

    Cheers Tim :)

  • @Life-zx5wp
    @Life-zx5wp 2 года назад

    thank you my big fan 😃

  • @tuminh9656
    @tuminh9656 Год назад +1

    Hi Tech With Tim, if the background color is similar to the object color, is there a way to detect and draw only the outline of the object?pyD

  • @nadraibrahim6400
    @nadraibrahim6400 Год назад

    Hey Tim! thank you for this wonderful tutorial.
    but how to get the range of colors like you did for blue. Actually I am doing a project in which colors are detected and then i want to replace that color object with a different color. like, changing the color of a t shirt.

  • @hobbitthegobbit
    @hobbitthegobbit 2 года назад

    Hey man, amazing video. Can I ask how to put rectangle on the image after that. I mean yes mask find blue, then i want to put a rectangle to show it on screen. Thank you

  • @lukajeliciclux3074
    @lukajeliciclux3074 3 года назад

    @TechWithTim V in HSV mean value for value of brightness

  • @MrHellmeowmix
    @MrHellmeowmix 2 года назад

    If i wanted to use colors other than blue, am I trying to identify the color spectrum as they appear in my HSV image? like my red shirt turned green, so do I aim for the green values, or the original red values but with their HSV values?

  • @toapyandfriends
    @toapyandfriends Год назад +1

    I do visual effects work and I'm trying to write an openCV that will detect diffuse maps out of a group of normal maps and bump maps and diffuse maps and occlusion maps and roughness maps and metal maps I can't place examples of these images here you could Google and find them but can you show me how to write an open CV that will do that?

  • @malek3764
    @malek3764 3 года назад

    Can you add this video to the OpenCV playlist?

  • @rkade159
    @rkade159 3 года назад +25

    Episode 5: Hello everyone, today we are going to be detecting colors.
    Episode 15: HACKING INTO A DRONE AND SPYING ON THE GOVERNMENT...

  • @ramandeepsingh8896
    @ramandeepsingh8896 3 года назад +1

    how you get the minimum and maximum pixel value for blue color....pls help.

  • @dreamwork69
    @dreamwork69 Год назад

    V is stand for Value in Graphic Field it means Brightness

  • @lifesgood5065
    @lifesgood5065 3 года назад +1

    next video tutorial series How to solve the rubics cube?

  • @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?

  • @vjx1163
    @vjx1163 2 года назад

    Help? if i set the VideoCapture value (webcam number) to anything other then 0 the cote doesnt work. i am trying to use the obs virtual camara but it will only accept 0 which is my main webcam.

  • @sercanalnca1962
    @sercanalnca1962 10 месяцев назад

    Hi everyone. Is it possible to fill the area with any number that contains the same color?

  • @Malkawi_FTP
    @Malkawi_FTP 2 года назад +1

    V in HSV stands for vibrance

  • @princemajestal8100
    @princemajestal8100 2 года назад +2

    Supposing I would want to send a signal or print something on the screen when a certain color is detected, how would I proceed?

  • @sakethgupta2885
    @sakethgupta2885 3 года назад

    I'm pretty sure 1 and 0 = 1 and those stuff are called Truth Tables. They are pretty much like multiplication in maths. Consider the 1 as + and 0 as - and the "and" as * , then 0 and 1(- * +) = -(0). Its something likes that anyway you can go ahead and search in google about it.

    • @sauvikmondal4828
      @sauvikmondal4828 2 года назад

      so you're saying (0 and 0) is 1 cause (- * -) = +

    • @13bimbou
      @13bimbou 7 месяцев назад

      1 and 0 is 0

  • @KrishuBrawlStars
    @KrishuBrawlStars 3 года назад +1

    Sir full tutorial of flask!!!! Plzz..... 🥺🥺🙏🏼🙏🏼🙏🏼

    • @yuvaraj_i
      @yuvaraj_i 3 года назад

      Check the playlist

  • @_shivi_7425
    @_shivi_7425 Год назад

    please help i am getting the following error "module 'cv2' has no attribute 'bitswise_not'"

  • @oskarkottom8365
    @oskarkottom8365 Год назад

    hsv means hue saturation and value

  • @teacheronat
    @teacheronat Год назад

    BGR of Color: [[[255 0 0]]]
    HSV of Color: [[[120 255 255]]]
    Lower Limit: (110, 100, 100)
    Upper Limit: (130, 255, 255)

  • @rwtNitin
    @rwtNitin 3 года назад

    How can u convert a black and white image to colored image

  • @muhammadanique2256
    @muhammadanique2256 2 года назад +2

    What changes are required if we want to detect green instead of blue? Tim explained it but i couldn't get it. Anyone?

    • @balarohank4416
      @balarohank4416 2 года назад +1

      same question

    • @ItsMe28755
      @ItsMe28755 Год назад

      Change the HSV values in the upper_blue and lower_blue variables

  • @dan-cj1rr
    @dan-cj1rr 3 года назад

    It's all fun and games when you have a clear image, but when you have an image with unclear colors and poor quality, it becomes hard

  • @DGHere12
    @DGHere12 3 года назад

    Hello, TechWithTim

  • @TechnicalRNP
    @TechnicalRNP 3 года назад +1

    Create Chroma Key using OPENCV

  • @hissy_dev
    @hissy_dev Год назад

    why do i get white image instead blue

    • @hissy_dev
      @hissy_dev Год назад

      omg i was using blue filter screen

  • @davidcarlson2481
    @davidcarlson2481 2 года назад

    HSV = Hue, Saturation, Value

  • @addledanorak8297
    @addledanorak8297 3 года назад +1

    Second

  • @lucasanss3294
    @lucasanss3294 3 года назад

    #6 and #7 just got private

  • @ArunKumar-ls4bl
    @ArunKumar-ls4bl 3 года назад

    am i the only one who asks every time myself when i watch tim .... why doesn't TIM grow his HAIR? .... i want to see that look.

  • @manewry66tw
    @manewry66tw 3 года назад +2

    Tim finally showed his evil nature.

  • @hey9530
    @hey9530 2 года назад

    hsv tutorial leftg me confused

  • @meFawadIqbal
    @meFawadIqbal 2 года назад

    Cuther = Color

  • @yrath5034
    @yrath5034 3 года назад +2

    Can I ask why you pronounce "Color" as "Cother"?

  • @ammartaj4205
    @ammartaj4205 2 месяца назад

    cothers

  • @adrien123_
    @adrien123_ 3 года назад

    hey

  • @lavia5206
    @lavia5206 3 года назад

    First

  • @sakethgupta2885
    @sakethgupta2885 3 года назад

    I see. I see where this is going
    FACIAL RECOGNITION
    AWEEESOMMEEEEEEE.

  • @parthkabra4968
    @parthkabra4968 3 года назад

    12:07 u really look weird after coming back to the original world!

  • @ananthramvijayaraj4554
    @ananthramvijayaraj4554 3 года назад

    First

  • @kikku4304
    @kikku4304 3 года назад

    Second