01lab Intro To OpenCV
01lab Intro To OpenCV
ACTIVITY 1
(DIGITAL IMAGE
PROCESSING)
By: VERA A. PANAGUITON
OUTLINE:
Image Processing
Types of Images
Installation and adding packages
What is OpenCV?
Required Libraries
Image blur, grayscale, canny
Read Images, Videos and Webcams
Using Google Colab
What is Image Processing
Image processing is IMAGE + PROCESSING
What is an Image?
Image is a collection of PIXELS.
Each pixel is like an array of numbers.
These numbers determine the color of the pixel.
Three types of images:
Each kind of image has few attributes attached to it like number of channels and depth .
Number of channels : Defines the dimension of array , each pixel is.
Depth : Defines the maximum bit size of the number which is stored in the array
How an image is represented in memory
10 x 10 image of a number 3
Each image is represented by a set of pixels i.e. a matrix of
pixel values. For a grayscale image, the pixel values range
from 0 to 255 and they represent the intensity of that pixel.
- For instance, if you have an image of 10 x 10
dimensions, it would be represented by a matrix of 10
pixels (width) x 10 pixels (height) (a total of 100-pixel
values).
- Image quality based on pixels:
VGA = 640 x 480
HD = 1280 x 720
FHD = 1920 x 1080
4K = 3840 x 2160
If you are dealing with a colored image, it would have three
channels - Red, Green, and Blue (RGB). Therefore, there
would be three such matrices for a single image.
Grayscale
28 = 256
0 255
RGB
Click the
+ button
After
installation
close the
window.
Select opencv-python
and click the Install
Package button
What is OpenCV?
It stands for ‘Open Source Computer Vision Library’ .
OpenCV is an Image Processing library created by Intel and maintained by Willow
Garage.
It has C++, C, and Python interfaces running on Windows, Linux, Android and Mac.
Basic Modules.
cv : Main OpenCV functions, Image processing and vision algorithms.
cvaux : Auxiliary (experimental) OpenCV functions.
cxcore : Data structures, linear algebra support, XML support drawing functions and
other algorithms.
highgui : GUI functions, Image and Video I/O.
Note: Depending on what your program implements you wish to use, you should
include corresponding modules.
Some Required Libraries
Numpy is an array manipulation library, used for linear algebra,
Fourier transform, and random number capabilities.
Pandas is a library for data manipulation and data analysis.
CV2 is a library for computer vision tasks.
Skimage is a library which supports image processing
applications on python.
Matplotlib is a library which generates figures and provides
graphical user interface toolkit.
Add python file
Right click on
your project
(DIP)
New -> Python File
Add folder and images
Right click on your project -> New -> Directory
Run your
Load image program
Print Properties or
Output:
or
imshow()
first parameter is the name of the
window, second is the image.
waitKey() values:
0 – infinite delay, 1000 – 1 second
Resize/rescale the image
Create function to rescale.
or