Every image is represented by 3 colors that are Red, Green and Blue. Let us see how to find the most dominant color captured by the webcam using Python.
- Import the cv2 and NumPy modules
- Capture the webcam video using the cv2.VideoCapture(0) method.
- Display the current frame using the cv2.imshow() method.
- Run a while loop and take the current frame using the read() method.
- Take the red, blue and green elements and store them in a list.
- Compute the average of each list.
- Whichever average has the greatest value, display that color.
- Face Detection using Python and OpenCV with webcam
- Python - Displaying real time FPS at which webcam/video file is processed using OpenCV
- Saving Operated Video from a webcam using OpenCV
- Live Webcam Drawing using OpenCV
- Python Program to detect the edges of an image using OpenCV | Sobel edge detection method
- Python | Detect corner of an image using OpenCV
- Python | Detect Polygons in an Image using OpenCV
- Detect Cat Faces in Real-Time using Python-OpenCV
- WebCam Motion Detector in Python
- Detect an object with OpenCV-Python
- OpenCV - Facial Landmarks and Face Detection using dlib and OpenCV
- Transition from OpenCV 2 to OpenCV 3.x
- Detection of a specific color(blue here) using OpenCV with Python
- Opening multiple color windows to capture using OpenCV in Python
- Converting Color video to grayscale using OpenCV in Python
- Multiple Color Detection in Real-Time using Python-OpenCV
- Detecting obects of similar color in Python using OpenCV
- Python | OpenCV BGR color palette with trackbars
- Color Spaces in OpenCV | Python
- Mahotas - RGB to Gray Conversion
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.