Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • Open CV
  • scikit-image
  • pycairo
  • Pyglet
  • Python
  • Numpy
  • Pandas
  • Python Database
  • Data Analysis
  • ML Math
  • Machine Learning
  • NLP
  • Deep Learning
  • Deep Learning Interview Questions
  • ML Projects
  • ML Interview Questions
  • 100 Days of Machine Learning
Open In App
Next Article:
Feature detection and matching with OpenCV-Python
Next article icon

Feature Matching using Brute Force in OpenCV

Last Updated : 20 Feb, 2023
Comments
Improve
Suggest changes
Like Article
Like
Report

In this article, we will do feature matching using Brute Force in Python by using OpenCV library.

Prerequisites: OpenCV

OpenCV is a python library which is used to solve the computer vision problems.  

OpenCV is an open source Computer Vision library. So computer vision is a way of teaching intelligence to machine and making them see things just like humans.

In other words, OpenCV is what that allows the computer to see and process visual data just like humans.

Installation:

For installing the openCV library, write the following command in your command prompt.

pip install opencv-python

Approach:

  • Import the OpenCV library.
  • Load the images using imread() function and pass the path or name of the image as a parameter.
  • Create the ORB detector for detecting the features of the images.
  • Using the ORB detector find the keypoints and descriptors for both of the images.
  • Now after detecting the features of the images. Now write the Brute Force Matcher for matching the features of the images and stored it in the variable named as "brute_force".
  • For matching we are using the brute_force.match() and pass the descriptors of first image and descriptors of the second image as a parameter.
  • After finding the matches we have to sort that matches according to the humming distance between the matches, less will be the humming distance better will be the accuracy of the matches.
  • Now after sorting according to humming distance we have to draw the feature matches for that we use drawMatches() function in which pass first image and keypoints of first image, second image and keypoints of second image and the best_matches as a parameter and stored it in the variable named as "output_image".
  • Now after drawing the feature matches we have to see the matches for that we use imshow() function which comes in cv2 library and pass the window name and output_image.
  • Now write the waitkey() function and write the destroyAllWindows() for destroying all the windows.

Oriented Fast and Rotated Brief (ORB) Detector

ORB detector stands for Oriented Fast and Rotated Brief, this is free of cost algorithm, the benefit of this algorithm is that it does not require GPU it can compute on normal CPU.

ORB is basically the combination of two algorithms involved FAST and BRIEF where FAST stands for Features from Accelerated Segments Test whereas BRIEF stands for Binary Robust Independent Elementary Features.

ORB detector first uses FAST algorithm, this FAST algorithm finds the key points then applies Harries corner measure to find top N numbers of key points among them, this algorithm quickly selects the key points by comparing the distinctive regions like the intensity variations.

This algorithm works on Key point matching, Key point is distinctive regions in an image like the intensity variations.

Now the role of BRIEF algorithm comes, this algorithm takes the key points and turn into the binary descriptor/binary feature vector that contains the combination of 0s and1s only. 

The key points founded by FAST algorithm and Descriptors created by BRIEF algorithm both together represent the object. BRIEF is the faster method for feature descriptor calculation and it also provides a high recognition rate until and unless there is large in-plane rotation.

Brute Force Matcher

Brute Force Matcher is used for matching the features of the first image with another image.

It takes one descriptor of first image and matches to all the descriptors of the second image and then it goes to the second descriptor of first image and matches to all the descriptor of the second image and so on.

Example 1: Reading/Importing the images from their path using OpenCV library.

Python
# importing openCV library import cv2  # function to read the images by taking there path def read_image(path1,path2):   # reading the images from their using imread() function     read_img1 = cv2.imread(path1)     read_img2 = cv2.imread(path2)     return (read_img1,read_img2)  # function to convert images from RGB to gray scale  def convert_to_grayscale(pic1,pic2):     gray_img1 = cv2.cvtColor(pic1,cv2.COLOR_BGR2GRAY)     gray_img2 = cv2.cvtColor(pic2,cv2.COLOR_BGR2GRAY)     return (gray_img1,gray_img2)  # main function if __name__ == '__main__':  # giving the path of both of the images     first_image_path = 'C:/UsersPython(ds)/1611755129039.jpg'     second_image_path = 'C:/Users/Python(ds)/1611755720390.jpg'      # reading the image from there path by calling the function     img1, img2 = read_image(first_image_path,second_image_path)      # converting the read images into the gray scale images by calling the function     gray_pic1, gray_pic2 = convert_to_grayscale(img1,img2)     cv2.imshow('Gray scaled image 1',gray_pic1)     cv2.imshow('Gray scaled image 2',gray_pic2)     cv2.waitKey()     cv2.destroyAllWindows() 

Output:

Example 2: Creating ORB detector for finding the features in the images.

