0% found this document useful (0 votes)
57 views

An Introduction To Opencv Using Python With Ubuntu: Krupali Mistry, Avneet Saluja

The document discusses OpenCV which is an open source library for image and video analysis. It describes OpenCV features, modules, data structures, image processing techniques like normalization, thresholding, edge detection and smoothing that can be implemented using OpenCV with Python.

Uploaded by

jaywant kadam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
57 views

An Introduction To Opencv Using Python With Ubuntu: Krupali Mistry, Avneet Saluja

The document discusses OpenCV which is an open source library for image and video analysis. It describes OpenCV features, modules, data structures, image processing techniques like normalization, thresholding, edge detection and smoothing that can be implemented using OpenCV with Python.

Uploaded by

jaywant kadam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

International Journal of Scientific Research in Computer Science, Engineering and Information Technology

© 2016 IJSRCSEIT | Volume 1 | Issue 2 | ISSN : 2456-3307

An Introduction to OpenCV using Python with Ubuntu


Krupali Mistry1, Avneet Saluja2
1,2
Assistant Professor,Department of Computer Science and Engineering, ITM Universe, Vadodara, Gujarat, India

ABSTRACT
OpenCV is an open source library for image and video analysis by Intel.It is related to computer vision, such as
feature and object detection and machine learning.The purpose of the paper is implementation of image processing
techniques using opencv with python in Ubuntu platforms.
Keywords: Opencv, Ubuntu, Python, Image Processing Techniques.

