Skip to content

Beginners Opencv · Tutorials

Morphological transformation – OpenCV 3.4 with python 3 Tutorial 17

Access community, courses and source codes
Logo

AI Vision Academy

Access the code of this tutorial, computer vision courses and an exclusive community on AI Vision Academy

  • Access to over 50+ source codes from Pysource.com/blog
  • Dedicated video courses about computer vision
  • Access to an exclusive community of professionals
  • Real-World AI Projects – Get hands-on experience building practical AI Computer Vision solutions with a structured path.
  • Monthly Coaching Calls – get support and any of your questions answered

Subscribe to our newsletter to learn more

3 comments

  1. If I do not want to have the track bars would I just have to define the HSV numbers in my code? I want to track R,G,B,Y objects and I do not want to be using a track bar every time to adjust for them. Also how could I add on more colors to this code (tutorial 17 second code)?

    Thank you

    1. You don’t have to use trackbars, I use them only because it’s easier to find the range in real time.
      If you already know the HSV values, you can just type them instead of using trackbars:

      for example:
      lower_blue = np.array([0, 75, 42])
      upper_blue = np.array([155, 255, 180])

      You can add more colors, by creating more masks. Each color must be detected indivitually and then you can link the masks together at the end.

Join the discussion