Python
# importing openCV library import cv2  # function to read the images by taking there path def read_image(path1,path2):     read_img1 = cv2.imread(path1)     read_img2 = cv2.imread(path2)     return (read_img1,read_img2)  # function to convert images from RGB to gray scale  def convert_to_grayscale(pic1,pic2):     gray_img1 = cv2.cvtColor(pic1,cv2.COLOR_BGR2GRAY)     gray_img2 = cv2.cvtColor(pic2,cv2.COLOR_BGR2GRAY)     return (gray_img1,gray_img2)  # function to detect the features by finding key points and descriptors from the image def detector(image1,image2):     # creating ORB detector     detect = cv2.ORB_create()      # finding key points and descriptors of both images using detectAndCompute() function     key_point1,descrip1 = detect.detectAndCompute(image1,None)     key_point2,descrip2 = detect.detectAndCompute(image2,None)     return (key_point1,descrip1,key_point2,descrip2)  # main function if __name__ == '__main__':  # giving the path of both of the images     first_image_path = 'C:/Users/Python(ds)//1611755129039.jpg'     second_image_path = 'C:/Users/Python(ds)/1611755720390.jpg'      # reading the image from there paths     img1, img2 = read_image(first_image_path,second_image_path)      # converting the read images into the gray scale images     gray_pic1, gray_pic2 = convert_to_grayscale(img1,img2)      # storing the finded key points and descriptors of both of the images     key_pt1,descrip1,key_pt2,descrip2 = detector(gray_pic1,gray_pic2)      # showing the images with their key points finded by the detector     cv2.imshow("Key points of Image 1",cv2.drawKeypoints(gray_pic1,key_pt1,None))     cv2.imshow("Key points of Image 2",cv2.drawKeypoints(gray_pic2,key_pt2,None))      # printing descriptors of both of the images     print(f'Descriptors of Image 1 {descrip1}')     print(f'Descriptors of Image 2 {descrip2}')     print('------------------------------')      # printing the Shape of the descriptors      print(f'Shape of descriptor of first image {descrip1.shape}')     print(f'Shape of descriptor of second image {descrip2.shape}')      cv2.waitKey()     cv2.destroyAllWindows() 

Output:

The first output image shows the drawn key points of both of the images. 

KeyPoints are the point of interest, in simple words means that when the human will see the image at that time the features he notices in that image, in the similar way when the machine read the image it see some points of interest known as Key points.

The second output image shows the descriptors and the shape of the descriptors.

These Descriptors are basically array or bin of numbers. These are used to describe the features, using these descriptors we can match the two different images.

In the second output image, we can see first image descriptor shape and second image descriptor shape is (467, 32) and (500,32) respectively. So, Oriented Fast and Rotated Brief (ORB) detector try to find 500 features in the image by default, and for each descriptor, it will describe 32 values.

So, now how will we use these descriptors now? We can use a Brute Force Matcher (as discussed above in the article) to match these descriptors together and find how many similarities we are getting.

Example 3: Feature Matching using Brute Force Matcher.

Python
# importing openCV library import cv2  # function to read the images by taking there path def read_image(path1,path2):     read_img1 = cv2.imread(path1)     read_img2 = cv2.imread(path2)     return (read_img1,read_img2)  # function to convert images from RGB to gray scale  def convert_to_grayscale(pic1,pic2):     gray_img1 = cv2.cvtColor(pic1,cv2.COLOR_BGR2GRAY)     gray_img2 = cv2.cvtColor(pic2,cv2.COLOR_BGR2GRAY)     return (gray_img1,gray_img2)  # function to detect the features by finding key points  # and descriptors from the image def detector(image1,image2):     # creating ORB detector     detect = cv2.ORB_create()      # finding key points and descriptors of both images using      # detectAndCompute() function     key_point1,descrip1 = detect.detectAndCompute(image1,None)     key_point2,descrip2 = detect.detectAndCompute(image2,None)     return (key_point1,descrip1,key_point2,descrip2)  # function to find best detected features using brute force # matcher and match them according to their humming distance def BF_FeatureMatcher(des1,des2):     brute_force = cv2.BFMatcher(cv2.NORM_HAMMING,crossCheck=True)     no_of_matches = brute_force.match(des1,des2)      # finding the humming distance of the matches and sorting them     no_of_matches = sorted(no_of_matches,key=lambda x:x.distance)     return no_of_matches  # function displaying the output image with the feature matching def display_output(pic1,kpt1,pic2,kpt2,best_match):      # drawing the feature matches using drawMatches() function     output_image = cv2.drawMatches(pic1,kpt1,pic2,kpt2,best_match,None,flags=2)     cv2.imshow('Output image',output_image)  # main function if __name__ == '__main__':     # giving the path of both of the images     first_image_path = 'C:/Users/Python(ds)/1611755129039.jpg'     second_image_path = 'C:/Users/Python(ds)/1611755720390.jpg'      # reading the image from there paths     img1, img2 = read_image(first_image_path,second_image_path)      # converting the read images into the gray scale images     gray_pic1, gray_pic2 = convert_to_grayscale(img1,img2)      # storing the finded key points and descriptors of both of the images     key_pt1,descrip1,key_pt2,descrip2 = detector(gray_pic1,gray_pic2)      # sorting the number of best matches obtained from brute force matcher     number_of_matches = BF_FeatureMatcher(descrip1,descrip2)     tot_feature_matches = len(number_of_matches)      # printing total number of feature matches found     print(f'Total Number of Features matches found are {tot_feature_matches}')      # after drawing the feature matches displaying the output image     display_output(gray_pic1,key_pt1,gray_pic2,key_pt2,number_of_matches)     cv2.waitKey()     cv2.destroyAllWindows() 

Output:

