Color Filtering - OpenCV with Python for Image and Video Analysis 7

  Рет қаралды 166,259

sentdex

sentdex

8 жыл бұрын

In this OpenCV with Python tutorial, we're going to cover how to create a sort of filter, revisiting the bitwise operations, where we will filter for specifically a certain color, attempting to just show it. Alternatively, you could also specifically filter out a specific color, and then replace it with a scene, like we did with replacing a ROI (region of image) with something else, much like how a green screen works.
In order to filter like this you have a few options. Generally, you are probably going to convert your colors to HSV, which is "Hue Saturation Value." This can help you actually pinpoint a more specific color, based on hue and saturation ranges, with a variance of value, for example. If you wanted, you could actually produce filters based on BGR values, but this would be a bit more difficult. If you're having a hard time visualizing HSV, don't feel silly, check out the Wikipedia page on HSV, there is a very useful graphic there for you to visualize it. Hue for color, saturation for the strength of the color, and value for light is how I would best describe it personally. Now let's hop in.
pythonprogramming.net
/ sentdex

Пікірлер: 160
@aardvarrock9657
@aardvarrock9657 5 жыл бұрын
I've been wracking my brains around how these color masks work all day, thanks!
@saffister
@saffister 7 жыл бұрын
very useful tutorials ! thank you so much for your help and keep up the good work
@I3LaCkPeArL
@I3LaCkPeArL 5 жыл бұрын
Hey, I really like your videos. They help me a lot. What steps would you suggest, when trying to create a "building" recognition for ONE building? It should be able to detect parts of, so you can highlight lets say rooms from the outside.
@occure1
@occure1 8 жыл бұрын
Awesome. So great your tuts. Thanks a lot!
@sentdex
@sentdex 8 жыл бұрын
+TomTomBW Happy to share them!
@achrafhamal7128
@achrafhamal7128 5 жыл бұрын
Adding a backtrack is so useful to adjust the colors in real time
@LAZofPIK
@LAZofPIK 8 жыл бұрын
thank's a lot for all work i have just a question how can i do something like if i found blue color in video i perform an action for example , if i found blue color in vidéo i save the frame who contain the blue color into a floder ?
@danielgn6227
@danielgn6227 5 жыл бұрын
Just a quick note if you are as bad as me understanding color spaces: Searching "opencv color picker" brought me to a couple of opencv scripts on GitHub that find the lower and upper values of any color by clicking a couple times the desired color on the image
@baranemreturkmen9497
@baranemreturkmen9497 4 жыл бұрын
thanks man very useful
@LaunchpadMediaGroup1
@LaunchpadMediaGroup1 3 жыл бұрын
I used this free online tool and built hsv ranges colorizer.org/
@Lyr00
@Lyr00 3 ай бұрын
9:37 with HSV the hue has a color range of 0 to 179, thats why 255 and 180 are one and the same here. the 180 different colors for HSV were chosen cause the hue comes from a circle as u showed in ur picture of HSV at the start of the vid. a circle has 360° but that number is outside the range of the uint8 range which is used to store pixel values and colors, so the next best thing is just taking 360° and dividing by 2 to get the value range of up to 180.
@fidaamergani
@fidaamergani 6 жыл бұрын
should I always use trial and error to filter out a specific colour or is there a proper accurate method?
@ravigupta9690
@ravigupta9690 7 жыл бұрын
very informative video..
@shoebmoin10
@shoebmoin10 5 жыл бұрын
𝐌𝐚𝐧𝐲 𝐩𝐞𝐨𝐩𝐥𝐞 𝐡𝐚𝐯𝐞 𝐝𝐨𝐮𝐛𝐭 𝐢𝐧 𝐭𝐡𝐢𝐬 𝐜𝐨𝐝𝐞: 𝐤 = 𝐜𝐯𝟐.𝐰𝐚𝐢𝐭𝐊𝐞𝐲(𝟓) & 𝟎𝐱𝐅𝐅 𝐢𝐟 𝐤 == 𝟐𝟕: 𝐛𝐫𝐞𝐚𝐤 𝟏. In cv2.waitKey(x) the parameter x indicates the delay in the frame display i.e a new frame is displayed in our video feed after x seconds (try keeping it 1000 to check the difference,1fps ). 𝟐. cv2.waitkey() returns the key pressed on the keyboard, according to the code above if ASCII value of that key is 27(ESC key) then we are breaking out of the loop. 𝟑. Now the 0xFF is a hexadecimal number = 255 which in binary is equal to 1111111 so doing a '&' Operation means we only care about the last 7 bits of the ASCII value returned.
@johnmicohalvarez6890
@johnmicohalvarez6890 6 жыл бұрын
what camera did you use for this project?
@Moment_Captured
@Moment_Captured 8 жыл бұрын
Thanks for your video. Because the apparent color (the Human eye) is related to the lightness, LAB color is often used so that the apparent color is represented. I suspect that CV can do the same with LAB.
@ricebastard
@ricebastard 7 жыл бұрын
8:01 Why didn't anybody say anything? Got a good laugh from that one.
@speckkie9397
@speckkie9397 6 жыл бұрын
So if I am using a video, python speeds up the video to about 3x or 4x the original speed. Can I slow that down somehow? Didn't find anything in the opencv documentation at first glance.
@anthol4736
@anthol4736 5 жыл бұрын
hi, i've got a problem, do you use the picamera to do this? because with my USB camera the pixel format is not 'BGR'
@poojakashikar6544
@poojakashikar6544 4 жыл бұрын
how can I change the colour of different part in same image,without disturbing the structure and rendering using any language that is either client side or server side.can u help me?
@DavidARayMusic
@DavidARayMusic 7 жыл бұрын
I have two cameras I want to run this process though at the same time to see if the object is visable from either or both. How do I use both? I have tried cap1=cv2.VideoCapture(dev0) and cap2=cv2.VideoCapture(dev1) and then run the same processes through for both cameras, but the end result only shows me images for dev0. Both cameras work fine independent of the other, but I can't seem to get them both at the same time. Any help?
@rrni2343
@rrni2343 4 жыл бұрын
now I want a "Make computer vision great again!" hat
@f3punchout
@f3punchout 3 жыл бұрын
lol
@tharinduheshan8717
@tharinduheshan8717 3 жыл бұрын
Is it possible to use python using a point cloud to extract only the road from the colors on both sides of the road (if there is a plantation like grass)?
@shikharagrawal1797
@shikharagrawal1797 5 жыл бұрын
waitKey(0) doesn't display video. It displays a fixed image. The first image captured on the webcam.
@aladdinalhaffar9187
@aladdinalhaffar9187 5 жыл бұрын
Thx for the efforts and I have two questions : 1 - what are the details of k = cv2.waitKey(5) & 0xFF if k == 27: break and thier use 2 - how can we end the while loop and get destroy all windows to be executed
@shoebmoin10
@shoebmoin10 5 жыл бұрын
𝐌𝐚𝐧𝐲 𝐩𝐞𝐨𝐩𝐥𝐞 𝐡𝐚𝐯𝐞 𝐝𝐨𝐮𝐛𝐭 𝐢𝐧 𝐭𝐡𝐢𝐬 𝐜𝐨𝐝𝐞: 𝐤 = 𝐜𝐯𝟐.𝐰𝐚𝐢𝐭𝐊𝐞𝐲(𝟓) & 𝟎𝐱𝐅𝐅 𝐢𝐟 𝐤 == 𝟐𝟕: 𝐛𝐫𝐞𝐚𝐤 𝟏. In cv2.waitKey(x) the parameter x indicates the delay in the frame display i.e a new frame is displayed in our video feed after x milli seconds (try keeping it 1000 to check the difference,1fps ). 𝟐. cv2.waitkey() returns the key pressed on the keyboard, according to the code above if ASCII value of that key is 27(ESC key) then we are breaking out of the loop. 𝟑. Now the 0xFF is a hexadecimal number = 255 which in binary is equal to 1111111 so doing a '&' Operation means we only care about the last 7 bits of the ASCII value returned.
@indiansoftwareengineer4899
@indiansoftwareengineer4899 5 жыл бұрын
thanks Skyscraper, you saved my time? I wonder in your first answer, it's milisecond as parameter. also, I have one doubt how can I detect hand/ skin color instead of red color of hat? what values should I give in lower_red and upper_red? here?
@user-jq3um6ez2h
@user-jq3um6ez2h 5 жыл бұрын
I think it means use Esc to destroy all the windows and release capture,just like the ord='q' in previous video
@vudinh2116
@vudinh2116 4 жыл бұрын
@@shoebmoin10 Thanks.
@Brickkzz
@Brickkzz 7 жыл бұрын
How can I filter blobs that are smaller than the biggest blob (target) that I'm after? Is there a way to filter based by the size of pixel clumps (blob size)?
@Junyoung_Kang
@Junyoung_Kang 7 жыл бұрын
Hey is it possible for you to make your hat to keep change color in a sequence of rainbow color? that would be sick! let me know what code you have to put to do that
@jhunmichaelaballa535
@jhunmichaelaballa535 5 жыл бұрын
What if you are using a kinect sensor? How can I interface it with that code? Thanks a lot
@anikethnair1629
@anikethnair1629 6 жыл бұрын
Can you help me make an image classifier to find potholes on the road?
@enesdemirkaya3622
@enesdemirkaya3622 4 жыл бұрын
How can i get mean of the result so i can get how red is the hat? thanks for the videos
@hexhackbangla8368
@hexhackbangla8368 5 жыл бұрын
i never enjoyed programming before watching your video..
@padamsethia2398
@padamsethia2398 8 жыл бұрын
Hey, I didn't understand the syntax for bitwise_and , what's the 1st 'frame' and the 2nd 'frame' ? I do get that bitwise_and takes the union of two Thanks !
@schlenkernoah7975
@schlenkernoah7975 4 жыл бұрын
pysource.com/2018/01/29/bitwise-operators-opencv-3-4-with-python-3-tutorial-7/
@nikhilkumawat2038
@nikhilkumawat2038 7 жыл бұрын
res = cv2.bitwise_and(frame,frame, mask= mask) can you explain bitwise_and..?? what does it do..?
@schlenkernoah7975
@schlenkernoah7975 4 жыл бұрын
pysource.com/2018/01/29/bitwise-operators-opencv-3-4-with-python-3-tutorial-7/ this helped me a LOT
@indiansoftwareengineer4899
@indiansoftwareengineer4899 5 жыл бұрын
how can I detect hand/ skin color instead of red color of hat? what values should I give in lower_red and upper_red? here? lower_red = np.array([150,50,50]) upper_red = np.array([180,255,255])
@sentdex
@sentdex 5 жыл бұрын
It is going to depend on many things. Youd have to first decide how many skin color buckets you want to detect and what the lighting conditions will be.
@ddtkhoa7766
@ddtkhoa7766 6 жыл бұрын
I don't know how to determine lower and higher HSV array?
@VarunKaushik18
@VarunKaushik18 6 жыл бұрын
How do I check if a colour is present in an input image or not?
@malharjajoo7393
@malharjajoo7393 6 жыл бұрын
Can someone explain how to make this robust to lighting conditions ?
@AbubakerMahmoudshangab
@AbubakerMahmoudshangab 8 жыл бұрын
Awesome
@PranshuDixit0105
@PranshuDixit0105 7 жыл бұрын
Hi, is there any way to automatically find the lower and upper range of coloured region instead of randomly putting in different values and checking? like any function that returns those values? Thank you!
@TechDetour
@TechDetour 6 жыл бұрын
docs.opencv.org/3.2.0/df/d9d/tutorial_py_colorspaces.html i guess that this is a better way
@georgehanna6900
@georgehanna6900 7 жыл бұрын
You kinda touched on this, but, what exactly does "mask = mask" mean in that bitwise_and function? Why can't it just be "mask"?
@DavidARayMusic
@DavidARayMusic 7 жыл бұрын
so mask is the variable that the function is looking for. if you named your variable for cv2.inRange(hsv1, lower_red, upper_red) unicorn_farts you could then just put mask=unicorn_farts and it would work just the same. He does it with mask=mask for simplicity, but I totally understand it can be confusing.
@shankarjadhav1985
@shankarjadhav1985 3 жыл бұрын
Use this for better red masking lower_red = np.array([0,70,50]) upper_red = np.array([10,255,255])
@akash123493
@akash123493 7 жыл бұрын
Hi I have a question. I like to read pixel at a certain area of an image. How can I read pixel of an certain area of an Image. Please Please Please reply. Thanks in advance.
@reesentful
@reesentful 6 жыл бұрын
myPixel = img[x,y] print(myPixel)
@TechDetour
@TechDetour 6 жыл бұрын
You can make use of roi
@MuhittinKaplan
@MuhittinKaplan 5 жыл бұрын
Thanks Foll All
@Dzahmega
@Dzahmega 7 жыл бұрын
great tutorial, but i still dont understand, what is the purpose of k=27 wrote in the code?
@RobertLugg
@RobertLugg 7 жыл бұрын
if you press a keyboard key then k will be set to its ASCII value. do an internet search for ASCII table and you will find that ASCII 27 is the Esc key on your keyboard
@saeedmardani3900
@saeedmardani3900 6 жыл бұрын
Aaah, thanks Robert, I was looking for half an hour what is 27 and what value it is on the keyboard. :)
@erkamkocaer2097
@erkamkocaer2097 5 жыл бұрын
how can we change the color? ı didnt understand that . what if ı want make this with blue , how can i write code ?
@TheXT550
@TheXT550 6 жыл бұрын
Hey sentdex, Guys and Girls, i want to recognize a color, and if it is recognized i want to count it or give it a value for example (red = 50, Black = 20). if red or black was recognized I should be issued the number. any Idea ???? need help :-)
@trmittal24
@trmittal24 7 жыл бұрын
I am unable to zero in a particular object. It still shows objects of more colors. Can someone please help me with a technique to do it in a better way?
@erdalkaras347
@erdalkaras347 8 жыл бұрын
greet!. thank you for tutorials
@nandankashyapTeaTThinking
@nandankashyapTeaTThinking 5 жыл бұрын
I have tried everything as it is but its not working for me. Can you help me out.
@baco2959
@baco2959 6 жыл бұрын
"hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV)" was giving me an error. Just run 'sudo modprobe bcm2835-v4l2' in the terminal to solve it!
@bazingabuzz2640
@bazingabuzz2640 6 жыл бұрын
Baco29 which terminal?
@stephen9849
@stephen9849 3 жыл бұрын
How to solve on Windows?
@amurtaza14
@amurtaza14 7 жыл бұрын
I'm not able to see any output window, I'm using my laptop webcam, there is no any error at my output, webcam starts when code executes but no OUTPUT. any hint?
@TechDetour
@TechDetour 6 жыл бұрын
did you give cv2.imshow()
@PapaYosif
@PapaYosif 5 жыл бұрын
so how do i run code when the color is detected?
@jchew8312
@jchew8312 7 жыл бұрын
How do u adjust it if u are using an image instead?
@RobDawsonjr
@RobDawsonjr 6 жыл бұрын
import cv2 import numpy as np img = cv2.imread('example.jpg', 1) hsv = cv2.cvtColor(img, cv2.COLOR_BGR2HSV) lowerRed = np.array([150, 150, 50]) upperRed = np.array([180, 255, 255]) mask = cv2.inRange(img, lowerRed , upperRed) res = cv2.bitwise(img, img, mask = mask) # if using a raspberry pi, i recommend you resize the window cv2.namedWindow('image', cv2.WINDOW_NORMAL) cv2.namedWindow('mask', cv2.WINDOW_NORMAL) cv2.namedWindow('res', cv2.WINDOW_NORMAL) #continue as normal cv2.imshow('image', img) cv2.imshow('mask, mask) cv2.imshow('res', res) k = cv2.waitKey(0) & 0xFF if k == ord('q'): cv2.destroyAllWindows()
@harishpadmaraju5908
@harishpadmaraju5908 8 жыл бұрын
+sentdex,, I want to know how to find the HSV color range for yellow?
@16rongon
@16rongon 6 жыл бұрын
What does waitKey(5) do?
@vaibhavchhabra800
@vaibhavchhabra800 6 жыл бұрын
Please explain in a bit more detail otherwise Awesome video
@JohnDoe-xm1nw
@JohnDoe-xm1nw 2 жыл бұрын
HSV values cannot be more than 100 for S and V. I don't understand this notation. How can i create a range for my own color? For example i want a range for blue.
@bashirubale1650
@bashirubale1650 6 жыл бұрын
please , how can I get the ordinates, of the RED object.
@satviknema8629
@satviknema8629 4 жыл бұрын
the value in HSV cannot be greater than 100 right? The V attribute tell how much the white light is ixed into the color. 100 means the color will be bright. 0 means it will be more like black
@yashtibrewal4259
@yashtibrewal4259 6 жыл бұрын
how do I range my specific color provided I have the rgb range... like say I wanna get my face, so I have the color borwn, is there a way I can range that brown shade?
@TechDetour
@TechDetour 6 жыл бұрын
yeah there is, you can actually play with the hsv color space in any image editing tool like photoshop or GIMP. you will also get the hsv value from there, but the problem is that the HSV range is interpreted differently in different softwares. for example, the hsv hue range is from 0 to 180 in opencv, so taking the rgb value of those colors and converting it to hsv later in the program would be a better solution. I would drop a link to the things i talked about in the next comment since the links would definitely go to the spam folder and will only be made public if he approves it
@TechDetour
@TechDetour 6 жыл бұрын
heres the link: docs.opencv.org/3.2.0/df/d9d/tutorial_py_colorspaces.html
@kartiknair820
@kartiknair820 7 жыл бұрын
Basically You are saying BGR is discrete while HSV is continuos ?
@trinhtat7946
@trinhtat7946 7 жыл бұрын
How would I detect several colors? I tried inserting multiple ranges into the array and it showed errors
@sentdex
@sentdex 7 жыл бұрын
detect and mask for each of your colors, then overlay all 3.
@kartiksareen
@kartiksareen 6 жыл бұрын
what if we have 3 different cameras........how to make them capture at the same time....3 different videos..from 3 different cameras....
@pseudooduesp2805
@pseudooduesp2805 6 жыл бұрын
hello realy big big tank's , simplification it the key of comprehnsion can i ask you to make tutorial to compare two images . please and thank s for adavance.
@usmanabbas7
@usmanabbas7 7 жыл бұрын
can anyone please explain how cv2.bitwise_and() works?
@muhammadhasannajeeb
@muhammadhasannajeeb 7 жыл бұрын
yes i can bae xD
@usmanabbas7
@usmanabbas7 7 жыл бұрын
hahah I got it now xD
@nileshkulkarni7341
@nileshkulkarni7341 6 жыл бұрын
I am getting error expected indented block
@tristanshah9716
@tristanshah9716 6 жыл бұрын
why do you need the underscore in this line? _, frame = cap.read()
@sentdex
@sentdex 6 жыл бұрын
Don't need it, but it's there to denote the uselessness of a variable. Cap.read() returns two things. In this case, we just wanted the frame, and were never going to use the first return in the code. Thus, we use the underscore, which is sort of a "standard" in python to designate some var that doesnt matter.
@PapaYosif
@PapaYosif 5 жыл бұрын
ez explaination: it gives 2 variables and we need the second 1 if u dont name all of them it gives out an error :)
@KandelDeepak
@KandelDeepak 6 жыл бұрын
my camera is not exiting....do I always have to stop it from the task manager?
@josueresilien4393
@josueresilien4393 6 жыл бұрын
You should be able to use the escape key based on the code, make sure that your cv2.waitKey is correct
@aayushsingh9622
@aayushsingh9622 5 жыл бұрын
what is the range of sat and val in opencv ? is the usual range in (0-100%)?
@animeshsrivastava60
@animeshsrivastava60 5 жыл бұрын
nope. (0-255) for both and (0-180) for hue
@schlenkernoah7975
@schlenkernoah7975 4 жыл бұрын
@@animeshsrivastava60 thx a lot
@djcollyer17
@djcollyer17 8 жыл бұрын
i want this but, i get error, its different program if i am using a ras.picam?
@RobDawsonjr
@RobDawsonjr 6 жыл бұрын
As the pi Camera is not the same as a USB web cam, the approach is quite different. Check out picamera.readthedocs.io/en/release-1.10/recipes1.html You could also check out: www.pyimagesearch.com/2016/01/04/unifying-picamera-and-cv2-videocapture-into-a-single-class-with-opencv/ If however you get stuck with that, you could always buy a USB web cam for the PI. Hope this helps
@aimannzainal9521
@aimannzainal9521 6 жыл бұрын
can someone explain the difference between the upper and lower? basically i want to detect orange colour? what hsv for that and i still dont understand how to gain the value.
@aimannzainal9521
@aimannzainal9521 6 жыл бұрын
#E25822 this colour code i want to detect
@RobDawsonjr
@RobDawsonjr 6 жыл бұрын
The lower and upper bounds represent the range of colour values the algorithm will detect and will appear as white in the mask. Anything outside of this range will be ignored, i.e. on the mask it will appear black. in your case, to find the orange value, i would recommend using the following code: >>> orange = np.uint8([[[34,88,226 ]]]) # Remember this is BGR and NOT RGB >>> hsv_orange = cv2.cvtColor(orange,cv2.COLOR_BGR2HSV) # Converts the BGR value to HSV >>> print hsv_orange #Output [8, 217, 226] As you need a lower bound and upper bound due to different light conditions, you may want to change the Hue (8) slightly. You will also want to change the sat and value. Try this to start with: orangeLower = np.array([5, 100, 100]) orangeUpper = np.array([10, 217, 226]) the 5 and 10 are used as different light conditions will alter the result. let me know how it goes
@aimannzainal9521
@aimannzainal9521 6 жыл бұрын
thanks for the great explaination, i fully understanding the function and found the hsv [8,217,226] last night, its worked well. any tutorial for save the image after the detection? i mean after i found orange and draw a circle to the frame. cv2.imwrite will do the job in realtime?
@theycallmemorphine
@theycallmemorphine 6 жыл бұрын
Just to add some more..... Red lies in a region where we cant define using single numpy-array/mask. So, I've done this! ## only for red -30 to 0 and 0 to 30 - 2masks lower_red = np.array([150,50,50]) upper_red = np.array([180,255,255]) mask1 = cv2.inRange(hsv_version, lower_red, upper_red) lower_red = np.array([0,50,50]) upper_red = np.array([30,255,255]) mask2 = cv2.inRange(hsv_version, lower_red, upper_red) mask = cv2.bitwise_or(mask1,mask2) res = cv2.bitwise_and(frame, frame, mask=mask)
@shadmansakib10
@shadmansakib10 5 жыл бұрын
thanks mate.
@Rohorg
@Rohorg 5 жыл бұрын
Thanks! Very helpful.
@athirasoman7701
@athirasoman7701 6 жыл бұрын
This is a good tutorial.But I need to mask green pixels .So can you pls mention the green color's upper bound and lower bound?
@aaronyang6917
@aaronyang6917 7 жыл бұрын
Thanks for your teaching! But what's the range of HSV? Is that same with RGB in OpenCV?
@alexliulovesu
@alexliulovesu 7 жыл бұрын
The range of HSV in Opencv is H = 0 to 179 S = 0 to 255 V = 0 to 255
@kartiksharma6625
@kartiksharma6625 5 жыл бұрын
My program is showing attribute error: module 'cv2.cv2' has no attribute'cvtcolor' please help me out
@danielgn6227
@danielgn6227 5 жыл бұрын
Make sure you use camelCase while calling the function: cv2.cvtColor() instead of cv2.cvtcolor()
@jdsingh3607
@jdsingh3607 3 жыл бұрын
can i like display the mask onto a jpg image ?
@jimmy_os
@jimmy_os 3 жыл бұрын
I found this by searching ''whoops you have to put the cd in your computer''
@simonzh3903
@simonzh3903 4 жыл бұрын
I'think adjust value of mask by trackbars is a much better way.
@shikharagrawal1797
@shikharagrawal1797 5 жыл бұрын
Is there any reason why you wrote k==27 ?
@mithunbabbira
@mithunbabbira 4 жыл бұрын
Esc key number
@mustakimmustakim
@mustakimmustakim 7 жыл бұрын
what should i change if i want to detect yellow?
@Akomarongg
@Akomarongg 7 жыл бұрын
Find and RGB or HSV range that matches the colour yellow.
@TechDetour
@TechDetour 6 жыл бұрын
docs.opencv.org/3.2.0/df/d9d/tutorial_py_colorspaces.html
@computerhousepc7366
@computerhousepc7366 4 жыл бұрын
Adam klavyeye bakmiyor ya adam sin adam
@belalyahya6338
@belalyahya6338 3 жыл бұрын
i believe that it would be much easier if you use "Trackbars" instead of running the code many times.
@rnparks
@rnparks 6 жыл бұрын
How do you quit out of the program?
@RobDawsonjr
@RobDawsonjr 6 жыл бұрын
Ctrl+C on windows, Ctrl+Z on Linux, not sure about Mac. Or a better way would be: k = waitKey(5) & 0xFF if k == ord('q'): destroyAllWindows()
@tronstinkt5651
@tronstinkt5651 5 жыл бұрын
Module 'cv2' has no 'COLOR_RGB2HSV' member
@animeshsrivastava60
@animeshsrivastava60 5 жыл бұрын
because it is BGR2HSV
@tronstinkt5651
@tronstinkt5651 5 жыл бұрын
@@animeshsrivastava60 thx
@ecoevolucion2647
@ecoevolucion2647 7 жыл бұрын
I still dont undestand how to change the colors
@RobDawsonjr
@RobDawsonjr 6 жыл бұрын
docs.opencv.org/3.0-beta/doc/py_tutorials/py_imgproc/py_colorspaces/py_colorspaces.html#converting-colorspaces
@saichandramadduri8365
@saichandramadduri8365 7 жыл бұрын
I did not understand the operation of bitwise and (syntax)
@abhijeetbadole5078
@abhijeetbadole5078 7 жыл бұрын
Sai Chandra Madduri Yeah, me too and this guy probably won't explain it
@miteshnagpal9152
@miteshnagpal9152 4 жыл бұрын
Got any explanation ?
@bejaminog
@bejaminog 3 жыл бұрын
code ?
@muhammedaliyeter1635
@muhammedaliyeter1635 6 жыл бұрын
nice _,frame = cap.read() hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV) for this part ı added an imshow cv2.imshow ('4', hsv) and result was shocking :D my head has a same color with a green book :D then I understood why the mask does not work what should I do help plssssss
@TechDetour
@TechDetour 6 жыл бұрын
the colors are like that because cv2.imshow() interpretes the data as a BGR value. for EXAMPLE, guess that the hsv value of blue ( [255,0,0] in BGR) is [ 25, 255, 255 ], so when you show the hsv image using imshow(), it will interpret it as 25- BLUE, 255- GREEN and 255 - RED.
@muhammedaliyeter1635
@muhammedaliyeter1635 6 жыл бұрын
rly? :/\/\/\/
@bacon761
@bacon761 6 жыл бұрын
how can you mask everything but the specified color? plss reply
@TechDetour
@TechDetour 6 жыл бұрын
you could inverse the whole mask using the bitwise_not operation so that all the white area would become black and all the black would become white
@josueresilien4393
@josueresilien4393 6 жыл бұрын
Very elementary mistake but just in case this happens to you guys too just make sure that you watch what is in your while loop, make sure the last 2 lines of code arent in there
@hamedatohamedato521
@hamedatohamedato521 5 жыл бұрын
You're my man! Ate 2 hours of my time !
@sheharyarkhan5852
@sheharyarkhan5852 5 жыл бұрын
Hey there mate I actually want to detect a rgb trio and sort it by means of a servo Plz send me some codings...
@erdalkaras347
@erdalkaras347 8 жыл бұрын
greet!. thank you for tutorials
Эффект Карбонаро и бесконечное пиво
01:00
История одного вокалиста
Рет қаралды 6 МЛН
Cute Barbie Gadget 🥰 #gadgets
01:00
FLIP FLOP Hacks
Рет қаралды 41 МЛН
Китайка и Пчелка 4 серия😂😆
00:19
KITAYKA
Рет қаралды 3,5 МЛН
Backstage 🤫 tutorial #elsarca #tiktok
00:13
Elsa Arca
Рет қаралды 30 МЛН
Color Detection & Tracking with ESP32 Camera & OpenCV
8:28
How To Electronics
Рет қаралды 28 М.
White balancing your pictures using python
14:09
DigitalSreeni
Рет қаралды 6 М.
Auto-Measuring with OpenCV + Python - Try It Yourself
25:17
Clayton Darwin
Рет қаралды 78 М.
Image formation: pixels: color filter array
13:30
Hany Farid, Professor at UC Berkeley
Рет қаралды 3,4 М.
Эффект Карбонаро и бесконечное пиво
01:00
История одного вокалиста
Рет қаралды 6 МЛН