"As more and more artificial intelligence is entering into the world, more and more emotional intelligence must enter into leadership."- Amit Ray
Computer vision is part of the artificial intelligence field, where computers are trained to intervene in digital media, i.e. images, videos like humans can, now it can be either stored media or live streaming from any camera or web-camera.
In simple words, with machine learning and deep learning algorithms, computers are able to recognize and process the objects from the video/images as a human can able to recognize.
Relationship of AI and CV, Source
Companies like Tesla and Waymo invested in self-driving cars, that will be assumed to be the future of the automobile industry.
Amazon Go, which overcame the work of store owners by eliminating the need for a cashier and checkout counters, as a customer can directly pay their bills utilizing, which proves to save the time of the customer and disappear the endless queues of people waiting at the checkout counters for their turn.
Using machine learning and computer vision, it’s now possible to recognize the faces of a particular person either from videos or photos. In particular, this application can also be utilized in surveillance.
Although it’s hard to substitute computers with a human in the healthcare sector. But still, computer vision will be helpful to the doctors in medical diagnosis as it can detect patterns from the images that humans can’t like, cancer tumours.
(Learn here how AI can assist in healthcare with threats and applications)
Open Source Computer Vision, started by Intel in 1999 for the computer vision and machine learning applications. Initially, it was developed in C/C++ which later developed to support other languages too including Python.
It provides support to some of the deep learning frameworks including TensorFlow, PyTorch, Caffe. This blog will include the use of Open CV ‘s Python API.
With the help of Open CV in python, its possible to process images, videos easily and can extract useful information out of that, as there are lots of functions available. Some of the common applications are,
Images can be read, write, show, and processed with the OpenCV, like can generate a new image from that either by changing its shape, colour, or extract something useful from the given one and write into a new image.
Either from the live streaming using web camera or from the locally stored videos/images utilizing Haar- Cascade Classifiers.
It followed by face detection from the videos using open cv by drawing bounding boxes i.e. rectangle and then model training using ML algorithms to recognize faces.
Face Recognition using Open CV, Source
Open CV along with the YOLO, an object detection algorithm can be used to detect objects from the image, videos either moving or stationary objects.
Object Detection using YOLO and OpenCV
Python represents an image as a Numpy array.
Run the below code to install an Open CV in your system. Install Python before following these steps.
In the command prompt,
pip install OpenCV-python
In the anaconda prompt,
conda install -c conda-forge OpenCV
sudo apt-get install libopencv-dev python-Open
Images in python represented as NumPy array, basically array of pixels. Whenever the user reads the image using OpenCV it will be the colour image (by default) that contains multiple values for single-pixel i.e. for Red, green, Blue channels.
Run the below code to read and display image using OpenCV in google collab,
Read & Display image using OpenCV
When the user reads the image using OpenCV then there are different formats available, you just need to pass flag corresponding as per your requirement,
cv2.IMREAD_COLOR: Default format to read the image.
cv2.IMREAD_GRAYSCALE: Load the image in grayscale format.
cv2.IMREAD_UNCHANGED: Load the image in the same format in which it stored.
Run the below code to read the image as grayscale and also to convert the colour image into a grayscale format,
Display the grayscale Image
Run the below code to convert the image into HSV format.
Display the HSV format
Run the below code to write the grayscale image into the local machine.
Write the image using OpenCV
Sometimes you require the same images with different orientation i.e. rotated images at different angles or you can say data augmentation.
Run the below code to rotate the image,
Rotate the image by 90 degree
An image segmentation technique, where each pixel value will be compared with some threshold value and will be updating the pixel value of the image.
But the image threshold will only work on a grayscale image.
Run the below code for image thresholding,
There are different types of Image Thresholding flag available, which you can use as per your requirement,
Edge detection will help in many applications like object detections from images/videos.
Run the below code to detect edges from the image.
Edge detection of an image
Now its time to detect contours from the images i.e. lines present in the images. Even you can also get the count of objects present in the image as well as shapes can also polygonal shapes can be detected present in the images.
Run the below code for contour detection,
As mentioned above, face detection can be done using OpenCV as there are machine learning-based classifiers available to detect face and different parts of the face by using appropriate classifiers i.e. Haar Cascade classifiers.
Run the below code to detect face from the images,
Face Detection using OpenCV, Source
Apart from all the above-discussed functions, there are some more functionalities available by Open CV, for which you can refer to its official documentation.
Computer Vision is the subfield of Artificial Intelligence, where computers are trained to process the image and extract the important features from the images or videos. Open Computer Vision (OpenCV) a python library, written in C++, provides various functionalities for computer vision applications.
Applications of computer vision are object detection, face recognition, medical diagnosis, etc. Using OpenCV, users can read, display the images from the local storage, also images can be saved into local storage using OpenCV.
Apart from that images loaded can be read either in colour format or grayscale format. Edge detection is another method to detect edges of the image, contour detection will be used to detect all the shapes present in the image. Several functions and applications of OpenCV including face detection using Haar Cascade classifiers have been covered in this blog.
Computer Vision and Data Science enthusiast with expertise in Python and its libraries like Open CV, pandas, Numpy, matplotlib, sklearn, Keras, nltk, etc. I have worked on projects in • Machine Learning, • Natural Language Processing, • Deep Learning, • Image Processing. Apart from this, I have practiced, • Android Development with Java and Flutter (Dart), Firebase • Gmail add-ons development with Google App Script
What is the OpenAI GPT-3?READ MORE
Introduction to Time Series Analysis: Time-Series Forecasting Machine learning Methods & ModelsREAD MORE
How is Artificial Intelligence (AI) Making TikTok Tick?READ MORE
6 Major Branches of Artificial Intelligence (AI)READ MORE
7 Types of Activation Functions in Neural NetworkREAD MORE
7 types of regression techniques you should know in Machine LearningREAD MORE
Reliance Jio and JioMart: Marketing Strategy, SWOT Analysis, and Working EcosystemREAD MORE
Top 10 Big Data Technologies in 2020READ MORE
Introduction to Logistic Regression - Sigmoid Function, Code ExplanationREAD MORE
What is K-means Clustering in Machine Learning?READ MORE