Detecting Colour in an Image using OpenCv and Python

preview_player
Показать описание
OpenCV (Open Source Computer Vision Library) is released under a BSD license and hence it’s free for both academic and commercial use.

We detect colour in in an image using the HSV range of the colour we need to detect using OpenCV and Python.

HSV Range for various colours:

lower_black = [0,0,0]
upper_black = [250,255,30]

lower_white = [0,0,255]
upper_white = [0,0,255]

lower_red = [0,150,50]
upper_red = [10,255,255]

lower_green = [45,150,50]
upper_green = [65,255,255]

lower_yellow = [25,150,50]
upper_yellow = [35,255,255]

lower_light_blue = [95,150,0]
upper_light_blue = [110,255,255]

lower_orange = [15,150,0]
upper_orange = [25,255,255]

lower_dark_pink = [160,150,0]
upper_dark_pink = [170,255,255]

lower_pink = [145,150,0]
upper_pink = [155,255,255]

lower_cyan = [85,150,0]
upper_cyan = [95,255,255]

lower_dark_blue = [115,150,0]
upper_dark_blue = [125,255,255]
Рекомендации по теме
Комментарии
Автор

Can we detect multiple color in a same image?

ananthu_
Автор

Thanks, it was helpful. can we detect multiple colors from the same picture? if yes then what we need to enclose at the mask.

rubs
Автор

how can we get the percentage of each color present in the image.

nikhilgupta
Автор

how to find the percentage of perticular colour in the image ??

pratyushtripathy
Автор

sir, how we can decide lower and upper values?

pritam
Автор

at 01:14, it is giving an error of figsize is not defined.

goyaldeekshant
Автор

How you have identified the hsv ranges for various color? please share the logic for the same

sangeetapalekar
Автор

from where we can get the upper and lower values of u for all colors ..?

TheNishi
Автор

sir how to calculate the depth of blue color

amitm
Автор

Why isn't the and operator working in my device can u help

taesboxysmile
Автор

is there any reference for color upper and lower range? I need range for light gray color .
thank you

rama_bhuyan
Автор

I need to recognize the color and then draw a line on where ever the color is there can you help?

padmavathynarasareddygari
Автор

can i get the percentage of the color, the script detects and print it.

vishurana
Автор

can you get the pixel size of the detected color?

rahulazmeera
Автор

Is there a way to detect image background color? Please advice...

satishbanka