Skip to main content

Posts

Showing posts from 2019

Object Detection And Tracking using Python - Opencv

Let us discuss today how you can detect and track an object in real-time. We will be using Python language and Opencv library for this purpose. Check out the video below. If you have read my previous blogs, you can directly skip down to the contour part. As usual, we need to make a few assumptions for the proper working of this application. This background is always static i.e. there is no addition or subtraction of objects in the background scene. The background-color is always constant. It does not change with time. The object that will be used for writing/painting is of a different color than the background to give us sufficient contrast between foreground and background. We are ready to begin now. Let us start by installing necessary python libraries for our project using  pip install.  We will be needing  Numpy  and  Opencv  libraries. Now create a python project and create a new script. Import the required libraries into python script as shown below. import cv2

Writing In Air Using Finger In Python- Opencv

Today we will be discussing how you can write/paint in the air using your finger. We will be using Python language and Opencv library for this purpose. Check out the video below. Ok before starting we need to make a few assumptions for the proper working of this application. This background is always static i.e. there is no addition or subtraction of objects in the background scene. The background-color is always constant. It does not change with time. The object that will be used for writing/painting is of a different color than the background to give us sufficient contrast between foreground and background. We are ready to begin now. Let us start by installing necessary python libraries for our project using  pip install.  We will be needing  Numpy  and  Opencv  libraries. Now create a python project and create a new script. Import the required libraries into python script as shown below. import cv2 import numpy as np To capture a video, we need to create

Writing in Air using Python and Opencv | Computer Vision

Today we will be discussing how you can write/paint in the air using a colored object. We will be using Python language and Opencv library for this purpose. Check out the video below. I think you now get the idea of what we will be doing. Ok before starting we need to make a few assumptions for the proper working of this application. This background is always static i.e. there is no addition or subtraction of objects in the background scene. The background-color is always constant. It does not change with time. The object that will be used for writing/painting is of a different color than the background to give us sufficient contrast between foreground and background. We are ready to begin now. Let us start by installing necessary python libraries for our project using pip install. We will be needing Numpy and Opencv libraries. Now create a python project and create a new script. Import the required libraries into python script as shown below. import cv2 import nump

Designing Exclusive OR gate

An Ex-OR gate has two or more inputs and a single output. The definition of the Ex-OR gate states that if and only if one of the input is 1 then the output is 1. The structure of the Ex-OR gate is shown below. The truth table for a two-input Ex-OR gate is shown below. You will notice that when only one of the inputs is 1 only then the output is 1. Since we have already designed AND, OR and NOT gates using diodes and transistors. We will be using these basic gates to build the Ex-OR gate. You can go through the tutorials on AND , OR and NOT gates by clicking on the links. An Ex-OR gate can be built in two ways. Let us define the boolean equation for an Ex-OR gate. As per the definition if A = 1 or B = 1 but not simultaneously then, Y = 1. Therefore, Remember 'bar' above the equation represents NOT operation. This boolean equation can be represented by the following diagram. We can also interpret the definition in another way i.e. if A = 1 and B = 0 o

Designing NOT gate using Transistor

A NOT gate has a single input and a single output. The definition of NOT gate states that if the input is 1 then the output is 0 and vice versa. The structure of the NOT gate is shown below. The truth table of NOT gate is shown below. Now to understand the working of NOT gate, you must understand how the transistor works as a switch. The transistor is shown in the figure below. A transistor is a 3 terminal device. The terminals are named as collector, base, and emitter as labeled below. To simply put, collector and emitter are the two ends of the switch. The closing and opening of this switch are controlled by supplying a small current ib to the base. When the base current (ib) is supplied to the transistor, the acts as a closed switch and the current flows from collector to emitter. When there is no base current, the transistor acts as an open circuit. Having understood the working of the transistor as a switch let us understand the circuit diagram of NOT gate which is show

Designing AND gate using Diodes

An AND gate has two or more inputs and a single output. The definition of AND gate states that if one of the inputs is 0 the output will be 0. The figure below shows the structure of the AND gate. For a two-input AND gate, the relationship between input and output is shown in the truth table below. You will notice that if any-one of the input is 0 then the output is 0. Now let us try to understand how you can build AND gate using diodes. But first, you must understand the basic principle on which the diode works. Look at the figure of the diode below. If you apply some positive voltage V(in) which is greater than Vth (Breakdown voltage of diode) at point A then the diode will act as a closed switch or it will be forward biased. Thus the diode will start conducting. On the other hand, if you apply some negative voltage V(in) which is less than Vth, the diode will not conduct and will act as an open switch. This is called reverse biased. Having understood the wor

Designing OR Gate using Diodes

An OR gate has two or more inputs and a single output. The definition of OR gate states that if one of the inputs is '1' the output will be '1'. The figure below shows the structure of the OR gate. For a two-input OR gate, the relationship between input and output is shown in the truth table below. You will notice that if any-one of the input is 1 then the output is 1. Now let us try to understand how you can build OR gate using diodes. But first, you must understand the basic principle on which the diode works. Look at the figure of the diode below. If you apply some positive voltage V(in) which is greater than Vth (Breakdown voltage of diode) at point A then the diode will act as a closed switch or it will be forward biased. Thus the diode will start conducting. On the other hand if you apply some negative voltage V(in) which is less than Vth, the diode will not conduct and will act as an open switch. This is called reverse biased. Having und