Machine Vision Exp 1 (Mumbai Univesrity)
Machine Vision Exp 1 (Mumbai Univesrity)
BE B 05
Machine Vision
Experiment 1
Aim: Basic I/O scripts ,Reading/writing an image file ,Converting between an image
and raw
bytes , Accessing image data with numpy.array ,Reading/writing a video file
,Capturing
camera frames, Displaying images in a window, Displaying camera frames in a
window
Theory:
OpenCV is the huge open-source library for computer vision, machine learning, and
image processing and now it plays a major role in real-time operation which is very
important in today’s systems. By using it, one can process images and videos to
identify objects, faces, or even handwriting of a human. When integrated with various
libraries, such as NumPy, python is capable of processing the OpenCV array
structure for analysis. To Identify image pattern and its various features we use
vector space and perform mathematical operations on these features.
The first OpenCV version was 1.0. OpenCV is released under a BSD licence and
hence it’s free for both academic and commercial use. It has C++, C, Python and
Java interfaces and supports Windows, Linux, Mac OS, iOS and Android. When
OpenCV was designed the main focus was real-time applications for computational
efficiency. All things are written in optimised C/C++ to take advantage of multi-core
processing.
Applications of OpenCV: There are lots of applications which are solved using
OpenCV, some of them are listed below
● face recognition
● Automated inspection and surveillance
● number of people – count (foot traffic in a mall, etc)
● Vehicle counting on highways along with their speeds
● Interactive art installations
● Anomaly (defect) detection in the manufacturing process (the odd
defective products)
● Street view image stitching
● Video/image search and retrieval
● Robot and driver-less car navigation and control
● object recognition
● Medical image analysis
● Movies – 3D structure from motion
● TV Channels advertisement recognition
OpenCV Functionality
● Image/video I/O, processing, display (core, imgproc, highgui)
● Object/feature detection (objdetect, features2d, nonfree)
● Geometry-based monocular or stereo computer vision (calib3d, stitching,
videostab)
● Computational photography (photo, video, superres)
● Machine learning & clustering (ml, flann)
● CUDA acceleration (gpu)
Implementation:
window_name = 'Image'
#######################################
# 1] Basic I/O scripts ,Reading/writing an image file #
#######################################
#####################################
# 2]Converting between an image and raw bytes #
#####################################
#################################
# 4]Accessing image data with numpy.array#
#################################
img3.itemset((0,0,0),255)
print(img3.item(0,0,0))
print(img3.size)
print(img3.reshape)
print(img3.dtype)
Input File:
EiHome.jpg
Robert1.jpg
Output
Changing Image color to gray: EiHomePicReduceColor8_1.png
Conclusion:
In this we study opencv and Basic I/O scripts ,Reading/writing an image file
,Converting between an image and raw bytes , Accessing image data with
numpy.array ,Reading/writing a video file ,Capturing camera frames, Displaying
images in a window, Displaying camera frames in a window