We are getting total of 178 feature matches. Total 178 matches are drawn, but they are sorted according to their humming distance in ascending order means that the distance of 178th feature is greater than the first feature, so first feature match is more accurate than the 178th feature match.

It looks messy because all the 178 feature matches are drawn, let's draw the top fifteen features (for the sake of visibility).

Example 4: First/Top fifteen Feature Matching using Brute Force Matcher.

Python
# importing openCV library import cv2  # function to read the images by taking there path def read_image(path1,path2):     read_img1 = cv2.imread(path1)     read_img2 = cv2.imread(path2)     return (read_img1,read_img2)  # function to convert images from RGB to gray scale  def convert_to_grayscale(pic1,pic2):     gray_img1 = cv2.cvtColor(pic1,cv2.COLOR_BGR2GRAY)     gray_img2 = cv2.cvtColor(pic2,cv2.COLOR_BGR2GRAY)     return (gray_img1,gray_img2)  # function to detect the features by finding key points  # and descriptors from the image def detector(image1,image2):      # creating ORB detector     detect = cv2.ORB_create()      # finding key points and descriptors of both images      # using detectAndCompute() function     key_point1,descrip1 = detect.detectAndCompute(image1,None)     key_point2,descrip2 = detect.detectAndCompute(image2,None)     return (key_point1,descrip1,key_point2,descrip2)  # function to find best detected features using # brute force matcher and match them according to their humming distance def BF_FeatureMatcher(des1,des2):     brute_force = cv2.BFMatcher(cv2.NORM_HAMMING,crossCheck=True)     no_of_matches = brute_force.match(des1,des2)      # finding the humming distance of the matches and sorting them     no_of_matches = sorted(no_of_matches,key=lambda x:x.distance)     return no_of_matches  # function displaying the output image with the feature matching def display_output(pic1,kpt1,pic2,kpt2,best_match):     # drawing first fifteen best feature matches using drawMatches() function     output_image = cv2.drawMatches(pic1,kpt1,pic2,                                    kpt2,best_match[:15],None,flags=2)     cv2.imshow('Output image',output_image)  # main function if __name__ == '__main__':     # giving the path of both of the images     first_image_path = 'C:/Users/Python(ds)/1611755129039.jpg'     second_image_path = 'C:/Users/Python(ds)/1611755720390.jpg'      # reading the image from there paths     img1, img2 = read_image(first_image_path,second_image_path)      # converting the read images into the gray scale images     gray_pic1, gray_pic2 = convert_to_grayscale(img1,img2)      # storing the finded key points and descriptors of both of the images     key_pt1,descrip1,key_pt2,descrip2 = detector(gray_pic1,gray_pic2)      # sorting the number of best matches obtained from brute force matcher     number_of_matches = BF_FeatureMatcher(descrip1,descrip2)      # after drawing the feature matches displaying the output image     display_output(gray_pic1,key_pt1,gray_pic2,key_pt2,number_of_matches)     cv2.waitKey()     cv2.destroyAllWindows() 

Output:

The output image shows the first/top fifteen best feature matching using Brute Force Matcher.

From the above output, we can see that these matches are more accurate than all the remaining feature matches.

Let's take another example for feature matching.

Example 5: Feature matching using Brute Force.

Python
# importing openCV library import cv2  # function to read the images by taking there path def read_image(path1,path2):     read_img1 = cv2.imread(path1)     read_img2 = cv2.imread(path2)     return (read_img1,read_img2)  # function to convert images from RGB to gray scale  def convert_to_grayscale(pic1,pic2):     gray_img1 = cv2.cvtColor(pic1,cv2.COLOR_BGR2GRAY)     gray_img2 = cv2.cvtColor(pic2,cv2.COLOR_BGR2GRAY)     return (gray_img1,gray_img2)  # function to detect the features by finding key points and  # descriptors from the image def detector(image1,image2):      # creating ORB detector     detect = cv2.ORB_create()     # finding key points and descriptors of both images     # using detectAndCompute() function     key_point1,descrip1 = detect.detectAndCompute(image1,None)     key_point2,descrip2 = detect.detectAndCompute(image2,None)     return (key_point1,descrip1,key_point2,descrip2)  # function to find best detected features using brute  # force matcher and match them according to their humming distance def BF_FeatureMatcher(des1,des2):     brute_force = cv2.BFMatcher(cv2.NORM_HAMMING,crossCheck=True)     no_of_matches = brute_force.match(des1,des2)      # finding the humming distance of the matches and sorting them     no_of_matches = sorted(no_of_matches,key=lambda x:x.distance)     return no_of_matches  # function displaying the output image with the feature matching def display_output(pic1,kpt1,pic2,kpt2,best_match):     # drawing the feature matches using drawMatches() function     output_image = cv2.drawMatches(pic1,kpt1,pic2,kpt2,                                    best_match[:30],None,flags=2)     cv2.imshow('Output image',output_image)  # main function if __name__ == '__main__':     # giving the path of both of the images     first_image_path = 'C:/Users/Python(ds)/Titan_1.jpg'     second_image_path = 'C:/Users/Python(ds)/Titan_nor.jpg'      # reading the image from there paths     img1, img2 = read_image(first_image_path,second_image_path)      # converting the read images into the gray scale images     gray_pic1, gray_pic2 = convert_to_grayscale(img1,img2)      # storing the finded key points and descriptors of both of the images     key_pt1,descrip1,key_pt2,descrip2 = detector(gray_pic1,gray_pic2)      # sorting the number of best matches obtained from brute force matcher     number_of_matches = BF_FeatureMatcher(descrip1,descrip2)     tot_feature_matches = len(number_of_matches)     print(f'Total Number of Features matches found are {tot_feature_matches}')      # after drawing the feature matches displaying the output image     display_output(gray_pic1,key_pt1,gray_pic2,key_pt2,number_of_matches)     cv2.waitKey()     cv2.destroyAllWindows() 

