Python OpenCV | cv2.cvtColor() method Last Updated : 21 Aug, 2024 Comments Improve Suggest changes Like Article Like Report OpenCV-Python is a library of Python bindings designed to solve computer vision problems. cv2.cvtColor() method is used to convert an image from one color space to another. There are more than 150 color-space conversion methods available in OpenCV. We will use some of color space conversion codes below. Syntax: cv2.cvtColor(src, code[, dst[, dstCn]]) Parameters:src: It is the image whose color space is to be changed. code: It is the color space conversion code. dst: It is the output image of the same size and depth as src image. It is an optional parameter. dstCn: It is the number of channels in the destination image. If the parameter is 0 then the number of the channels is derived automatically from src and code. It is an optional parameter. Return Value: It returns an image. Image used for all the below examples:Example #1: Python3 1== # Python program to explain cv2.cvtColor() method # importing cv2 import cv2 # path path = r'C:\Users\Administrator\Desktop\geeks.png' # Reading an image in default mode src = cv2.imread(path) # Window name in which image is displayed window_name = 'Image' # Using cv2.cvtColor() method # Using cv2.COLOR_BGR2GRAY color space # conversion code image = cv2.cvtColor(src, cv2.COLOR_BGR2GRAY ) # Displaying the image cv2.imshow(window_name, image) Output:Example #2: Using HSV color space. HSV color space is mostly used for object tracking. Python3 1== # Python program to explain cv2.cvtColor() method # importing cv2 import cv2 # path path = r'C:\Users\Administrator\Desktop\geeks.png' # Reading an image in default mode src = cv2.imread(path) # Window name in which image is displayed window_name = 'Image' # Using cv2.cvtColor() method # Using cv2.COLOR_BGR2HSV color space # conversion code image = cv2.cvtColor(src, cv2.COLOR_BGR2HSV ) # Displaying the image cv2.imshow(window_name, image) Output: Comment More infoAdvertise with us Next Article Filter Color with OpenCV R Rajnis09 Follow Improve Article Tags : Python Image-Processing OpenCV Python-OpenCV Practice Tags : python Similar Reads OpenCV Tutorial in Python OpenCV, short for Open Source Computer Vision Library, is an open-source computer vision and machine learning software library. Originally developed by Intel, it is now maintained by a community of developers under the OpenCV Foundation.OpenCVis a huge open-source library for computer vision, machin 3 min read Getting StartedWhat is OpenCV Library?OpenCV, short for Open Source Computer Vision Library, is an open-source computer vision and machine learning software library. Originally developed by Intel, it is now maintained by a community of developers under the OpenCV Foundation. In this article, we delve into OpenCV, exploring its functiona 5 min read Introduction to OpenCVOpenCV is one of the most popular computer vision libraries. If you want to start your journey in the field of computer vision, then a thorough understanding of the concepts of OpenCV is of paramount importance. In this article, to understand the basic functionalities of Python OpenCV module, we wi 4 min read How to Install OpenCV for Python on Windows?Prerequisite: Python Language Introduction  OpenCV is the huge open-source library for computer vision, machine learning, and image processing and now it plays a major role in real-time operation which is very important in todayâs systems. By using it, one can process images and videos to identify 4 min read How to Install OpenCV for Python in Linux?Prerequisite: Python Language Introduction OpenCV is the huge open-source library for computer vision, machine learning, and image processing and now it plays a major role in real-time operation which is very important in todayâs systems. By using it, one can process images and videos to identify ob 2 min read Set up Opencv with anaconda environmentIf you love working on image processing and video analysis using python then you have come to the right place. Python is one of the major languages that can be used to process images or videos. Requirements for OpenCV and Anaconda - 32- or a 64-bit computer. - For Minicondaâ400 MB disk space. - For 3 min read Working with Images - Getting StartedReading an image in OpenCV using PythonPrerequisite: Basics of OpenCVIn this article, we'll try to open an image by using OpenCV (Open Source Computer Vision) library.  Following types of files are supported in OpenCV library:Windows bitmaps - *.bmp, *.dibJPEG files - *.jpeg, *.jpgPortable Network Graphics - *.png WebP - *.webp Sun raste 6 min read Python OpenCV | cv2.imshow() methodOpenCV-Python is a library of Python bindings designed to solve computer vision problems. cv2.imshow() method is used to display an image in a window. The window automatically fits the image size. Syntax: cv2.imshow(window_name, image)Parameters: window_name: A string representing the name of the wi 3 min read Python OpenCV | cv2.imwrite() methodOpenCV-Python is a library of Python bindings designed to solve computer vision problems. cv2.imwrite() method is used to save an image to any storage device. This will save the image according to the specified format in current working directory. Syntax: cv2.imwrite(filename, image) Parameters:file 2 min read OpenCV | Saving an ImageThis article aims to learn how to save an image from one location to any other desired location on your system in CPP using OpenCv. Using OpenCV, we can generate a blank image with any colour one wishes to. So, let us dig deep into it and understand the concept with the complete explanation. Code : 3 min read Color Spaces in OpenCV | PythonColor spaces are a way to represent the color channels present in the image that gives the image that particular hue. There are several different color spaces and each has its own significance. Some of the popular color spaces are RGB (Red, Green, Blue), CMYK (Cyan, Magenta, Yellow, Black), HSV (Hue 2 min read Arithmetic Operations on Images using OpenCV | Set-1 (Addition and Subtraction)Arithmetic Operations like Addition, Subtraction, and Bitwise Operations(AND, OR, NOT, XOR) can be applied to the input images. These operations can be helpful in enhancing the properties of the input images. The Image arithmetics are important for analyzing the input image properties. The operated 3 min read Bitwise Operations on Binary Images in OpenCV2Bitwise operations are used in image manipulation and used for extracting essential parts in the image. In this article, Bitwise operations used are :ANDORXORNOTAlso, Bitwise operations helps in image masking. Image creation can be enabled with the help of these operations. These operations can be h 3 min read Working with Images - Image ProcessingImage Resizing using OpenCV | PythonImage resizing refers to the scaling of images. Scaling comes in handy in many image processing as well as machine learning applications. It helps in reducing the number of pixels from an image and that has several advantages e.g. It can reduce the time of training of a neural network as the more th 3 min read Python OpenCV | cv2.erode() methodOpenCV-Python is a library of Python bindings designed to solve computer vision problems. cv2.erode() method is used to perform erosion on the image. The basic idea of erosion is just like soil erosion only, it erodes away the boundaries of foreground object (Always try to keep foreground in white). 2 min read Python | Image blurring using OpenCVImage Blurring refers to making the image less clear or distinct. It is done with the help of various low pass filter kernels. Advantages of blurring: It helps in Noise removal. As noise is considered as high pass signal so by the application of low pass filter kernel we restrict noise. It helps in 2 min read Python OpenCV | cv2.copyMakeBorder() methodOpenCV-Python is a library of Python bindings designed to solve computer vision problems. cv2.copyMakeBorder() method is used to create a border around the image like a photo frame.  Syntax: cv2.copyMakeBorder(src, top, bottom, left, right, borderType, value) Parameters: src: It is the source image 2 min read Python | Grayscaling of Images using OpenCVGrayscaling is the process of converting an image from other color spaces e.g. RGB, CMYK, HSV, etc. to shades of gray. It varies between complete black and complete white.Importance of grayscaling Dimension reduction: For example, In RGB images there are three color channels and three dimensions whi 5 min read Image Processing in PythonImage processing involves analyzing and modifying digital images using computer algorithms. It is widely used in fields like computer vision, medical imaging, security and artificial intelligence. Python with its vast libraries simplifies image processing, making it a valuable tool for researchers a 7 min read Erosion and Dilation of images using OpenCV in pythonMorphological operations are a set of operations that process images based on shapes. They apply a structuring element to an input image and generate an output image. The most basic morphological operations are two: Erosion and Dilation Basics of Erosion: Erodes away the boundaries of the foreground 2 min read OpenCV Python Program to analyze an image using HistogramIn this article, image analysis using Matplotlib and OpenCV is discussed. Let's first understand how to experiment image data with various styles and how to represent with Histogram. Prerequisites: OpenCVmatplotlibImporting image dataimport matplotlib.pyplot as plt #importing matplotlib The image sh 4 min read Histograms Equalization in OpenCVPrerequisite : Analyze-image-using-histogramHistogram equalization is a method in image processing of contrast adjustment using the image's histogram. This method usually increases the global contrast of many images, especially when the usable data of the image is represented by close contrast value 1 min read Python | Thresholding techniques using OpenCV | Set-1 (Simple Thresholding)Thresholding is a technique in OpenCV, which is the assignment of pixel values in relation to the threshold value provided. In thresholding, each pixel value is compared with the threshold value. If the pixel value is smaller than the threshold, it is set to 0, otherwise, it is set to a maximum valu 3 min read Python | Thresholding techniques using OpenCV | Set-2 (Adaptive Thresholding)Prerequisite: Simple Thresholding using OpenCV In the previous post, Simple Thresholding was explained with different types of thresholding techniques. Another Thresholding technique is Adaptive Thresholding. In Simple Thresholding, a global value of threshold was used which remained constant throug 2 min read Python | Thresholding techniques using OpenCV | Set-3 (Otsu Thresholding)In the previous posts, Simple Thresholding and Adaptive Thresholding were explained. In Simple Thresholding, the global value of threshold was used which remained constant throughout. In Adaptive thresholding, the threshold value is calculated for smaller regions with different threshold values for 2 min read OpenCV: Segmentation using ThresholdingIn this article, a basic technique for object segmentation called Thresholding. But before moving into anymore detail, below is a brief overview of OpenCV. OpenCV (Open Source Computer Vision) is a cross platform, open-source library of programming functions, aimed at performing real-time computer v 5 min read Python OpenCV | cv2.cvtColor() methodOpenCV-Python is a library of Python bindings designed to solve computer vision problems. cv2.cvtColor() method is used to convert an image from one color space to another. There are more than 150 color-space conversion methods available in OpenCV. We will use some of color space conversion codes be 4 min read Filter Color with OpenCVColour segmentation or color filtering is widely used in OpenCV for identifying specific objects/regions having a specific color. The most widely used color space is RGB color space, it is called an additive color space as the three color shades add up to give color to the image. To identify a regio 2 min read Python | Denoising of colored images using opencvDenoising 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 Python | Visualizing image in different color spacesOpenCV (Open Source Computer Vision) is a computer vision library that contains various functions to perform operations on pictures or videos. It was originally developed by Intel but was later maintained by Willow Garage and is now maintained by Itseez. This library is cross-platform that is it is 4 min read Find Co-ordinates of Contours using OpenCV | PythonIn this article, we will learn how to find the co-ordinates of Contours with the help of OpenCV. Contours are defined as the line joining all the points along the boundary of an image that are having the same intensity. Contours come handy in shape analysis, finding the size of the object of interes 3 min read Python | Bilateral FilteringA bilateral filter is used for smoothening images and reducing noise, while preserving edges. This article explains an approach using the averaging filter, while this article provides one using a median filter. However, these convolutions often result in a loss of important edge information, since t 2 min read Image Inpainting using OpenCVImage inpainting is the process of removing damage, such as noises, strokes or text, on images. It is particularly useful in the restoration of old photographs which might have scratched edges or ink spots on them. These can be digitally removed through this method. Image inpainting works by replaci 3 min read Python | Intensity Transformation Operations on ImagesIntensity transformations are applied on images for contrast manipulation or image thresholding. These are in the spatial domain, i.e. they are performed directly on the pixels of the image at hand, as opposed to being performed on the Fourier transform of the image. The following are commonly used 5 min read Python | Image Registration using OpenCVImage registration is a digital image processing technique that helps us align different images of the same scene. For instance, one may click the picture of a book from various angles. Below are a few instances that show the diversity of camera angles.Now, we may want to "align" a particular image 3 min read Python | Background subtraction using OpenCVBackground Subtraction has several use cases in everyday life, It is being used for object segmentation, security enhancement, pedestrian tracking, counting the number of visitors, number of vehicles in traffic etc. It is able to learn and identify the foreground mask.As the name suggests, it is abl 2 min read Background Subtraction in an Image using Concept of Running AverageBackground subtraction is a technique for separating out foreground elements from the background and is done by generating a foreground mask. This technique is used for detecting dynamically moving objects from static cameras. Background subtraction technique is important for object tracking. There 4 min read Python | Foreground Extraction in an Image using Grabcut AlgorithmIn this article we'll discuss an efficient method of foreground extraction from the background in an image. The idea here is to find the foreground, and remove the background. GrabCut Algorithm for Image SegmentationGrabCut is an interactive image segmentation algorithm that was introduced by Carst 8 min read Python | Morphological Operations in Image Processing (Opening) | Set-1Morphological operations are used to extract image components that are useful in the representation and description of region shape. Morphological operations are some basic tasks dependent on the picture shape. It is typically performed on binary images. It needs two data sources, one is the input i 3 min read Python | Morphological Operations in Image Processing (Closing) | Set-2In the previous article, the Opening operator was specified which was applying the erosion operation after dilation. It helps in removing the internal noise in the image. Closing is similar to the opening operation. In closing operation, the basic premise is that the closing is opening performed in 2 min read Python | Morphological Operations in Image Processing (Gradient) | Set-3In the previous articles, the Opening operation and the Closing operations were specified. In this article, another morphological operation is elaborated that is Gradient. It is used for generating the outline of the image. There are two types of gradients, internal and external gradient. The intern 2 min read Image segmentation using Morphological operations in PythonIf we want to extract or define something from the rest of the image, eg. detecting an object from a background, we can break the image up into segments in which we can do more processing on. This is typically called Segmentation. Morphological operations are some simple operations based on the imag 2 min read Image Translation using OpenCV | PythonTranslation refers to the rectilinear shift of an object i.e. an image from one location to another. If we know the amount of shift in horizontal and the vertical direction, say (tx, ty) then we can make a transformation matrix e.g. \begin{bmatrix} 1 & 0 & tx \\ 0 & 1 & ty \end{bmatr 2 min read Image Pyramid using OpenCV | PythonImage Pyramids are one of the most beautiful concept of image processing.Normally, we work with images with default resolution but many times we need to change the resolution (lower it) or resize the original image in that case image pyramids comes handy. The pyrUp() function increases the size to d 1 min read Working with Images - Feature Detection and DescriptionLine detection in python with OpenCV | Houghline methodThe Hough Transform is a method that is used in image processing to detect any shape, if that shape can be represented in mathematical form. It can detect the shape even if it is broken or distorted a little bit.We will see how Hough transform works for line detection using the HoughLine transform m 6 min read Circle Detection using OpenCV | PythonCircle detection finds a variety of uses in biomedical applications, ranging from iris detection to white blood cell segmentation. The technique followed is similar to the one used to detect lines, as discussed in this article. Basics of Circle Detection A circle can be described by the following eq 3 min read Python | Detect corner of an image using OpenCVOpenCV (Open Source Computer Vision) is a computer vision library that contains various functions to perform operations on Images or videos. OpenCV library can be used to perform multiple operations on videos. Let's see how to detect the corner in the image. cv2.goodFeaturesToTrack() method finds N 2 min read Python | Corner Detection with Shi-Tomasi Corner Detection Method using OpenCVWhat is a Corner? A corner can be interpreted as the junction of two edges (where an edge is a sudden change in image brightness). Shi-Tomasi Corner Detection - Shi-Tomasi Corner Detection was published by J.Shi and C.Tomasi in their paper 'Good Features to Track'. Here the basic intuition is that c 3 min read Python | Corner detection with Harris Corner Detection method using OpenCVHarris Corner detection algorithm was developed to identify the internal corners of an image. The corners of an image are basically identified as the regions in which there are variations in large intensity of the gradient in all possible dimensions and directions. Corners extracted can be a part of 2 min read Find Circles and Ellipses in an Image using OpenCV | PythonTo identify circles, ellipses, or in general, any shape in which the pixels are connected we use the SimpleBlobDetector() function of OpenCV. In non-technical terms, a blob is understood as a thick liquid drop. Here, we are going to call all shapes a blob. Our task is to detect and recognize whether 2 min read Python | Document field detection using Template MatchingTemplate matching is an image processing technique which is used to find the location of small-parts/template of a large image. This technique is widely used for object detection projects, like product quality, vehicle tracking, robotics etc. In this article, we will learn how to use template matchi 2 min read Python | Smile detection using OpenCVEmotion detectors are used in many industries, one being the media industry where it is important for the companies to determine the public reaction to their products. In this article, we are going to build a smile detector using OpenCV which takes in live feed from webcam. The smile/happiness detec 3 min read Working with Images - Drawing FunctionsPython OpenCV | cv2.line() methodOpenCV-Python is a library of Python bindings designed to solve computer vision problems. cv2.line() method is used to draw a line on any image.Syntax:cv2.line(image, start_point, end_point, color, thickness) Parameters: image: It is the image on which line is to be drawn. start_point: It is the sta 3 min read Python OpenCV | cv2.arrowedLine() methodOpenCV-Python is a library of Python bindings designed to solve computer vision problems. cv2.arrowedLine() method is used to draw arrow segment pointing from the start point to the end point. Syntax: cv2.arrowedLine(image, start_point, end_point, color, thickness, line_type, shift, tipLength)Param 3 min read Python OpenCV | cv2.ellipse() methodOpenCV-Python is a library of Python bindings designed to solve computer vision problems. cv2.ellipse() method is used to draw a ellipse on any image. Syntax: cv2.ellipse(image, centerCoordinates, axesLength, angle, startAngle, endAngle, color [, thickness[, lineType[, shift]]]) Parameters: image: I 3 min read Python OpenCV | cv2.circle() methodOpenCV-Python is a library of Python bindings designed to solve computer vision problems. cv2.circle() method is used to draw a circle on any image. The syntax of cv2.circle() method is: Syntax: cv2.circle(image, center_coordinates, radius, color, thickness) Parameters: image: It is the image on w 3 min read Python OpenCV | cv2.rectangle() methodOpenCV-Python is a library of Python bindings designed to solve computer vision problems. cv2.rectangle() method is used to draw a rectangle on any image. Syntax: cv2.rectangle(image, start_point, end_point, color, thickness) Parameters:image: It is the image on which rectangle is to be drawn. start 4 min read Python OpenCV | cv2.putText() methodOpenCV-Python is a library of Python bindings designed to solve computer vision problems. cv2.putText() method is used to draw a text string on any image. Syntax: cv2.putText(image, text, org, font, fontScale, color[, thickness[, lineType[, bottomLeftOrigin]]]) Parameters:image: It is the image on w 5 min read Find and Draw Contours using OpenCV - PythonContours are edges or outline of a objects in a image and is used in image processing to identify shapes, detect objects or measure their size. We use OpenCV's findContours() function that works best for binary images.There are three important arguments of this function:Source Image: This is the ima 3 min read Draw a triangle with centroid using OpenCVPrerequisite: Geometric shapes using OpenCV Given three vertices of a triangle, write a Python program to find the centroid of the triangle and then draw the triangle with its centroid on a black window using OpenCV. Examples: Input: (100, 200) (50, 50) (300, 100) Output: (150, 116) Libraries Needed 2 min read Working with VideosPython | Play a video using OpenCVOpenCV (Open Source Computer Vision) is a computer vision library that contains various functions to perform operations on Images or videos. OpenCV library can be used to perform multiple operations on videos. Letâs see how to play a video using the OpenCV Python. To capture a video, we need to crea 2 min read Python | Create video using multiple images using OpenCVCreating 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 Extract images from video in PythonOpenCV comes with many powerful video editing functions. In current scenario, techniques such as image scanning, face recognition can be accomplished using OpenCV. Image Analysis is a very common field in the area of Computer Vision. It is the extraction of meaningful information from videos or imag 2 min read Python OpenCV: Capture Video from CameraPython provides various libraries for image and video processing. One of them is OpenCV. OpenCV is a vast library that helps in providing various functions for image and video operations. With OpenCV, we can capture a video from the camera. It lets you create a video capture object which is helpful 4 min read Python - Process images of a video using OpenCVProcessing a video means, performing operations on the video frame by frame. Frames are nothing but just the particular instance of the video in a single point of time. We may have multiple frames even in a single second. Frames can be treated as similar to an image.So, whatever operations we can pe 4 min read Python - Writing to video with OpenCVIn this article, we will discuss how to write to a video using OpenCV in Python. ApproachImport the required libraries into the working space.Read the video on which you have to write. Syntax: cap = cv2.VideoCapture("path")Create a output file using cv2.VideoWriter_fourcc() method Syntax: output = c 1 min read Python OpenCv: Write text on videoOpenCV is the huge open-source library for computer vision, machine learning, and image processing and now it plays a major role in real-time operation which is very important in todayâs systems. By using it, one can process images and videos to identify objects, faces, or even the handwriting of a 2 min read Python | Create video using multiple images using OpenCVCreating 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 Saving Operated Video from a webcam using OpenCVOpenCV is a vast library that helps in providing various functions for image and video operations. With OpenCV, we can perform operations on the input video. OpenCV also allows us to save that operated video for further usage. For saving images, we use cv2.imwrite() which saves the image to a specif 4 min read Applications and ProjectsPython | Program to extract frames using OpenCVOpenCV comes with many powerful video editing functions. In the current scenario, techniques such as image scanning and face recognition can be accomplished using OpenCV. OpenCV library can be used to perform multiple operations on videos. Letâs try to do something interesting using CV2. Take a vide 2 min read Displaying the coordinates of the points clicked on the image using Python-OpenCVOpenCV helps us to control and manage different types of mouse events and gives us the flexibility to operate them. There are many types of mouse events. These events can be displayed by running the following code segment : import cv2 [print(i) for i in dir(cv2) if 'EVENT' in i] Output : EVENT_FLAG_ 3 min read White and black dot detection using OpenCV | PythonImage processing using Python is one of the hottest topics in today's world. But image processing is a bit complex and beginners get bored in their first approach. So in this article, we have a very basic image processing python program to count black dots in white surface and white dots in the blac 4 min read Python | OpenCV BGR color palette with trackbarsOpenCV is a library of programming functions mainly aimed at real-time computer vision. In this article, Let's create a window which will contain RGB color palette with track bars. By moving the trackbars the value of RGB Colors will change b/w 0 to 255. So using the same, we can find the color with 2 min read Draw a rectangular shape and extract objects using Python's OpenCVOpenCV is an open-source computer vision and machine learning software library. Various image processing operations such as manipulating images and applying tons of filters can be done with the help of it. It is broadly used in Object detection, Face Detection, and other Image processing tasks. Let' 4 min read Invisible Cloak using OpenCV | Python ProjectHave you ever seen Harry Potter's Invisible Cloak; Was it wonderful? Have you ever wanted to wear that cloak? If Yes!! then in this post, we will build the same cloak which Harry Potter uses to become invisible. Yes, we are not building it in a real way but it is all about graphics trickery. In this 4 min read ML | Unsupervised Face Clustering PipelineLive face-recognition is a problem that automated security division still face. With the advancements in Convolutions Neural Networks and specifically creative ways of Region-CNN, itâs already confirmed that with our current technologies, we can opt for supervised learning options such as FaceNet, Y 15+ min read Saving Operated Video from a webcam using OpenCVOpenCV is a vast library that helps in providing various functions for image and video operations. With OpenCV, we can perform operations on the input video. OpenCV also allows us to save that operated video for further usage. For saving images, we use cv2.imwrite() which saves the image to a specif 4 min read Face Detection using Python and OpenCV with webcamFace detection is a important application of computer vision that involves identifying human faces in images or videos. In this Article, we will see how to build a simple real-time face detection application using Python and OpenCV where webcam will be used as the input source.Step 1: Installing Ope 3 min read Opening multiple color windows to capture using OpenCV in PythonOpenCV is an open source computer vision library that works with many programming languages and provides a vast scope to understand the subject of computer vision.In this example we will use OpenCV to open the camera of the system and capture the video in two different colors. Approach: With the lib 2 min read Python | Play a video in reverse mode using OpenCVOpenCV (Open Source Computer Vision) is a computer vision library that contains various functions to perform operations on Images or videos. OpenCV's application areas include : 1) Facial recognition system 2) motion tracking 3) Artificial neural network 4) Deep neural network 5) video streaming etc 3 min read Template matching using OpenCV in PythonTemplate matching is a technique for finding areas of an image that are similar to a patch (template). A patch is a small image with certain features. The goal of template matching is to find the patch/template in an image. To find it, the user has to give two input images: Source Image (S) - The im 6 min read Cartooning an Image using OpenCV - PythonInstead of sketching images by hand we can use OpenCV to convert a image into cartoon image. In this tutorial you'll learn how to turn any image into a cartoon. We will apply a series of steps like:Smoothing the image (like a painting)Detecting edges (like a sketch)Combining both to get a cartoon ef 2 min read Vehicle detection using OpenCV PythonVehicle detection is an important application of computer vision that helps in monitoring traffic, automating parking systems and surveillance systems. In this article, weâll implement a simple vehicle detection system using Python and OpenCV using a pre-trained Haar Cascade classifier and we will g 3 min read Count number of Faces using Python - OpenCVPrerequisites: Face detection using dlib and openCV In this article, we will use image processing to detect and count the number of faces. We are not supposed to get all the features of the face. Instead, the objective is to obtain the bounding box through some methods i.e. coordinates of the face i 3 min read Live Webcam Drawing using OpenCVLet us see how to draw the movement of objects captured by the webcam using OpenCV. Our program takes the video input from the webcam and tracks the objects we are moving. After identifying the objects, it will make contours precisely. After that, it will print all your drawing on the output screen. 3 min read Detect and Recognize Car License Plate from a video in real timeRecognizing a Car License Plate is a very important task for a camera surveillance-based security system. We can extract the license plate from an image using some computer vision techniques and then we can use Optical Character Recognition to recognize the license number. Here I will guide you thro 11 min read Essential OpenCV Functions to Get Started into Computer Vision Computer vision is a process by which we can understand the images and videos how they are stored and how we can manipulate and retrieve data from them. Computer Vision is the base or mostly used for Artificial Intelligence. Computer-Vision is playing a major role in self-driving cars, robotics as w 7 min read OpenCV ProjectsBuild GUI Application Pencil Sketch from Photo in PythonIn this article, we will cover how to convert images to watercolor sketches and pencil sketch Linux. Sketching and painting are used by artists of many disciplines to preserve ideas, recollections, and thoughts. Experiencing art from painting and sculpting to visiting an art museumâprovides a variet 5 min read Python OpenCV - Drowsiness DetectionThe number of fatalities on the road due to drowsiness is very high. Thus python allows the model of deep learning algorithm via including the use of OpenCV. Drowsiness Detection is the detection of a person to check whether the person is feeling sleepy while performing a significant task. This dete 9 min read Face Alignment with OpenCV and PythonFace Alignment is the technique in which the image of the person is rotated according to the angle of the eyes.  This technique is actually used as a part of the pipeline process in which facial detection is done using the image. This implementation of face alignment can be easily done with the help 6 min read Age Detection using Deep Learning in OpenCVThe task of age prediction might sound simple at first but it's quite challenging in real-world applications. While predicting age is typically seen as a regression problem this approach faces many uncertainties like camera quality, brightness, climate condition, background, etc. In this article we' 5 min read Right and Left Hand Detection Using PythonIn this article, we are going to see how to Detect Hands using Python. We will use mediapipe and OpenCV libraries in python to detect the Right Hand and Left Hand. We will be using the Hands model from mediapipe solutions to detect hands, it is a palm detection model that operates on the full image 5 min read OpenCV Python: How to detect if a window is closed?OpenCV in Python provides a method cv2.getWindowProperty() to detect whether a window is closed or open. getWindowProperty() returns -1 if all windows are closed. This is one of the main problems we face while using the OpenCV package, sometimes it's hard to detect whether the window is open or clos 2 min read Save frames of live video with timestamps - Python OpenCVImages are very important data nowadays from which we can obtain a lot of information which will helpful for analysis. Sometimes data to be processed can be in the form of video. To process this kind of data we have to read video extract frames and save them as images. Security camera videos we have 3 min read Detecting low contrast images with OpenCV, scikit-image, and PythonIn this article, we are going to see how to detect low contrast images with OpenCV, scikit-image using Python A low contrast image has the minimal distinction between light and dark parts, making it difficult to tell where an object's boundary begins and the scene's background begins. For example Th 2 min read Animate image using OpenCV in PythonIn this article, we will discuss how to animate an image using python's OpenCV module. Let's suppose we have one image. Using that single image we will animate it in such a way it will appear continuous array of the same image. This is useful in animating the background in certain games. For example 3 min read Drawing a cross on an image with OpenCVIn this article, we are going to discuss how to draw a cross on an image using OpenCV-Python. We can draw an overlay of two lines one above another to make a cross on an image.  To draw a line on OpenCV, the below function is used. Syntax: cv2.line(image, starting Point, ending Point, color, thickn 5 min read Blur and anonymize faces with OpenCV and PythonIn this article, we are going to see how to Blur and anonymize faces with OpenCV and Python. For this, we will be using Cascade Classifier to detect the faces. Make sure to download the same, from this link: haarcascade_frontalface_default.xml ApproachFirstly, we use a built face detection algorithm 4 min read Face Detection using Cascade Classifier using OpenCV - PythonFace detection is a important task in computer vision and Haar Cascade classifiers play an important role in making this process fast and efficient. Haar Cascades are used for detecting faces and other objects by training a classifier on positive and negative images.Positive Images: These images con 3 min read Real time object color detection using OpenCVIn this article, we will discuss how to detect a monochromatic colour object using python and OpenCV. Monochromatic color means light of a single wavelength. We will use the video, captured using a webcam as input and try to detect objects of a single color, especially Blue. But you can detect any c 4 min read Python - Writing to video with OpenCVIn this article, we will discuss how to write to a video using OpenCV in Python. ApproachImport the required libraries into the working space.Read the video on which you have to write. Syntax: cap = cv2.VideoCapture("path")Create a output file using cv2.VideoWriter_fourcc() method Syntax: output = c 1 min read Add image to a live camera feed using OpenCV-PythonIn this article, we are going to learn how to insert an image in your live camera feed using OpenCV in Python. Stepwise ImplementationStep 1: Importing the libraries CV reads and stores all the images as a NumPy array. We need the NumPy library to manipulate the image and as expected we need the cv2 4 min read Face and Hand Landmarks Detection using Python - Mediapipe, OpenCVIn this article, we will use mediapipe python library to detect face and hand landmarks. We will be using a Holistic model from mediapipe solutions to detect all the face and hand landmarks. We will be also seeing how we can access different landmarks of the face and hands which can be used for diff 4 min read Emotion Based Music Player - Python ProjectIn this article, we will be discussing how can we recommend music based on expressions or say dominant expressions on someone's face. This is a basic project in which we will be using OpenCV, Matplotlib, DeepFace, and Spotify API. Import Packages and ModulesOpenCV: OpenCV is a Python open-source pac 6 min read Realtime Distance Estimation Using OpenCV - PythonPrerequisite: Introduction to OpenCV In this article, we are going to see how to calculate the distance with a webcam using OpenCV in Python. By using it, one can process images and videos to identify objects, faces, or even the handwriting of a human. This article focuses on detecting objects. We w 5 min read Webcam QR code scanner using OpenCVIn this article, we're going to see how to perform QR code scanning using a webcam. Webcam QR CODE Scanner Before starting, You need to know how this process is going to work. Firstly you need to open your webcam, and you've to run your python program to make it ready to scan the QR code. You can t 3 min read Color Identification in Images using Python - OpenCVAn 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 Real-Time Edge Detection using OpenCV in Python | Canny edge detection methodEdge detection is one of the fundamental image-processing tasks used in various Computer Vision tasks to identify the boundary or sharp changes in the pixel intensity. It plays a crucial role in object detection, image segmentation and feature extraction from the image. In Real-time edge detection, 5 min read Opencv Python program for Face DetectionThe objective of the program given is to detect object of interest(face) in real time and to keep tracking of the same object.This is a simple example of how to detect face in Python. You can try to use training samples of any other object of your choice to be detected by training the classifier on 2 min read Like