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

Week 4 Digital Image Processing

Uploaded by

Roza Vong
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Week 4 Digital Image Processing

Uploaded by

Roza Vong
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

Image Processing

Department of Applied Mathematics and


Statistics (AMS)
Institute of Technology of Cambodia
Lecturer: Khean Vesal

Course: Artificial Intelligence


TP Group: I4-D
Contents

1. What is a Digital Image ?


2. Basic Operations: Read, Write and Show images.
3. Transformation: Crop, Rotate, and Resize images.
4. Conversion: From RGB (or Color) to Grayscale images.
5. Binarization: Black-and-white images.
6. Common Filtering: Smooth, Sharpen, Edge Enhancement, etc.
7. Advanced Filtering: Denoise, etc.
8. Histogram.
9. References
1- Digital Image

• A digital image is a numeric representation, normally binary, of a two-dimensional


image.
• Depending on whether the image resolution is fixed, it may be of vector or raster type.
• By itself, the term "digital image" usually refers to raster images or bitmapped images (as
opposed to vector images).
• Common image formats: PPM, PNG, JPEG, GIF, TIFF, and BMP.
Digital Image (Cont.)

❖ Gray image
• For monochrome (gray) images, the brightness of each pixel is expressed by a numerical value.
• Usually in the range of 0 to 255, 0 for black, 255 for white, and other values for gray between black
and white.
❖ Color image
• Color images can be represented by two-dimensional matrices of Red, Green and Blue triples.
• Did you hear about RGB ?
• Normally, each value of a triple is between 0 and 255,
• 0 means that the corresponding primary color is not present in the pixel,
• and 255 means that the corresponding primary color is maximized in the pixel.
Digital Image (Cont.)

❖ Example digit image


2- Basic Operations: Read, Write and Show images.

❖ Tool: Python-Pillow
• Python Imaging Library (PIL) is a free library for the Python programming language
that adds support for opening, manipulating, and saving many different image file
formats.
❖ Read (Open) and Show an image
• There are two general ways to display am image,
• The first method is using im.show() function in Pillow,
• however sometimes it may not work well in jupyter.
• The alternative method is using a third party library called matplotlib to display it.
3- Transformation: Crop, Rotate, and Resize images.
This part will tell you basic image transforms such as Crop, Rotate, Resize an image, etc.

❖ Crop an image

• If your image is too big or some parts of the image is useful, you can crop it. Here is an
example.
❖ Rotate an image

• If some images are not angeled properly, you may need to rotate them to make them look
better.
❖ Resize an image

• Sometime images are too large to process or need to cost lots of time to process, you can
resize images to make them more smaller.
4- Conversion: From RGB (or Color) to Grayscale images.
Pillow has its own conversion() method to convert images into different formats.

• Take gray scale image conversion as an example:


5- Binarization: Black-and-white images.

❖ Image binarization is the process of setting the gray value of the pixels on the image to 0 or 255,
• that is to say, the whole image presents an obvious black-and-white effect.
❖ In digital image processing, binary image plays a very important role.
• The binarization of an image greatly reduces the amount of data in the image, so that the
outline of the object can be highlighted.
❖ In Pillow, we use point() method to judge each pixel of an image, and set its gray value to 0 or
255 according to its relative size with the mean value, before converting it into a binary image.
6- Common Filtering: Smooth, Sharpen, Edge Enhancement

❖ Image filtering in Python mainly deals with image Smoothing, Sharpening and Edge
enhancement.
• You can regard it as a filter in a mobile photo processing app
❖ There are many kinds of filtering in Pillow, like Relief Filtering.
7- Advanced Filtering: Denoise

Some images have some noise which makes it difficult to evaluate, we can use some filters to
remove these noise.
❖ Here we give an example using Median Filter to remove noise in the image.
• The Median Filter is a nonlinear digital filtering technique, often used to remove noise from
an image or signal.
• Such noise reduction is a typical pre-processing step to improve the results for later
processing (for example, edge detection on an image).
• Median filtering is widely used in digital image processing because under certain conditions
it preserves edges while removing noise.
Note* You can try other filters to remove noise such as a Gaussian filter
7- Advanced Filtering: Denoise (Cont.)

Example using Median Filter to remove noise in the image.

Before After
8- Histogram

An image histogram is a type of histogram that acts as a graphical representation of the tonal
distribution in a digital image. It plots the number of pixels for each tonal value. By looking at the
histogram for a specific image a viewer will be able to judge the entire tonal distribution at a
glance.

• Histogram is a graphical representation of the intensity distribution of an image.


• Histogram quantifies the number of pixels for each intensity value.
9- References

• Fundamental of Image Processing:


https://homepages.inf.ed.ac.uk/rbf/CVonline/LOCAL_COPIES/TUDELFT/FIP2_3.pdf
• Image Processing Techniques: A Review:
https://www.researchgate.net/publication/345364858_Image_Processing_Techniques_A_Review
Q&A
Thank You!

You might also like