Output:

In the above example we are getting total 147 best feature matches among them we are drawing only top 30 matches so that we can see the matches properly.

Example 6: Feature Matching using Brute Force Matcher by taking rotated train image.

Python
# importing openCV library import cv2  # function to read the images by taking there path def read_image(path1,path2):     read_img1 = cv2.imread(path1)     read_img2 = cv2.imread(path2)     return (read_img1,read_img2)  # function to convert images from RGB to gray scale  def convert_to_grayscale(pic1,pic2):     gray_img1 = cv2.cvtColor(pic1,cv2.COLOR_BGR2GRAY)     gray_img2 = cv2.cvtColor(pic2,cv2.COLOR_BGR2GRAY)     return (gray_img1,gray_img2)  # function to detect the features by finding key points  # and descriptors from the image def detector(image1,image2):     # creating ORB detector     detect = cv2.ORB_create()      # finding key points and descriptors of both images      # using detectAndCompute() function     key_point1,descrip1 = detect.detectAndCompute(image1,None)     key_point2,descrip2 = detect.detectAndCompute(image2,None)     return (key_point1,descrip1,key_point2,descrip2)  # function to find best detected features using brute  # force matcher and match them according to their humming distance def BF_FeatureMatcher(des1,des2):     brute_force = cv2.BFMatcher(cv2.NORM_HAMMING,crossCheck=True)     no_of_matches = brute_force.match(des1,des2)      # finding the humming distance of the matches and sorting them     no_of_matches = sorted(no_of_matches,key=lambda x:x.distance)     return no_of_matches  # function displaying the output image with the feature matching def display_output(pic1,kpt1,pic2,kpt2,best_match):     # drawing the feature matches using drawMatches() function     output_image = cv2.drawMatches(pic1,kpt1,pic2,                                    kpt2,best_match[:30],None,flags=2)     cv2.imshow('Output image',output_image)  # main function if __name__ == '__main__':     # giving the path of both of the images     first_image_path = 'C:/Users/Python(ds)/Titan_1.jpg'     second_image_path = 'C:/Users/Python(ds)/Titan_rotated.jpg'      # reading the image from there paths     img1, img2 = read_image(first_image_path,second_image_path)      # converting the read images into the gray scale images     gray_pic1, gray_pic2 = convert_to_grayscale(img1,img2)      # storing the finded key points and descriptors of both of the images     key_pt1,descrip1,key_pt2,descrip2 = detector(gray_pic1,gray_pic2)      # sorting the number of best matches obtained from brute force matcher     number_of_matches = BF_FeatureMatcher(descrip1,descrip2)     tot_feature_matches = len(number_of_matches)     print(f'Total Number of Features matches found are {tot_feature_matches}')      # after drawing the feature matches displaying the output image     display_output(gray_pic1,key_pt1,gray_pic2,key_pt2,number_of_matches)     cv2.waitKey()     cv2.destroyAllWindows() 

Output:

In this example when we have taken the rotated train image then we have found that there is little difference in the total number of best feature matches i.e, 148.

In the first output image, we have only drawn the top thirty best feature matches.


Next Article
Feature detection and matching with OpenCV-Python
author
srishivansh5404
Improve
Article Tags :
  • Technical Scripter
  • Machine Learning
  • AI-ML-DS
  • Technical Scripter 2020
  • OpenCV
  • python
  • Python-OpenCV
Practice Tags :
  • Machine Learning
  • python

