Professional Documents
Culture Documents
B-2.Types of digital image processing
.
Three types of computerized processes :
low-, mid-, and high-level processing.
( 1 ) Low-level processes involve primitive operations such as image
processing to reduce noise, contrast enhancement, and image sharpeni
ng.
A low-level process is characterized by the fact that both its inputs and
outputs are images.
( 2 ) Mid-level processing on images involves tasks such as segmenta
tion ( partitioning an image into regions or objects ) , description of
those objects to reduce them to a form suitable for computer processin
g, and classification (recognition) of individual objects.
A mid-level process is characterized by the fact that its input ge
nerally are images, but its outputs are attributes extracted from those i
mage.
( 3 ) High-level processing involves “making sense”
of an ensemble of recognized objects, as in image anal
ysis, and, at the far end of the continuum, performing
the cognitive functions normally associated with visio
n.
B-3. About the course
This course will provide the basic concepts and techniques of digital im
age processing which is the preliminary knowledge to get in to the com
puter vision by artificial Intelligence.
1. tool
2. Introduction of Image processing
3. Image processing applications
4. Digital Image Processing by Python
1.tool
1-1. Install Anaconda: integrate Python +
jupyter noteook
1-2. Check the Python version
1-3. Check pip
1-4. Install PIL
1-5. Install OpenCV
1-6. Install numpy
1-1 Install Anaconda
python -m pip install --user--upgrade pip
1-4 install pillow
1-5. install cv2
1.open anaconda prompt
https://pypi.org/project/opencv-python/
1-6 install numpy
p.s.
You can find many helps from exploring the networks
by putting corresponding key words.
Free open access, be aware the version of packages you
used .
2. Introduction of Image processing
Before diving straight into image processing, let's und
erstand images first. An image, as humans see it, is a t
wo-dimensional grid (just like matrix )with each cell i
n the grid filled with a color value(R.G.B), otherwise ca
lled a pixel value(gray level).
Each cell of the grid is for
mally called a picture elem
ent (commonly abbreviate
d to pixel). A computer als
o sees the image in the sa
me way. An image on a co
mputer is a two-dimensio
nal matrix of numbers wit
h each cell in the matrix st Ref:
oring the corresponding p Computer Vision with Py
ixel value(s) in the image.
thon 3
Image processing is the field of studying and analyzing images. There is
a lot of hidden information in an image that we unconsciously process. F
or example, what are the different objects in the image?, Is there a car in
the image? What are the
similarities between any two images?
image essence, image feature
The essence of image processing is to use the different
properties of an image such as color, co-relations betw
een different pixels, object placements, and other fine
details to extract meaningful information such as edge
s, objects, and contours, which are formally called ima
ge features.
These features can then be used in different
applications such as medicine, security, social media s
ervices, and self-driving cars, some of which will be dis
cussed in the following lectures.
3. Image processing applications
For example The following image illu
Medicine:
strates how image proces
In recent years, the field of m
edicine has seen rapid advanc
sing algorithms are being
ements. used to detect tumors. T
For example, more sophisticated his has helped in early di
imaging techniques and better t agnosis of diseases and a
echniques to detect the nature of
more effective treatment:
tumors in MRI/PET scans. The i
nterdisciplinary research
between biology and image proc
essing played an important role.
Figure 2 : The image shows how image processing can
be used to detect tumors.
4. Digital Image Processing by Python
4-1 Python Image Library
4-2 scikit-image
4-3 cv2 installation
4-1 Python Image Library
image
To write or save an image to
a file on your computer, use t
he save() function
associated to the image obje
ct.
4-1-3 Cropping an image
dim = (100,100,300,300) # Dime
Cropping an image means to extract a p nsions of the ROI
articular region of the image, which is crop_img = img.crop(dim) # 影
smaller than the original image. This reg
ion in some books/references in called t 像切割
he Region of Interest (ROI). The conc
ept of ROI is sometimes useful when
crop_img.show() # 顯示影像切
you want to run your algorithm only on 割
a particular part of the image and not th
e entire image.
The image object has a crop() function t
hat takes two coordinates--the upper-lef
t corner and the bottom-right corner of t
he rectangle that you are interested in—
and returns the cropped image:
greyscale = img.convert(“L”) # 彩色轉灰階
4-1-4 Changing between co
greyscale.show()
lor spaces
Grayscale: This is one of th
e simplest color spaces bot
h in terms of
understanding and storing o
n a computer. Each pixel valu
e in a grayscale image
is a single value between 0 an
d 255, with 0 representing bl
ack and 255
representing white.
img = Image.open("F:/Computer Vision/newastronau
Accessing pixels of an ima t.png")
print (img.size)
ge (512, 512)
Sometimes for performing t img.getpixel((355,443))
(254, 254, 254)
asks such as thresholding (w
es in the
degrees to be rotated (co
unter clockwise) as an ar
gument:
rotate_img = img.rotate(90)
Ref:
Saurabh Kapur, “Computer Vision with Python”, Packt
Publishing Ltd. Birmingham, U.K., 2017