Posts

Real Time Face Detection - OpenCV | Python

Image
In this article of the computer vision series we will be discussing real time face detection with the help of Haar Cascade Classifier. In generalized terms face detection is a sub branch of object detection and recognition and therefore, before starting to identify faces we will have to understand the concept of detecting objects. So let's get started. Recall your childhood days when you first time walked down the streets and saw a new creature and that creature was a DOG. That was the first time you got to learn the features of that creature, like yes, a dog has four legs, long ears and a tail. These details as they are passed through your eyes they were processed by a large number of neurons inside your brain to register the fact that this visual belongs to creature known as dog. Since then whenever you saw a dog for the next time each and every time you were enhancing the abilities of your mind in other words, you were learning (learning the features of a dog). After that when

How to Capture Images and Videos With Computer Webcam Using OpenCV in Python ? | Part 2

Image
In the previous post we saw how to capture images and videos in python with the help of VideoCapture() available in OpenCV. But, we left it incomplete, because we only captured the first frame which the Webcam was able to read within the sleep duration. In this post, we will understand how to capture a video rather than only a single frame.  First things first, we will have to import the OpenCV module.  import cv2 Next, we have to instantiate the camera and for that we will make use of the VideoCapture() method with its argument being set to 0. If you have any doubts on what is VideoCapture and what are its different arguments do refer to this post also, we will have to release the camera once we have read the video. This will be done with the help of the release() method.  import cv2 video=cv2.VideoCapture(0) #the above line will trigger the webcam for recording the video video.release()

How to Capture Images and Videos With Computer Webcam Using OpenCV in Python ? | Part 1

Image
In the previous post we learnt how to read images using OpenCV in Python Programming Language. Moving on further in the same direction in this post we will understand how to capture videos with computer webcam using OpenCV. Before starting with how to capture a video let us first get a clear idea of what a video actually is ? A video is actually a collection of multiple images or multiple frames displayed simultaneously one after the other such that, it appears like a video. Having got a clear idea of what a video actually is. What we will do is we will use the OpenCV-Python library to read those frames/images one by one simultaneously. Now, consider that the video is say comprised of ten frames, it means that we will have to read those ten frames consecutively one after the other or in other words, we will have to repeatedly read the frames till the last frame in the collection. Now, recall in any programming language if we want to do a task or a collection of tasks repeatedly, whi

How to Read and Display Images Using OpenCV-Python Part-2

Image
In the previous post we saw how to read an image in a computer with the help of the OpenCV library in Python. We also tried printing the variable in which we stored the image and visualized how actually the colored and grayscale images are stored as 3D and 2D matrices in a computer respectively.  Moving further, in this post we will see how to display an image that we have read using the imread() method of the OpenCV module.  For displaying the image we will have to make use of the imshow() method provided by the OpenCV module. The cv2.imshow() method creates a window in which the image is displayed. It accepts two parameters -  Name of the window in which we want to display the image. The variable in which the image to be displayed is stored as a matrix. import cv2 img=cv2.imread("c:/Users/HP/Desktop/harshad.jpg",1) cv2.imshow("Harshad",img) Next, we will have to make use of the waitKey() method which specifies

How to Read and Display Images Using OpenCV-Python Part - 1

Image
In the previous post  we saw how a computer reads an image, moving ahead in that direction in this post we will explore how to read an image in a computer using the python programming language. We will read an image with the help of the OpenCV (Open Source Computer Vision) module available in python. OpenCV is a library which is used for computer vision oriented tasks. In OpenCV all the images are converted to or form NumPy arrrays.  NumPy is a Python library used for working with arrays. There are functions available in NumPy such that it can also be used in the linear algebra and matrices domain. If you guys are no familiar with NumPy and want me to create a separate series on NumPy let me know in the comments below.  For now, understand it like this, we previously saw that the computer reads and stores an image as a matrix, if it is a colored image it will get read/stored as a 3D-array and if it is a grayscale image it will get read/stored as a 2D-array. So when reading images wit

How to Download and Install Python on Windows | Pycharm IDE Installation Also Explained

Image
  This post is a step-by-step guide for you to understand how to install python on windows and add python to path variable. For the sake of better understanding snapshots of all the steps during the installation process are also attached. 

How does a computer read an image ?

Image
  Computers do not have any understanding of colors, they only understand numbers.  A color model converts colors into numbers that a computer can process in turn. RGB (Red, Green, Blue) and HSV (Hue, Saturation, Value) are the most commonly used color models.  If you are unaware of what these models are all about and how a computer actually reads an image, this post will make you familiar with those concepts.