Simple Color recognition with Opencv and Python

  Рет қаралды 65,058

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
@Eplemos4Life
@Eplemos4Life 2 жыл бұрын
Very good sir! Thanks, you are helping me alot in my automation engineering.
@stefanAH97
@stefanAH97 2 жыл бұрын
Excellent session! Advance color recognition video would be great.
@mitchfawcett3097
@mitchfawcett3097 2 жыл бұрын
Thank you! You are an excellent teacher
@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?
@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 "
@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.
@ahmed.bhewary775
@ahmed.bhewary775 2 жыл бұрын
Sir, I love your job, keep up the good work
@jackyli6716
@jackyli6716 2 жыл бұрын
thanks for your video, that's so good.
@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?
@sardorabdirayimov
@sardorabdirayimov Жыл бұрын
Awesome video for beginners:)
@asimaseem8412
@asimaseem8412 2 жыл бұрын
How can consider both saturation n brightness with hue in the same code can u help me out plzz
@acquabr1908
@acquabr1908 Жыл бұрын
Very good video... Thank you very much...
@imenecharabi8945
@imenecharabi8945 2 жыл бұрын
Perfection !
@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
@david1r200
@david1r200 2 жыл бұрын
Very good! Ty
@borallylyl8427
@borallylyl8427 10 ай бұрын
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
@AiPhile
@AiPhile 2 жыл бұрын
Thank you sir, I was looking for it ❤️
@progm6127
@progm6127 Жыл бұрын
how can I detect color in a Particular area of the frame?
@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)
@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
@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?
@Tahir_CanKozan
@Tahir_CanKozan 2 жыл бұрын
how do I find to white color ?
@anassalhab3167
@anassalhab3167 Жыл бұрын
Thank you very very much
@mynameisconnorimtheandroid6080
@mynameisconnorimtheandroid6080 Жыл бұрын
thank you!
@thecomedyhitler9362
@thecomedyhitler9362 Жыл бұрын
Thank you 😀😀😀🎉🎉
@dibyojyotiroy3445
@dibyojyotiroy3445 Жыл бұрын
You r damn good man... Just awesome 🖤
@AmeyBhobaskar
@AmeyBhobaskar Жыл бұрын
How to add saturation and value with hue???
@bridge_ojm
@bridge_ojm 2 жыл бұрын
thank you teacher
@ajaymusk6123
@ajaymusk6123 2 жыл бұрын
thanks sir!!!!!
@AmeyBhobaskar
@AmeyBhobaskar Жыл бұрын
How to add button for start and stop
@monganpipi6380
@monganpipi6380 2 жыл бұрын
Please explain the change process of HUe_value during program debugging. It is very urgent😉
@ishaanapte6570
@ishaanapte6570 2 жыл бұрын
thanks!
@user-kg8hi4te8t
@user-kg8hi4te8t 27 күн бұрын
what if i want to use saturation???
@artzlawanwisut4009
@artzlawanwisut4009 Жыл бұрын
Why i dont recive confirm email on blog ?
@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.
@wfpnknw32
@wfpnknw32 2 жыл бұрын
Just use bumpy to cut out a region of the image then create a histogram of that region.
@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/
@LamVo-io6nn
@LamVo-io6nn 2 жыл бұрын
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
@shanvishukla7292
@shanvishukla7292 Жыл бұрын
Please share for black and white color too
@shriniwasmhatre2652
@shriniwasmhatre2652 2 жыл бұрын
Error cap value is not defined
@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?
@joeyandrew2544
@joeyandrew2544 11 ай бұрын
what the aplication that u use to run your program?
@rudrarudra9212
@rudrarudra9212 Ай бұрын
Pycharm
@DUde00231
@DUde00231 10 ай бұрын
Hey Can I use vscode instead of pycharm ??
@fphoenix7144
@fphoenix7144 9 ай бұрын
Yes
@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
@marisalasser
@marisalasser 11 ай бұрын
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?
@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
ПЕЙ МОЛОКО КАК ФОКУСНИК
00:37
Masomka
Рет қаралды 10 МЛН
1🥺🎉 #thankyou
00:29
はじめしゃちょー(hajime)
Рет қаралды 75 МЛН
Когда на улице Маябрь 😈 #марьяна #шортс
00:17
ДЕНЬ РОЖДЕНИЯ БАБУШКИ #shorts
00:19
Паша Осадчий
Рет қаралды 4,3 МЛН
Real time shape detection - Opencv with Python 3
35:59
Pysource
Рет қаралды 63 М.
Auto-Measuring with OpenCV + Python - Try It Yourself
25:17
Clayton Darwin
Рет қаралды 78 М.
Object Tracking from scratch with OpenCV and Python
1:00:13
Pysource
Рет қаралды 231 М.
REAL TIME OBJECT MEASUREMENT | OpenCV Python (2020)
53:25
Murtaza's Workshop - Robotics and AI
Рет қаралды 237 М.
Color Detection & Tracking with ESP32 Camera & OpenCV
8:28
How To Electronics
Рет қаралды 28 М.
Fast Window Capture - OpenCV Object Detection in Games #4
30:48
Learn Code By Gaming
Рет қаралды 224 М.
Carregando telefone com carregador cortado
1:01
Andcarli
Рет қаралды 1,9 МЛН
Как я сделал домашний кинотеатр
0:41
RICARDO
Рет қаралды 1,5 МЛН
как спасти усилитель?
0:35
KS Customs
Рет қаралды 496 М.
AMD больше не конкурент для Intel
0:57
ITMania - Сборка ПК
Рет қаралды 501 М.