IMAGE PROCESSING AND OPENCV

IMAGE PROCESSING AND OPENCV - Robocraze

An image is an ancient rarity that portrays visual recognition. It's always been intriguing to think of how light falls on an object, and an image is formed in our eyes. It sounds easy, but it has a whole different story behind it when implemented on machines and the world of information and technology. One such story is Image Processing.

 

As the name suggests, Image processing manipulates the image that has been digitized and performs certain operations on an image to extract some information from them. Examples of operations such as exposure correction, colour balancing, image noise reduction, or increasing image sharpness are highly important and very demanding to achieve acceptable results in most computer vision applications.

 

It is a signal processing application where the input is an image, and the output may be an image or characteristics/features associated with the image. Image processing is continuously evolving day by day and has been increasingly used as a research subject in computer science and other disciplines.

 

Image processing is mainly categorized into analogue and digital image processing. The most widely recognized illustration of analogue IP is the TV picture.

 

Digital image processing is most commonly used since it encompasses a broad range of hardware, software, and theoretical underpinnings. There are four basic image processing stages, starting with the basic image feed (image representation), then its pre-processing, segmentation, and finally the output. Other sub-stages include image upgrade, image rebuilding, image investigation, image reproduction, etc. Some of the widely used image processing applications include stitching, morphing, 3D modelling, face detection, and visual authentication.

 

Why do we need it?

The data we collect or generate is raw data and is not understandable by the machine and needs to be analysed and necessary pre-processing is to be performed on it.

 

Requirements:

Image processing can be done using various software and libraries. One of the most widely used libraries is OpenCV, an open-source computer vision and machine learning software library. Programming languages like C++, Python, and Java can be used for IP. Python is extensively used due to its growing popularity as a scientific programming language and the free availability of many Image Processing tools in its ecosystem.

 

Installation:

Assuming that we will use OpenCV via Python, it is an implicit requirement that we have Python3 already installed in the system. Opencv can be installed using the python package manager pip. After installation to check if everything is properly installed or not, type "import cv2" in any text editor and run it, it won't show any error if it is properly installed.

 

Some basic operation in Image Processing:

Before moving on to use image processing in some applications, it's necessary to know some of the basic operations on an image like:

 

Conversion from RGB to grayscale:

Here the image, which is originally in RGB(Red Green Blue) format, is converted to grayscale so that further operations can be performed on it. Below is an illustration of this conversion:

Original image (RGB format)

 

  Grayscale image

 

Thresholding a grayscale image:

After the gray scaling is done on the RGB image, thresholding is further done on it. Thresholding is a type of image segmentation, where we change the pixels of an image to make the image easier to analyze. In thresholding, we convert an image from colour or grayscale into a binary image, i.e., one that is simply black and white. For proper thresholding, threshold values and thresholding type should be given accurately.

                                                Grayscale image

Thresholded image

 

Applications:

Removing noise from an image:

This is one of the most common and important applications of image processing. Noise refers to the unwanted features which make the image hard to perceive by the machine. Although these images can be used directly for feature extraction, the accuracy of the algorithm would suffer greatly. This is why image processing is applied to the image before passing it to the algorithm to get better accuracy. There are different types of noise like Gaussian noise, salt and pepper noise, etc. We can remove that noise from an image by applying a filter that removes that noise, or minimizes its effect. There are a lot of options when it comes to filters as well, each of them has different strengths, and hence is the best for a specific kind of noise.

Grayscale image

 

Filtered image

Edge detection:

Edge detection is an operation that is used to detect the edges in an image. It accepts a grayscale image as an input and it uses a multi-stage algorithm. There are various types of edge detection algorithms, but the few most commonly used ones are Canny, Sobel and Prewitt.

Grayscale image

Image after canny edge detection

Some of the real-life applications of image processing include:  

Robot vision:

Several robot machines work on digital image processing. The image processing technique robot finds its ways, such as hurdle detection bot and line follower bot.

Pattern recognition:

In addition to image processing, it is also combined with artificial intelligence such that handwriting recognition, image recognition can be easily implemented.

Video processing:

Here, a collection of frames or pictures is arranged so that it makes the fast movement of pictures. It involves frame rate conversion, motion detection, reduction of noise and colour space conversion, etc.  

 

Above mentioned are some of the basic definitions, operations, and applications of image processing. Needless to say, there are many more advanced applications of image processing in computer vision and machine learning. There are also medical applications such as processing of X-Rays, Ultrasonic scanning, Electron micrographs, etc.

 

Vision is the most dynamic of all our senses. It provides us with a huge amount of information about what surrounds us, and image processing has eased things by providing an optimized workflow and avoiding losing time. It is important to process images after the capture, in a post-processing step. Day by day, generating and storing these image data is increasing even more in numerous fields like education, medical, agriculture, military, etc. These data need to be identified and sorted properly so as to access, use, and interpret them easily for which image processing is required.  

 

Here is a video explaining image processing and use of Opencv:

 

 

 

This blog has been submitted by Cyborg, NIT Rourkela under the Robocraze Club Outreach Program.

Author: Arpita Mohapatra

 

 

Components and Supplies

    You may also like to read

    Frequently Asked Questions

    Back to blog

    Leave a comment

    Please note, comments need to be approved before they are published.

    Components and Supplies

      You may also like to read