Simple Color recognition with Opencv and Python

  Переглядів 63,875

Pysource

Pysource

2 роки тому

Blog : pysource.com/2021/10/19/simpl...
In this tutorial, we will learn how to use simple color recognition with python. We will also see the differences between the use of the BGR and HSV color format and therefore how to identify the color in real-time
➤ Courses:
Full Computer Vision course: pysource.com/object-detection...
Training Mask R-CNN PRO (Notebook + Mini-Course): pysource.com/mask-rcnn-traini...
➤ Follow me on:
LinkedIn: / pysource
➤ For business inquiries:
pysource.com/contact
#ColoroRecognition #OpenCV #Python

КОМЕНТАРІ: 74
@ScOrPiOnE905
@ScOrPiOnE905 2 роки тому
Thank you for the video, Sergio! I'd love to see a more advanced version using neural networks.
@OnFight1997
@OnFight1997 Рік тому
I managed to achieve what I wanted through "PIL" and "colorsys", but this helped me a lot, because previously I was checking RGB, but this video taught me about the Hue concept, which fits very well with my project. I optimized the hell out of it, previously it recognized 1 shade of 5 different colors and if it was 1 off it would break, now it recognizes a whole spectrum of those same 5 colors and works endlessly. Thanks.
@marinakim2929
@marinakim2929 2 роки тому
I'm just starting with ML and have to do an image recognition project - this tutorial is awesome to start, thank you
@josuedegbun6270
@josuedegbun6270 Рік тому
thanks man for this video. i haven't no skill in opencv and detection of image but i have been able to do the things that you've done in the video. you explain very well bro
@stefanAH97
@stefanAH97 2 роки тому
Excellent session! Advance color recognition video would be great.
@Eplemos4Life
@Eplemos4Life 2 роки тому
Very good sir! Thanks, you are helping me alot in my automation engineering.
@mitchfawcett3097
@mitchfawcett3097 2 роки тому
Thank you! You are an excellent teacher
@ahmed.bhewary775
@ahmed.bhewary775 2 роки тому
Sir, I love your job, keep up the good work
@imenecharabi8945
@imenecharabi8945 2 роки тому
Perfection !
@jackyli6716
@jackyli6716 2 роки тому
thanks for your video, that's so good.
@sardorabdirayimov
@sardorabdirayimov Рік тому
Awesome video for beginners:)
@acquabr1908
@acquabr1908 Рік тому
Very good video... Thank you very much...
@david1r200
@david1r200 2 роки тому
Very good! Ty
@sohithnarnavaram701
@sohithnarnavaram701 Рік тому
Thanks a lot sir. could you please explain more about selecting some common colors not just only with Hue but also with saturation and value like for example : How to we define for white color or black (cannot identify with Hue, got to change the saturation too)
@FullTimeKillerX
@FullTimeKillerX Рік тому
hi, thank you for your tutorial 1. i would like to apply it to compare 2 color in real life to find if the HSV value is the same or not (consider the lumens of the area is the same). 2. how can i make the pointer moveable by using mouse?
@ezaouikhatib1673
@ezaouikhatib1673 2 роки тому
Thank you for the video, please is it possible to retrieve the major color in a set of pixels (in a rectangle for example) ? I need it to identify the colors after the detection of objects using yolo v3 and oepncv.
@dibyojyotiroy3445
@dibyojyotiroy3445 Рік тому
You r damn good man... Just awesome 🖤
@ajaymusk6123
@ajaymusk6123 2 роки тому
thanks sir!!!!!
@bridge_ojm
@bridge_ojm 2 роки тому
thank you teacher
@mynameisconnorimtheandroid6080
@mynameisconnorimtheandroid6080 Рік тому
thank you!
@AiPhile
@AiPhile 2 роки тому
Thank you sir, I was looking for it ❤️
@thecomedyhitler9362
@thecomedyhitler9362 Рік тому
Thank you 😀😀😀🎉🎉
@hotdog2230
@hotdog2230 Рік тому
What if i wanted to detect different value of red from its lightest color to darkest? should i change it to value = value and about the range of color should itype the range or just "
@anassalhab3167
@anassalhab3167 Рік тому
Thank you very very much
@ishaanapte6570
@ishaanapte6570 2 роки тому
thanks!
@monganpipi6380
@monganpipi6380 2 роки тому
Please explain the change process of HUe_value during program debugging. It is very urgent😉
@asimaseem8412
@asimaseem8412 2 роки тому
How can consider both saturation n brightness with hue in the same code can u help me out plzz
@Majestal1
@Majestal1 2 роки тому
Hey! For some reason gimp and opencv are giving me totally different RGB and HSV value for the same pixel. How do I fix that?
@giriprasath6030
@giriprasath6030 Рік тому
Sir, I need your help to develop a code for detecting color of a painted car body and then comparing it with pre defined RGB values, so that the system can say that this is that particular color (for eg after detecting it should say 'this is tellurian blue'. I'm not a computer science engineer, I'm mechanical. But I need this for my final year project
@Tahir_CanKozan
@Tahir_CanKozan 2 роки тому
how do I find to white color ?
@progm6127
@progm6127 Рік тому
how can I detect color in a Particular area of the frame?
@riubotin
@riubotin 2 роки тому
Help me : if hue_value < 5: color = "RED" elif hue_value < 22: color = "ORANE" other: color = "" How to mix with saturation and value? I want to get a brown color but the value is
@AmeyBhobaskar
@AmeyBhobaskar Рік тому
How to add saturation and value with hue???
@AmeyBhobaskar
@AmeyBhobaskar Рік тому
How to add button for start and stop
@shanvishukla7292
@shanvishukla7292 Рік тому
Please share for black and white color too
@cyberhard
@cyberhard 2 роки тому
A more advanced version to detect all of the colors in an image or region of an image would be much appreciated.
@OHHfuckit
@OHHfuckit 2 роки тому
Just use bumpy to cut out a region of the image then create a histogram of that region.
@borallylyl8427
@borallylyl8427 9 місяців тому
Hello, I'm trying to create a program that detects and counts objects by color, but now I can only count four colors, these are red, blue, green and yellow. I wonder if I can add the whole color scale to the program, how can I do this? I will be very happy if you give back. have a nice day
@user-kg8hi4te8t
@user-kg8hi4te8t День тому
what if i want to use saturation???
@artzlawanwisut4009
@artzlawanwisut4009 Рік тому
Why i dont recive confirm email on blog ?
@remyatherese352
@remyatherese352 Рік тому
error: (-27:Null pointer) NULL window: 'frame' in function 'cvGetTrackbarPos' how to solve this type of error while creating the trackbar....could you please explain?
@shriniwasmhatre2652
@shriniwasmhatre2652 2 роки тому
Error cap value is not defined
@nailsplusbeauty4528
@nailsplusbeauty4528 2 роки тому
where you upload picture which one you use in this program??????
@pysource-com
@pysource-com 2 роки тому
It's in real time from the webcam, there are no pictures. source code is here pysource.com/2021/10/19/simple-color-recognition-with-opencv-and-python/
@DUde00231
@DUde00231 9 місяців тому
Hey Can I use vscode instead of pycharm ??
@fphoenix7144
@fphoenix7144 8 місяців тому
Yes
@joeyandrew2544
@joeyandrew2544 10 місяців тому
what the aplication that u use to run your program?
@rudrarudra9212
@rudrarudra9212 7 днів тому
Pycharm
@sudhishazare5438
@sudhishazare5438 2 роки тому
I'm getting this error (-215 : Assertion failed) ! _src. empty() in function 'cv::cvtColor'
@sudhishazare5438
@sudhishazare5438 2 роки тому
Please specify how to solve? Will it matter if I user spyder IDE?
@danielabu4761
@danielabu4761 2 роки тому
me to, please help?
@AmeyBhobaskar
@AmeyBhobaskar Рік тому
You got the reason why it's happening?
@LamVo-io6nn
@LamVo-io6nn Рік тому
cv2.error: OpenCV(4.5.5) D:\a\opencv-python\opencv-python\opencv\modules\imgproc\src\color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor', HOW TO FIX?
@AmeyBhobaskar
@AmeyBhobaskar Рік тому
There are one line which is present in this video not in project file just perform the steps as shown in video your code will be run
@marisalasser
@marisalasser 10 місяців тому
Great video! Tho when I tried to run the programm I got this error: [ERROR:0@0.114] global obsensor_uvc_stream_channel.cpp:156 cv::obsensor::getStreamChannelGroup Camera index out of range Traceback (most recent call last): File "c:\Users\maris\Desktop\simple color recognition\color_recognition.py", line 11, in hsv_frame = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cv2.error: OpenCV(4.7.0) D:\a\opencv-python\opencv-python\opencv\modules\imgproc\src\color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor' Can anyone help, please?
@memedoni
@memedoni 2 роки тому
How would you determine white/gray/black objects?
@pysource-com
@pysource-com 2 роки тому
This was a very basic and intuitive version of the color based on the HUE value. If you want to determine white/gray/black objects, you will need to take into account also: SATURATION and BRIGHTNESS. Normally when both these values are very close to 255 and the HUE is close to 179, it's white. When saturation and brightness are close to 0, doesn't matter the HUE, it's close to be black (different gradients of it).
@memedoni
@memedoni 2 роки тому
@@pysource-com Woah that was a quick reply! The problem i currently have is that i'm calculating the dominant pixel value of an area of my video frame, and what i'm trying to do is interpret that value to be more meaningful. I need the folowing colors: Ochre, Yellow, Green, Blue, White(or close to white) and Dark gray. Using the folowing: if (hue
@RajSharma-ui5vq
@RajSharma-ui5vq 2 роки тому
@@memedoni Did You solve the issue. I also facing the same probelm. White is represented as Green.
@asimaseem8412
@asimaseem8412 2 роки тому
@@pysource-com how to consider both saturation and brightness with hue value cant detect white n black can u help me out
@AmeyBhobaskar
@AmeyBhobaskar Рік тому
Which python ide you are using
@MohammedShamsan_AI
@MohammedShamsan_AI 2 роки тому
line 10, in hsv_frame = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV) how to fixed
@stevenkenneth2924
@stevenkenneth2924 2 роки тому
same
@johnanderson9619
@johnanderson9619 Рік тому
Since OpenCV converts the image to a numpy array anyways, making the image (frame(s)) searchable. Searching Numbers inside numbers.. Searching for an array within an array. Searching for a dataset.. set of pixels normally associated with objects of oranges in a FHD 1920 x 1080 image. My_X = 0 My_Y = 0 Red_Channel = 2 Green_Channel = 1 Blue_Channel = 0 Pixel_Hunter_Pixels_found_reds = 0 Pixel_Hunt3r_Pixels_found_greens = 0 main_counter_variable = 0 while main_counter_variable < 2073600: if My_X > 1920: My_X = 0 My_Y += 1 if Target_Image_A[My_Y][My_X][Green_Channel ] > 100 and Target_Image_A[My_Y][My_X][Red_Channel] > 154: # REDs AND GREENs : Colors associated with pictures of Oranges. Pixel_Hunt3r_Pixels_found_reds +=1 Pixel_Hunt3r_Pixels_found_greens +=1 print("Pixels in the range of what Oranges look like in this 1920 x 1080 image were found.. Their locations are.. X:" + str(My_X) + ", Y:" + str(My_Y)") My_X +=1 main_counter_variable +=1 print("We found a total of " + str(Pixel_Hunt3r_Pixels_found_reds) + " Red pixels and " + str(Pixel_Hunt3r_Pixels_found_greens) + "Greens associate with Orange looking objects in images") print("The type of data were dealing with here for Target_Image_A is of " + str(type(Target_Image_A))) cv2.imshow("Target Image A", Target_Image_A) cv2.waitKey(0) I only know this stuff because of great teachers like #PySource. Thanks #Pysource. I know what I know today because of great teachers like you buddy. If can search arrays.. we can find objects inside images.. It's a sequence of numbers associated with the colors of the objects we want to find in the images which are 3-D numpy arrays
Detecting color with Python and OpenCV using HSV colorspace | Computer vision tutorial
20:01
Image Processing with OpenCV and Python
20:38
Rob Mulla
Переглядів 117 тис.
Эффект Карбонаро и соковыжималка
01:01
История одного вокалиста
Переглядів 1,2 млн
Real-time defect identification of products on a conveyor belt
15:28
Object Tracking with Opencv and Python
30:03
Pysource
Переглядів 585 тис.
Auto-Measuring with OpenCV + Python - Try It Yourself
25:17
Clayton Darwin
Переглядів 75 тис.
Object Tracking from scratch with OpenCV and Python
1:00:13
Pysource
Переглядів 225 тис.
OpenCV Course - Full Tutorial with Python
3:41:42
freeCodeCamp.org
Переглядів 3 млн
Color Detection using Python - OpenCV and Pandas
13:32
Balaji Srinivasan
Переглядів 51 тис.
Рекламная уловка Apple 😏
0:59
Яблык
Переглядів 239 тис.
iPhone 16 - Повернення ДО КЛАСИКИ
9:22
Svidomy
Переглядів 23 тис.
Как часто вы чистите свой телефон
0:33
KINO KAIF
Переглядів 2,3 млн
I shouldn’t have kept the $1,000,000 computer
28:05
Linus Tech Tips
Переглядів 1,3 млн
Как открыть дверь в Jaecoo J8? Удобно?🤔😊
0:27
Суворкин Сергей
Переглядів 970 тис.