I. INTRODUCTION  Image data manipulation (allocation, release,


copying, setting, conversion).
Computer vision is a fast growing field for analyzing,  Image and video I/O (file and camera
modifying, and high-level understanding of images. basedinput,image/video file output).
Main motive is to determine and understand the  Matrix and vector manipulation and linear algebra
images and to provide people with new images that are routines.
extra useful.  Various dynamic data structures (lists, queues, sets,
trees, graphs).
OpenCV is an Image Processing library created by  Basic image processing (filtering, edge detection,
Intel,It can be freely downloaded and It is available for corner detection, samplingand interpolation, color
C, C++, Java and Python,Windows, Linux, Mac OS, conversion, morphological operations,
iOS and Android Newest Its versions are opencv- histograms,image pyramids
2.4.13 and opencv-3.1.It is open Source and also Easy  Structural analysis (connected components,
to use and install .It is designed for computational contour processing, distance transform, various
efficiency strong focus on real-time applications The moments, template matching, Hough transform,
first implementation was in the C programming polygonal approximation, line fitting, ellipse
language; however, its popularity grew with its C++ fitting, Delaunay triangulation).
implementation as of Version 2.0. New functions are  Camera calibration (finding and tracking
programmed with C++. However, nowadays, the calibration patterns, calibration, fundamental
library has a full interface for other programming matrix estimation, homography estimation, stereo
languages, such as Java, Python, and correspondence).
MATLAB/Octave.OpenCV is freely available for  Motion analysis (optical flow, motion
download at http://opencv.org. This site provides the segmentation, tracking).
last version for distribution (currently, 3.0 beta) and  Object recognition (eigen-methods, HMM).
older versions. OpenCV requires that images be in
 Basic GUI (display image/video, keyboard and
BGR or Grayscale in order to be shown or saved.
mouse handling, scroll-bars).Image labeling (line,
Otherwise, undesirable effects may result.
conic, polygon, text drawing).

II. METHODS AND MATERIAL Modules of opencv


 cv - Main OpenCV functions
Open cv Features:
 Both low and high level API

CSEIT16129 | Received: 02 October 2016 | Accepted: 10 October 2016 | September-October-2016 [(2)5: 65-68] 65
 cvaux - Auxiliary (experimental) OpenCV
functions Basic Image Transformation Functions or
 cxcore - Data structures and linear algebra support Techniques of opencv
 highgui - GUI functions, This provides simple
user interface (UI) capabilities. All OpenCV classes and functions are in the cv
 imgproc - linear and non-linear image filtering, namespace, and consequently, we will have the
geometrical image transformations, following two options in our source code:
color space conversion, histograms, etc.  Add the using namespace cv declaration after
 calib3d - multiple-view geometry algorithms, including the header files.
single and stereo camera calibration, etc.  Append the cv:: prefix to all the OpenCV classes,
 features2d - These are functions for feature functions, and data structures that we use.
detection (corners and planar This option is recommended if the external names
 objects), feature description, feature matching, and provided by OpenCV conflict with the often-used
so on. standard template library (STL) or other
 objdetect - detection of objects and instances of libraries.
the predefined classes (for example, faces, eyes,
mugs, people, cars, etc.) Image Normalization: process of stretching the range
 gpu - GPU-accelerated algorithms from different of an image from [a, b] to [c, d], important for
visualization, normalize(imagein, imageout, low, high,
OpenCV modules
method). This is incredibly important for visualization
 others – helper
because if the image is beyond [0,255] it will cause
truncation or unsightly effects.
Basic opencv Data Structures
 Point, Point2f - 2D Point: int x,y several operators
and fuctions available
 Size - 2D size structure: int width, height
 Rect - 2D rectangle object int x, y, width, height
 RotatedRect - Rect object with angle
 Mat - image object mainly - rows, cols - length
and width, channels, depth,a large number of Figure 1. Image Normalization Results
functions for manipulation, a critical being
Mat.type() returns the TYPE of a matrix Thresholding threshold( image, image, thresh, maxVal,
CODE), codes e.g. THRESH_BINARY
OpenCV: Types

The TYPE is a very important aspect of OpenCV


Represented as CV_<Datatype>C<no of Channels>
OpenCV: PixelTypes
shows how the image is represented in data
 BGR - The default color of imread(). Normal 3
channel color
 HSV - Hue is color, Saturation is amount, Value is
lightness. 3 channels
Figure 2. Image Thresholding Results
 GRAYSCALE - Gray values, Single channel
 Converting colorspaces: cvtColor( image, image,
Edge Detection: several methods available: Sobel,
code): codes
Scharr, Laplacian and Canny
• Sobel Edge Detection
CV_<colorspace>2<colorspace>,
void cv::Sobel(image in, image out, CV_DEPTH, dx,
dy);
e.g CV_BGR2GRAY, CV_BGR2HSV
• Scharr Edge Detection
Volume 1 | Issue 2 | September-October-2016 | www.ijsrcseit.com 66
void cv::Scharr(image in, image out, CV_DEPTH, dx,
dy);
• Laplacian Edge Detection
void cv::Laplacian( image in, image out, CV_DEPTH);

Figure 6. Image Dilation Results

Figure 3. Edge Detection Results III. RESULTS AND DISCUSSION

Image Smoothing: Image smoothing is used to reduce All


the the sharpness of edges and detail in an image. fully in Regular font.
OpenCV includes most of the commonly used methods.
IV.CONCLUSION
• void GaussianBlur(imagein, imageout, Size ksize,
sig);
• void medianBlur (imagein, imageout, Size ksize); This paper presented a brief look at implementing basic
computer vision functionality using Python. The three
libraries looked at have very different goals, but can all
be used for computer vision at different levels.
OpenCV can be used for computer vision development
and applications.For embedded platforms where speed
is of utmost importance, or when computer vision
functionality is the main requirement, OpenCV is the
Figure 4. Image Smoothing Results
fastest and most complete tool for computer vision.
OpenCV is considered by many to be side by side with
Erosion:
many commercial image-processing packages, and yet
Erosion erodes the image. It tries to bring uniformity in
it is an open source tool. Furthermore thanks to the fact
the image by converting bright points in neighborhood
that OpenCV keeps evolving is an additional guarantee
of points of less intensity into darker ones
that it will advance research in vision and promote the
development of rich, vision-based CPU intensive
applications.

V. REFERENCES

[1] http://www.sourceforge.net/projects/opencvlibrar
Figure 5. Image Erosion Results y Computer VisionHomepage
[2] http://www-2.cs.cmu.edu/~cil/vision.html
Notice the change in eyes, illuminates spots in the eyes [3] R. Szeliski. Computer Vision: Algorithms and
are removed because in the input image there is a stark Applications. Springer 2011.
change in illumination at points near pupil. [4] http://opencv.willowgarage.com/wiki/
[5] http://en.wikipedia.org/wiki/BSD_license
Dilation: [6] R. Laganière. OpenCV 2 Computer Vision
Application Programming Cookbook. Packt
Dilation dilates the image. It tries to bring uniformity Publishing 2011
in image by converting dark points in neighborhood of [7] J. Canny. A Computational approach to edge
points of higher intensity into bright ones. detection. IEEE Transactions on Pattern Analysis
and Image Understanding, vol.18 (6), pp. 679-
698, 1986.

Volume 1 | Issue 2 | September-October-2016 | www.ijsrcseit.com 67


[8] C. Harris, M.J. Stephens. A combined corner and
edge detector. Alvey Vision Conference, pp.
147–152, 1988.
[9] J. Shi and C. Tomasi. Good Features to Track.
IEEE Conference on Computer Vision and
Pattern Recognition, pp. 593-600, 1994.
[10] Learning OpenCV" by Gary Bradski and Adrian
Kaehler;
[11] "OpenCV 2 Computer Vision Application
Programming Cookbook" by Robert Laganiere;
[12] Digital Image Processing" by Rafael C. Gonzalez
and Richard E. Woods;
[13] Digital Image Processing By
Gonzalez2ndEdition2002.pdf

Volume 1 | Issue 2 | September-October-2016 | www.ijsrcseit.com 68

You might also like