Converting Color video to grayscale using OpenCV in Python Last Updated : 03 Jan, 2023 Summarize Comments Improve Suggest changes Share Like Article Like Report OpenCV is a huge open-source library for computer vision, machine learning, and image processing. It can process images and videos to identify objects, faces, or even the handwriting of a human. In this article, we will see how to convert a colored video to a gray-scale format. Approach: Import the cv2 module.Read the video file to be converted using the cv2.VideoCapture() method.Run an infinite loop.Inside the loop extract the frames of the video using the read() method.Pass the frame to the cv2.cvtColor() method with cv2.COLOR_BGR2GRAY as a parameter to convert it into gray-scale.Display the frame using the cv2.imshow() method. Example: Suppose we have the video file CountdownTimer.mov as the input. Python3 # importing the module import cv2 # reading the video source = cv2.VideoCapture('Countdown Timer.mov') # running the loop while True: # extracting the frames ret, img = source.read() # converting to gray-scale gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) # displaying the video cv2.imshow("Live", gray) # exiting the loop key = cv2.waitKey(1) if key == ord("q"): break # closing the window cv2.destroyAllWindows() source.release() Output: Comment More infoAdvertise with us Next Article Color Identification in Images using Python - OpenCV D dlokeshram Follow Improve Article Tags : Machine Learning AI-ML-DS OpenCV python Python-OpenCV +1 More Practice Tags : Machine Learningpython Similar Reads Color Identification in Images using Python - OpenCV An open-source library in Python, OpenCV is basically used for image and video processing. Not only supported by any system, such as Windows, Linux, Mac, etc. but also it can be run in any programming language like Python, C++, Java, etc. OpenCV also allows you to identify color in images. Donât you 3 min read Display date and time in videos using OpenCV - Python OpenCV-Python is a library of Python bindings designed to solve computer vision problems. It can process images and videos to identify objects, faces, or even the handwriting of a humanNote: For more information, refer to Introduction to OpenCVÂ Display date and time in videos It sometimes becomes n 2 min read Python | Denoising of colored images using opencv Denoising of an image refers to the process of reconstruction of a signal from noisy images. Denoising is done to remove unwanted noise from image to analyze it in better form. It refers to one of the major pre-processing steps. There are four functions in opencv which is used for denoising of diffe 1 min read How to convert a grayscale image to RGB in OpenCV In image processing, images can be categorized into grayscale and RGB formats. Grayscale images contain varying shades of gray, representing intensity levels, while RGB images use red, green, and blue channels to depict a wider range of colors. Converting grayscale images to RGB is crucial for appli 5 min read Python | Create video using multiple images using OpenCV Creating videos from multiple images is a great way for creating time-lapse videos. In this tutorial, weâll explore how to create a video from multiple images using Python and OpenCV. Creating a video from images involves combining multiple image frames, each captured at a specific moment in time, i 5 min read Convert OpenCV image to PIL image in Python OpenCV is a huge open-source library for computer vision, machine learning, and image processing. OpenCV supports a wide variety of programming languages like Python, C++, Java, etc. It can process images and videos to identify objects, faces, or even the handwriting of a human. When it is integrate 3 min read Like