Similar Reads

  • Computer Vision Tutorial
    Computer Vision is a branch of Artificial Intelligence (AI) that enables computers to interpret and extract information from images and videos, similar to human perception. It involves developing algorithms to process visual data and derive meaningful insights. Why Learn Computer Vision?High Demand
    8 min read
  • Introduction to Computer Vision

    • Computer Vision - Introduction
      Ever wondered how are we able to understand the things we see? Like we see someone walking, whether we realize it or not, using the prerequisite knowledge, our brain understands what is happening and stores it as information. Imagine we look at something and go completely blank. Into oblivion. Scary
      3 min read

    • A Quick Overview to Computer Vision
      Computer vision means the extraction of information from images, text, videos, etc. Sometimes computer vision tries to mimic human vision. It’s a subset of computer-based intelligence or Artificial intelligence which collects information from digital images or videos and analyze them to define the a
      3 min read

    • Applications of Computer Vision
      Have you ever wondered how machines can "see" and understand the world around them, much like humans do? This is the magic of computer vision—a branch of artificial intelligence that enables computers to interpret and analyze digital images, videos, and other visual inputs. From self-driving cars to
      6 min read

    • Fundamentals of Image Formation
      Image formation is an analog to digital conversion of an image with the help of 2D Sampling and Quantization techniques that is done by the capturing devices like cameras. In general, we see a 2D view of the 3D world. In the same way, the formation of the analog image took place. It is basically a c
      7 min read

    • Satellite Image Processing
      Satellite Image Processing is an important field in research and development and consists of the images of earth and satellites taken by the means of artificial satellites. Firstly, the photographs are taken in digital form and later are processed by the computers to extract the information. Statist
      2 min read

    • Image Formats
      Image formats are different types of file types used for saving pictures, graphics, and photos. Choosing the right image format is important because it affects how your images look, load, and perform on websites, social media, or in print. Common formats include JPEG, PNG, GIF, and SVG, each with it
      5 min read

    Image Processing & Transformation

    • Digital Image Processing Basics
      Digital Image Processing means processing digital image by means of a digital computer. We can also say that it is a use of computer algorithms, in order to get enhanced image either to extract some useful information. Digital image processing is the use of algorithms and mathematical models to proc
      7 min read

    • Difference Between RGB, CMYK, HSV, and YIQ Color Models
      The colour spaces in image processing aim to facilitate the specifications of colours in some standard way. Different types of colour models are used in multiple fields like in hardware, in multiple applications of creating animation, etc. Let’s see each colour model and its application. RGBCMYKHSV
      3 min read

    • Image Enhancement Techniques using OpenCV - Python
      Image enhancement is the process of improving the quality and appearance of an image. It can be used to correct flaws or defects in an image, or to simply make an image more visually appealing. Image enhancement techniques can be applied to a wide range of images, including photographs, scans, and d
      15+ min read

    • Image Transformations using OpenCV in Python
      In this tutorial, we are going to learn Image Transformation using the OpenCV module in Python. What is Image Transformation? Image Transformation involves the transformation of image data in order to retrieve information from the image or preprocess the image for further usage. In this tutorial we
      5 min read

    • How to find the Fourier Transform of an image using OpenCV Python?
      The Fourier Transform is a mathematical tool used to decompose a signal into its frequency components. In the case of image processing, the Fourier Transform can be used to analyze the frequency content of an image, which can be useful for tasks such as image filtering and feature extraction. In thi
      5 min read

    • Python | Intensity Transformation Operations on Images
      Intensity 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

    • Histogram Equalization in Digital Image Processing
      A digital image is a two-dimensional matrix of two spatial coordinates, with each cell specifying the intensity level of the image at that point. So, we have an N x N matrix with integer values ranging from a minimum intensity level of 0 to a maximum level of L-1, where L denotes the number of inten
      6 min read

    • Python - Color Inversion using Pillow
      Color Inversion (Image Negative) is the method of inverting pixel values of an image. Image inversion does not depend on the color mode of the image, i.e. inversion works on channel level. When inversion is used on a multi color image (RGB, CMYK etc) then each channel is treated separately, and the
      4 min read

    • Image Sharpening Using Laplacian Filter and High Boost Filtering in MATLAB
      Image sharpening is an effect applied to digital images to give them a sharper appearance. Sharpening enhances the definition of edges in an image. The dull images are those which are poor at the edges. There is not much difference in background and edges. On the contrary, the sharpened image is tha
      4 min read

    • Wand sharpen() function - Python
      The sharpen() function is an inbuilt function in the Python Wand ImageMagick library which is used to sharpen the image. Syntax: sharpen(radius, sigma) Parameters: This function accepts four parameters as mentioned above and defined below: radius: This parameter stores the radius value of the sharpn
      2 min read

    • Python OpenCV - Smoothing and Blurring
      In this article, we are going to learn about smoothing and blurring with python-OpenCV. When we are dealing with images at some points the images will be crisper and sharper which we need to smoothen or blur to get a clean image, or sometimes the image will be with a really bad edge which also we ne
      7 min read

    • Python PIL | GaussianBlur() method
      PIL is the Python Imaging Library which provides the python interpreter with image editing capabilities. The ImageFilter module contains definitions for a pre-defined set of filters, which can be used with the Image.filter() method. PIL.ImageFilter.GaussianBlur() method create Gaussian blur filter.
      1 min read

    • Apply a Gauss filter to an image with Python
      A Gaussian Filter is a low-pass filter used for reducing noise (high-frequency components) and for blurring regions of an image. This filter uses an odd-sized, symmetric kernel that is convolved with the image. The kernel weights are highest at the center and decrease as you move towards the periphe
      2 min read

    • Spatial Filtering and its Types
      Spatial Filtering technique is used directly on pixels of an image. Mask is usually considered to be added in size so that it has specific center pixel. This mask is moved on the image such that the center of the mask traverses all image pixels. Classification on the basis of Linearity There are two
      3 min read

    • Python PIL | MedianFilter() and ModeFilter() method
      PIL is the Python Imaging Library which provides the python interpreter with image editing capabilities. The ImageFilter module contains definitions for a pre-defined set of filters, which can be used with the Image.filter() method. PIL.ImageFilter.MedianFilter() method creates a median filter. Pick
      1 min read

    • Python | Bilateral Filtering
      A 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

    • Python OpenCV - Morphological Operations
      Python OpenCV Morphological operations are one of the Image processing techniques that processes image based on shape. This processing strategy is usually performed on binary images.  Morphological operations based on OpenCV are as follows: ErosionDilationOpeningClosingMorphological GradientTop hatB
      7 min read

    • Erosion and Dilation of images using OpenCV in python
      Morphological 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

    • Introduction to Resampling methods
      While reading about Machine Learning and Data Science we often come across a term called Imbalanced Class Distribution, which generally happens when observations in one of the classes are much higher or lower than in other classes. As Machine Learning algorithms tend to increase accuracy by reducing
      8 min read

    • Python | Image Registration using OpenCV
      Image 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

    Feature Extraction and Description

    • Feature Extraction Techniques - NLP
      Introduction : This article focuses on basic feature extraction techniques in NLP to analyse the similarities between pieces of text. Natural Language Processing (NLP) is a branch of computer science and machine learning that deals with training computers to process a large amount of human (natural)
      11 min read

    • SIFT Interest Point Detector Using Python - OpenCV
      SIFT (Scale Invariant Feature Transform) Detector is used in the detection of interest points on an input image. It allows the identification of localized features in images which is essential in applications such as:   Object Recognition in ImagesPath detection and obstacle avoidance algorithmsGest
      4 min read

    • Feature Matching using Brute Force in OpenCV
      In this article, we will do feature matching using Brute Force in Python by using OpenCV library. Prerequisites: OpenCV OpenCV is a python library which is used to solve the computer vision problems. OpenCV is an open source Computer Vision library. So computer vision is a way of teaching intelligen
      13 min read

    • Feature detection and matching with OpenCV-Python
      In this article, we are going to see about feature detection in computer vision with OpenCV in Python. Feature detection is the process of checking the important features of the image in this case features of the image can be edges, corners, ridges, and blobs in the images. In OpenCV, there are a nu
      5 min read

    • Feature matching using ORB algorithm in Python-OpenCV
      ORB is a fusion of FAST keypoint detector and BRIEF descriptor with some added features to improve the performance. FAST is Features from Accelerated Segment Test used to detect features from the provided image. It also uses a pyramid to produce multiscale-features. Now it doesn’t compute the orient
      2 min read

    • Mahotas - Speeded-Up Robust Features
      In this article we will see how we can get the speeded up robust features of image in mahotas. In computer vision, speeded up robust features (SURF) is a patented local feature detector and descriptor. It can be used for tasks such as object recognition, image registration, classification, or 3D rec
      2 min read

    • Create Local Binary Pattern of an image using OpenCV-Python
      In this article, we will discuss the image and how to find a binary pattern using the pixel value of the image. As we all know, image is also known as a set of pixels. When we store an image in computers or digitally, it’s corresponding pixel values are stored. So, when we read an image to a variabl
      5 min read

    Deep Learning for Computer Vision

    • Image Classification using CNN
      The article is about creating an Image classifier for identifying cat-vs-dogs using TFLearn in Python. Machine Learning is now one of the hottest topics around the world. Well, it can even be said of the new electricity in today's world. But to be precise what is Machine Learning, well it's just one
      7 min read

    • What is Transfer Learning?
      Transfer learning is a machine learning technique where a model trained on one task is repurposed as the foundation for a second task. This approach is beneficial when the second task is related to the first or when data for the second task is limited. Leveraging learned features from the initial ta
      11 min read

    • Top 5 PreTrained Models in Natural Language Processing (NLP)
      Pretrained models are deep learning models that have been trained on huge amounts of data before fine-tuning for a specific task. The pre-trained models have revolutionized the landscape of natural language processing as they allow the developer to transfer the learned knowledge to specific tasks, e
      7 min read

    • ML | Introduction to Strided Convolutions
      Let us begin this article with a basic question - "Why padding and strided convolutions are required?" Assume we have an image with dimensions of n x n. If it is convoluted with an f x f filter, then the dimensions of the image obtained are [Tex](n-f+1) x (n-f+1)[/Tex]. Example: Consider a 6 x 6 ima
      2 min read

    • Dilated Convolution
      Prerequisite: Convolutional Neural Networks Dilated Convolution: It is a technique that expands the kernel (input) by inserting holes between its consecutive elements. In simpler terms, it is the same as convolution but it involves pixel skipping, so as to cover a larger area of the input.  Dilated
      5 min read

    • Continuous Kernel Convolution
      Continuous Kernel convolution was proposed by the researcher of Verije University Amsterdam in collaboration with the University of Amsterdam in a paper titled 'CKConv: Continuous Kernel Convolution For Sequential Data'. The motivation behind that is to propose a model that uses the properties of co
      6 min read

    • CNN | Introduction to Pooling Layer
      Pooling layer is used in CNNs to reduce the spatial dimensions (width and height) of the input feature maps while retaining the most important information. It involves sliding a two-dimensional filter over each channel of a feature map and summarizing the features within the region covered by the fi
      5 min read

    • CNN | Introduction to Padding
      During convolution, the size of the output feature map is determined by the size of the input feature map, the size of the kernel, and the stride. if we simply apply the kernel on the input feature map, then the output feature map will be smaller than the input. This can result in the loss of inform
      5 min read

    • What is the difference between 'SAME' and 'VALID' padding in tf.nn.max_pool of tensorflow?
      Padding is a technique used in convolutional neural networks (CNNs) to preserve the spatial dimensions of the input data and prevent the loss of information at the edges of the image. It involves adding additional rows and columns of pixels around the edges of the input data. There are several diffe
      14 min read

    • Convolutional Neural Network (CNN) Architectures
      Convolutional Neural Network(CNN) is a neural network architecture in Deep Learning, used to recognize the pattern from structured arrays. However, over many years, CNN architectures have evolved. Many variants of the fundamental CNN Architecture This been developed, leading to amazing advances in t
      11 min read

    • Deep Transfer Learning - Introduction
      Deep transfer learning is a machine learning technique that utilizes the knowledge learned from one task to improve the performance of another related task. This technique is particularly useful when there is a shortage of labeled data for the target task, as it allows the model to leverage the know
      8 min read

    • Introduction to Residual Networks
      Recent years have seen tremendous progress in the field of Image Processing and Recognition. Deep Neural Networks are becoming deeper and more complex. It has been proved that adding more layers to a Neural Network can make it more robust for image-related tasks. But it can also cause them to lose a
      4 min read

    • Residual Networks (ResNet) - Deep Learning
      After the first CNN-based architecture (AlexNet) that win the ImageNet 2012 competition, Every subsequent winning architecture uses more layers in a deep neural network to reduce the error rate. This works for less number of layers, but when we increase the number of layers, there is a common proble
      9 min read

    • ML | Inception Network V1
      Inception net achieved a milestone in CNN classifiers when previous models were just going deeper to improve the performance and accuracy but compromising the computational cost. The Inception network, on the other hand, is heavily engineered. It uses a lot of tricks to push performance, both in ter
      4 min read

    • Understanding GoogLeNet Model - CNN Architecture
      Google Net (or Inception V1) was proposed by research at Google (with the collaboration of various universities) in 2014 in the research paper titled "Going Deeper with Convolutions". This architecture was the winner at the ILSVRC 2014 image classification challenge. It has provided a significant de
      4 min read

    • Image Recognition with Mobilenet
      Introduction: Image Recognition plays an important role in many fields like medical disease analysis, and many more. In this article, we will mainly focus on how to Recognize the given image, what is being displayed. We are assuming to have a pre-knowledge of Tensorflow, Keras, Python, MachineLearni
      5 min read

    • VGG-16 | CNN model
      A Convolutional Neural Network (CNN) architecture is a deep learning model designed for processing structured grid-like data, such as images. It consists of multiple layers, including convolutional, pooling, and fully connected layers. CNNs are highly effective for tasks like image classification, o
      7 min read

    • Autoencoders in Machine Learning
      An autoencoder is a type of artificial neural network that learns to represent data in a compressed form and then reconstructs it as closely as possible to the original input. Autoencoders consists of two components: Encoder: This compresses the input into a compact representation and capture the mo
      9 min read

    • How Autoencoders works ?
      Autoencoders is a type of neural network used for unsupervised learning particularly for tasks like dimensionality reduction, anomaly detection and feature extraction. It consists of two main parts: an encoder and a decoder. The goal of an autoencoder is to learn a more efficient representation of t
      7 min read

    • Difference Between Encoder and Decoder
      Combinational Logic is the concept in which two or more input states define one or more output states. The Encoder and Decoder are combinational logic circuits. In which we implement combinational logic with the help of boolean algebra. To encode something is to convert in piece of information into
      9 min read

    • Implementing an Autoencoder in PyTorch
      Autoencoders are neural networks that learn to compress and reconstruct data. In this guide we’ll walk you through building a simple autoencoder in PyTorch using the MNIST dataset. This approach is useful for image compression, denoising and feature extraction. Implementation of Autoencoder in PyTor
      4 min read

    • Generative Adversarial Network (GAN)
      Generative Adversarial Networks (GANs) were introduced by Ian Goodfellow and his colleagues in 2014. GANs are a class of neural networks that autonomously learn patterns in the input data to generate new examples resembling the original dataset. GAN's architecture consists of two neural networks: Ge
      12 min read

    • Deep Convolutional GAN with Keras
      Deep Convolutional GAN (DCGAN) was proposed by a researcher from MIT and Facebook AI research. It is widely used in many convolution-based generation-based techniques. The focus of this paper was to make training GANs stable. Hence, they proposed some architectural changes in the computer vision pro
      9 min read

    • StyleGAN - Style Generative Adversarial Networks
      Generative Adversarial Networks (GANs) are a type of neural network that consist two neural networks: a generator that creates images and a discriminator that evaluates them. The generator tries to produce realistic data while the discriminator tries to differentiate between real and generated data.
      6 min read

    Object Detection and Recognition

    • Detect an object with OpenCV-Python
      Object detection refers to identifying and locating objects within images or videos. OpenCV provides a simple way to implement object detection using Haar Cascades a classifier trained to detect objects based on positive and negative images. In this article we will focus on detecting objects using i
      4 min read

    • Haar Cascades for Object Detection - Python
      Haar Cascade classifiers are a machine learning-based method for object detection. They use a set of positive and negative images to train a classifier, which is then used to detect objects in new images. Positive Images: These images contain the objects that the classifier is trained to detect.Nega
      3 min read

    • R-CNN - Region-Based Convolutional Neural Networks
      R-CNN (Region-based Convolutional Neural Network) was introduced by Ross Girshick et al. in 2014. R-CNN revolutionized object detection by combining the strengths of region proposal algorithms and deep learning, leading to remarkable improvements in detection accuracy and efficiency. This article de
      9 min read

    • YOLO v2 - Object Detection
      In terms of speed, YOLO is one of the best models in object recognition, able to recognize objects and process frames at the rate up to 150 FPS for small networks. However, In terms of accuracy mAP, YOLO was not the state of the art model but has fairly good Mean average Precision (mAP) of 63% when
      6 min read

    • Face recognition using Artificial Intelligence
      The current technology amazes people with amazing innovations that not only make life simple but also bearable. Face recognition has over time proven to be the least intrusive and fastest form of biometric verification. The software uses deep learning algorithms to compare a live captured image to t
      15+ min read

    • Deep Face Recognition
      DeepFace is the facial recognition system used by Facebook for tagging images. It was proposed by researchers at Facebook AI Research (FAIR) at the 2014 IEEE Computer Vision and Pattern Recognition Conference (CVPR). In modern face recognition there are 4 steps: DetectAlignRepresentClassify This app
      8 min read

    • ML | Face Recognition Using Eigenfaces (PCA Algorithm)
      In 1991, Turk and Pentland suggested an approach to face recognition that uses dimensionality reduction and linear algebra concepts to recognize faces. This approach is computationally less expensive and easy to implement and thus used in various applications at that time such as handwritten recogni
      4 min read

    • Emojify using Face Recognition with Machine Learning
      In this article, we will learn how to implement a modification app that will show an emoji of expression which resembles the expression on your face. This is a fun project based on computer vision in which we use an image classification model in reality to classify different expressions of a person.
      7 min read

    • Object Detection with Detection Transformer (DETR) by Facebook
      Facebook has just released its State of the art object detection Model on 27 May 2020. They are calling it DERT stands for Detection Transformer as it uses transformers to detect objects.This is the first time that transformer is used for such a task of Object detection along with a Convolutional Ne
      7 min read

    Image Segmentation

    • Image Segmentation Using TensorFlow
      Image segmentation refers to the task of annotating a single class to different groups of pixels. While the input is an image, the output is a mask that draws the region of the shape in that image. Image segmentation has wide applications in domains such as medical image analysis, self-driving cars,
      8 min read

    • Thresholding-Based Image Segmentation
      Image segmentation is the technique of subdividing an image into constituent sub-regions or distinct objects. The level of detail to which subdivision is carried out depends on the problem being solved. That is, segmentation should stop when the objects or the regions of interest in an application h
      7 min read

    • Region and Edge Based Segmentation
      Segmentation Segmentation is the separation of one or more regions or objects in an image based on a discontinuity or a similarity criterion. A region in an image can be defined by its border (edge) or its interior, and the two representations are equal. There are prominently three methods of perfor
      4 min read

    • Image Segmentation with Watershed Algorithm - OpenCV Python
      Image segmentation is a fundamental computer vision task that involves partitioning an image into meaningful and semantically homogeneous regions. The goal is to simplify the representation of an image or make it more meaningful for further analysis. These segments typically correspond to objects or
      9 min read

    • Mask R-CNN | ML
      The article provides a comprehensive understanding of the evolution from basic Convolutional Neural Networks (CNN) to the sophisticated Mask R-CNN, exploring the iterative improvements in object detection, instance segmentation, and the challenges and advantages associated with each model. What is R
      9 min read

    3D Reconstruction

    • Python OpenCV - Depth map from Stereo Images
      OpenCV is the huge open-source library for the 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.Note: For more information, refer to Introduction to OpenCV Depth Map : A depth map is a picture wher
      2 min read

    • Top 7 Modern-Day Applications of Augmented Reality (AR)
      Augmented Reality (or AR) in simpler terms means intensifying the reality of real-time objects which we see through our eyes or gadgets like smartphones. You may think how is it trending a lot? The answer is that it can impactfully offer an unforgettable experience either of learning, measuring the
      9 min read

    • Virtual Reality, Augmented Reality, and Mixed Reality
      Virtual Reality (VR): The word 'virtual' means something that is conceptual and does not exist physically and the word 'reality' means the state of being real. So the term 'virtual reality' is itself conflicting. It means something that is almost real. We will probably never be on the top of Mount E
      3 min read

    • Camera Calibration with Python - OpenCV
      Prerequisites: OpenCV A camera is an integral part of several domains like robotics, space exploration, etc camera is playing a major role. It helps to capture each and every moment and helpful for many analyses. In order to use the camera as a visual sensor, we should know the parameters of the cam
      4 min read

    • Python OpenCV - Pose Estimation
      What is Pose Estimation? Pose estimation is a computer vision technique that is used to predict the configuration of the body(POSE) from an image. The reason for its importance is the abundance of applications that can benefit from technology.  Human pose estimation localizes body key points to accu
      6 min read

  • 40+ Top Computer Vision Projects [2025 Updated]
    Computer Vision is a branch of Artificial Intelligence (AI) that helps computers understand and interpret context of images and videos. It is used in domains like security cameras, photo editing, self-driving cars and robots to recognize objects and navigate real world using machine learning. This a
    4 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences