You are on page 1of 5

Experiment 1

Practice of Image and Video acquisition with display

In this experiment, we used to read images and videos using open-cv, and showed them on a window.

OpenCV (Open Source Computer Vision Library) is an open source computer vision and machine learning
software library. This library is used for various types of image processing applications. This is open source,
hence called open-cv. Open source means, the source code for the library is open for all, and anyone can
contribute to this library's development. Primarily, it was built for C++. Now it is mostly used in the Python
programming language. It also has wrappers for Java and MATLAB languages.

1. Installing open-cv in python environment:


Using pip: pip install opencv-python

2. Reading an image using opencv:

3. Reading a video using opencv:

More information: https://docs.opencv.org/4.5.2/dd/d43/tutorial_py_video_display.html


Experiment 2
Practice of image filtering and edge detection in real-time

Filtering
Image filtering means, applying some filters, like color conversion, applying blur, sharpness, contrast, brightness
etc changing. These are some common filter applications we are seeing from our childhood, so we never found it
to be a topic to study. Applying these filters are always sorts of mathematical operations on the image array, and
we need to know that every image is just an array of bit by bit pixel intensities values.

Image filtering is made very simple, by open-cv library functions. Such as:

Code examples:

The other params of GaussianBlur() function are usually set by default, so generally no need to worry about them.
More information: https://www.etutorialspoint.com/index.php/308-python-opencv-image-filtering

Edge Detection
The edge of an object in an image is affected by various factors. Some of the major factors are surface normal
discontinuity, depth discontinuity, surface color discontinuity and illumination discontinuity. There are
several methods of edge detection, like Canny, Sobel, Laplacian and Roberts etc. Canny works best among
them.

Because, canny edge formula requires less information to feed and less code to write, and outputs the best
looking edge in an image. More on why?
Roberts Edge Detection

This is quite a complex implementation, and may not ask for each and every thing. In simple, two kernels are two
matrices of integer. CV_16S is depth constant, (depth of image), structure is CV_<bit-depth>{U|S|F}

Here, 16 bit signed int depth. More info (though not important) see answers

Sobel Edge Detection

Sobel function simply takes the depth as parameter, 0,1 or 1,0 defines X or Y axis, and kerner size.

Laplacian Edge Detection

Also same, just takes the depth of image as one param. np.uint8() is just conversation from laplacian float number
to integer (8 bit).

Canny Edge Detection

This one is even simpler, just takes 2 params, as min_threshold and max_threshold. This thresholds are called
Hysteresis Thresholding, as canny’s theory, not mandatory to study. Usually this thresholds are determined by trial
and error methods.
Experiment 3
Practice of object feature extraction and display in real-time

Feature extraction
Feature extraction from an image is actually extracting information from a picture. Features are parts or patterns
of an object in an image that help to identify it. For example — a square has 4 corners and 4 edges, they can be
called features of the square, and they help us humans identify it’s a square. Features include properties like
corners, edges, regions of interest points, ridges, etc.

Corner detection is one of the most used techniques for feature extraction. There are several corner detection
algorithms, such as Harris, Shi-Tomashi, etc.

Corner detection in real-time using Shi-Tomasi algorithm.

Now-a-days, convolutional neural networks are best for feature extraction from images. This is very complex to
describe and is not going to ask how CNN extracts, it's just, combination of input kernels, pooling, activation
functions and some layer of convolution operations.

There is a question usually asked, what is the difference between feature detection and feature extraction.
Actually detection is the original algorithms of feature or interesting key-points finding, such as corners. The
feature extraction is basically the way of presenting the extracted feature, such as plotting circles on the detected
corners.
Experiment 4
Practice of motion tracking in videos

Motion Tracking
Motion tracking is basically tracking any feature from a motion picture (video). Earlier we have come to know that
features are like corner, edges. We can track the corners to track the motion trail. So this is one way of motion
tracking. The code is just basically simple as before, extracting corners and plotting them on the frames of video.
Just difference is, tracking the motion trail of the corners.

The core part of the code of motion tracking.

Experiment 5
Practice of face recognition in real time

You might also like