KEMBAR78
Lec 01 (BIP) Introduction and Basics | PDF
0% found this document useful (0 votes)
51 views72 pages

Lec 01 (BIP) Introduction and Basics

Uploaded by

mna
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)
51 views72 pages

Lec 01 (BIP) Introduction and Basics

Uploaded by

mna
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/ 72

Department of Biomedical

Engineering
UET Lahore, New Campus

Medical Image Processing


BME-420

Engr. Abdullah
Goals

• Understand the fundamentals of digital image


processing

• Learn how to implement image processing techniques

• Research advanced image processing algorithms by


studying special topics

• Finally, you will be skillful of image processing


techniques and able to develop image processing
algorithms for your research.
Textbook
Prerequisites:
- Digital Signal Processing
- Computer Programming (MATLAB)

Textbook:
- Digital Image Processing,
by R. Gonzalez and R. Woods
Assessment Plan
CHART TITLE
Final Exam
• All course included
• 75% class attendance is
mandatory to appear in exam
Assignments

Assignments
Final • MATLAB implementation
Quizzes • One week deadline
• No assignment will be accepted
after deadline
• No marks for copy-paste

Midterm
Contents
This lecture will cover:
– What is a digital image?
– What is digital image processing?
– State of the art examples of digital image processing
– Medical Image Processing
Introduction

“One picture is worth more than ten


thousand words”
Anonymous
What is Image processing?

• Image processing is a method to perform some operations on


an image, in order to get an enhanced image or to extract
some useful information from it.

• It is a type of signal processing in which input is an image and


output may be image or characteristics/features associated
with that image.
Why we need
Digital Image
Processing?
Examples: Artistic Effects

• Artistic effects are used to


make images more visually
appealing, to add special
effects and to make
composite images
Examples: Image Enhancement

• One of the most common uses of DIP techniques: improve quality,


remove noise etc.
Examples: PCB Inspection
• Printed Circuit Board (PCB) inspection
– Machine inspection is used to determine that all components are
present and that all solder joints are acceptable
– Both conventional imaging and x-ray imaging are used
Examples: Industrial Inspection

• Human operators are


expensive, slow and
unreliable.

• Make machines do the


job instead.

• Industrial vision systems


are used in all kinds of
industries.

• Can we trust them?


Examples: Law Enforcement

• Number plate recognition for speed


cameras/ automated toll systems

• Fingerprint recognition

• Enhancement of CCTV images


Examples: Defense

➢ Target Recognition
Examples: Hurdle detection

• Hurdle detection is one of the common task that has been done
through image processing, by identifying different type of objects in
the image and then calculating the distance between robot and
hurdles.
Examples: GIS

Geographic Information Systems


– Digital image processing techniques are used extensively to
manipulate satellite imagery
– Terrain classification
– Meteorology
Examples: HCI

Try to make human computer


interfaces more natural
– Gesture recognition
– Human Activity Recognition
Examples: Signature Verification
Examples: Traffic Monitoring
Examples: Face Detection

➢ Face Detection
➢ Face Recognition
➢ Facial Expression Recognition
➢ Face Tracking
Examples: Medical Imaging

➢ Medical Image Enhancement


Examples: Cancer Detection

skin cancer breast cancer


Navigation for blind
Artificial Vision for Blind
Medical Images

Sources of Medical Images


• X-Ray • Single photon emission
• MRI tomography (SPECT)
• CT • Positron Emission tomography
• Ultrasound (PET)
• Radiography • Gamma ray imaging
• Photo Acoustic Imaging
What is a Digital Image?

• Digital Image: function of 2 variables, 𝑓(𝑥, 𝑦), where 𝑥


and 𝑦 are spatial coordinates,

• Pixels: Elements of the digital image, each has intensity.

Intensity of pixel: The amplitude of gray level (in


grayscale images)

Note:
images can be: binary, grayscale, color.
The image consists of
finite number of
pixels ( 𝑓(𝑥, 𝑦) )

Every pixel is an
intersection between
a row and a column.

every pixel has an


intensity

pixel
Ex:
f(4,3)= 123
Refers to a pixel existing on
the intersection between row
4 with column 3, and its
intensity is 123.
Digital Images (Basic Terms)
Pixel size
(resolution)

Pixel

Intensity: 𝑁𝑦 (height)

• Gray levels
• Colors

Pixel depth
8~32 bits

𝑁𝑥 (width)

Image size: 𝑁𝑥 × 𝑁𝑦
e.g. VGA: 640 × 480, SVGA: 1024 × 768, XVGA: 1280 × 1024
Lecture-2
What is pixel?
• Pixel is the smallest element of an image. Each pixel
correspond to any one value.
• The value of a pixel at any point correspond to the light
intensity at that particular location. Pixel
Questions

1 What is megapixel of your


camera?

2 What does that mean?

3 How much is enough?


Resolution: How much is enough

The picture on the right is fine for counting


the number of cars, but not for reading the
number plate
What is Digital Image Processing?
Processing digital images by means of a digital computer.

This includes:
• Analyze the image
• Manipulate it
• Store it
• Display it
What is Digital Image Processing?

Digital image processing focuses on two major tasks

– Improvement of pictorial information for human interpretation


– Processing of image data for storage, transmission and
representation for autonomous machine perception
History

• World’s First Digital Camera


• Developed by Kodak in 1976
• Specs:
• 0.01 Megapixel
• 23 seconds to record a single
image
• 4Kg weight

We’re sure come a long way since then


History

Mavica (the magnetic video camera)


The first game changer in digital
camera world.
• Launched by Sony in 1981
• The images were recorded on
floppy disks and images can be
viewed later on any monitor screen.
Specs:
• 0.3 Megapixel

We’re sure come a long way since then


History

First true digital camera


• Fuji DS-1P camera
• Developed by Fuji films in 1988
jointly with Toshiba
• The world’s first camera to save data
to a semiconductor memory card.
• 2 megabytes of SRAM
• The semiconductor memory card
could hold 5 to 10 photographs’
worth of data
Sampling and Quantization

• The basic idea behind converting an analog signal to its


digital signal is to convert both of its axis (x, y) into a
digital format.

• Sampling: Digitizing Coordinate values


• Quantization: Digitizing Amplitude values
Sampling and Quantization

Sampling : related to coordinates values


(Nyquist frequency)
Quantization : related to intensity values

0 0 0 75 75 75 128 128 128 128

0 75 75 75 128 128 128 255 255 255

75 75 75 200 200 200 255 255 255 200

128 128 128 200 200 255 255 200 200 200

128 128 128 255 255 200 200 200 75 75

175 175 175 225 225 225 75 75 75 100

175 175 100 100 100 225 225 75 75 100

75 75 75 35 35 35 0 0 0 35

35 35 35 0 0 0 35 35 35 75

75 75 75 100 100 100 200 200 200 200


Sampling and Quantization

a b

(a) Continuous image


projected onto a
sensor array.
(b) Result of image
sampling and
quantization.
Aliasing and moiré patterns

• Aliasing occurs when a signal is sampled at a less than


twice the highest frequency present in the signal.

moiré pattern

Properly sampled image Spatial aliasing in the


form of a moiré pattern
Aliasing and moiré patterns
Binary Images
Remember: images can be: binary, grayscale, color.

A BINARY IMAGE is a digital image that has only two possible


values for each pixel. Typically, the two colors used for a binary
image are black and white, though any two colors can be used.
Grayscale Images

A GRAYSCALE image is one in which the only colors are


shades of gray (usually 0 – 255)
Gray level?

The value of the pixel at any point denotes the


intensity of image at that location, and that is
also known as gray level.
Color Images

• A COLOR IMAGE contains pixels each of which holds


three intensity values corresponding to the red, green,
and blue or (RGB)
Bits Per Pixel and shades

• How many numbers can be represented by one bit?

Shades:
• The famous gray scale image is of 8 bpp, means it has
28 =256 different colors in it or 256 shades (0 - 255).

• so, the gray intensities (𝐿) that the pixel can hold, is
calculated according to number bits per pixel

𝑆ℎ𝑎𝑑𝑒𝑠 = 𝑁𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑐𝑜𝑙𝑜𝑟𝑠 = 𝐿 = 2𝑛


Black color: Remember, 0 pixel value always
denotes black color. But there is no fixed value
that denotes white color.

White color: The value that denotes white color


can be calculated as:
𝑊ℎ𝑖𝑡𝑒 𝑐𝑜𝑙𝑜𝑟 = 2𝑛 − 1

White in Binary? White in 8 bit?


21 − 1 = 1 28 − 1 = 255
Varying # of bits per pixel
Which one is better?

64 Shades of gray 8 Shades of gray

Number of bits??
Image Size
The size of an image depends upon three things.
• Number of rows
• Number of columns
• Number of bits per pixel
𝑆𝑖𝑧𝑒 𝑜𝑓 𝐼𝑚𝑎𝑔𝑒 = 𝑟𝑜𝑤𝑠 ∗ 𝑐𝑜𝑙 ∗ 𝑛

Example:
Grayscale image, having 256 different
shades of gray

No of Rows= 1024
No of Columns= 1024

What is the image size in MB?


Image Spatial Resolution

1024 512 256

128 64 32
Spatial Resolution and pixel size
Spatial Resolution

Sub sampling

Sub-Sampling is performed by deleting rows and columns from the original image.
Spatial Resolution

Re sampling
(pixel replication)
A special case of nearest
neighbor zooming.

Resampling is performed by row and column duplication


Zooming & Shrinking Images
Zooming (over sampling) images

Zooming simply means enlarging a picture in a sense that the


details in the image became more visible and clear.

Zooming requires 2 steps:


– The creation of new pixel locations.
– The assignment of gray levels to these new locations.

There are different techniques for zooming e.g.


– Nearest neighbor interpolation
– Bilinear interpolation
– K-times zooming
Nearest Neighbor Interpolation
Example:
Suppose a 2 × 2 pixels image will be enlarged 2 times by the nearest neighbor method:

1. Lay an imaginary 4 × 4 grid over the original image..


2. For any point in the overlay, look for the closest pixel in the original image, and assign its
gray level to the new pixel in the grid. (copy)
3. When all the new pixels are assigned values, expand the overlay grid to the original
specified size to obtain the zoomed image.

+ive : Nearest neighbor is fast


-ive: it produces a checkerboard effect
like this!
Relationship between pixels
Neighbors of a Pixel

A pixel 𝑝 at coordinates (𝑥, 𝑦) has 4 horizontal and vertical


neighbors whose coordinates are
(𝑥 + 1, 𝑦), (𝑥 − 1, 𝑦), (𝑥, 𝑦 + 1), (𝑥, 𝑦 − 1)

A1 A2 A3

A4 A5 A6

A7 A8 A9

This set of pixels are called the 4-neighbors of 𝑝, and is


denoted by 𝑁4 (𝑝).
→ Each pixel is a unit distance from (𝑥, 𝑦)
Neighbors of a Pixel

The four diagonal neighbors of 𝑝(𝑥, 𝑦) are given


by
𝑥 + 1, 𝑦 + 1 , 𝑥 + 1, 𝑦 − 1 , (𝑥 − 1, 𝑦 + 1),(𝑥 − 1, 𝑦 − 1)

A1 A2 A3

A4 A5 A6

A7 A8 A9

• This set is denoted by 𝑁𝐷 (𝑝).


Neighbors of a Pixel

• The points 𝑁4 (𝑝) and 𝑁𝐷 (𝑝) are together known as


8-neighbors of the point 𝑝, denoted by 𝑁8 (𝑝)

A1 A2 A3

A4 A5 A6

A7 A8 A9

Note: Some of the points in the 𝑁4 , 𝑁𝐷 and 𝑁8 may


fall outside image when 𝑝 lies on the border of image.
Neighbors of a Pixel

• 4-neighbors of a pixel 𝑝 are


its vertical and horizontal
neighbors denoted by 𝑁4 (𝑝)

• 8-neighbors of a pixel 𝑝 are


its vertical, horizontal and 4
diagonal neighbors denoted
by 𝑁8 (𝑝)
Adjacency

Adjacency: Two pixels are adjacent if they are neighbors


and their intensity level satisfy some specific criteria of
similarity.

• In binary images, two pixels are adjacent if they are


neighbors and have same intensity values (either 0 or 1)

• In grayscale, two pixels are adjacent if they are


neighbors and have intensity values within some set of
values “V”. e.g.
𝑉 = {180,181,182, … 200}
Adjacency

Let V be set of gray levels values used to define adjacency.


(V is a subset of L)

3 types of adjacency
• 4-adjacency: Two pixels p and q with values from V are 4-adjacent
if q is in the set 𝑁4 (𝑝).
• 8-adjacency: Two pixels p and q with values from V are 8-adjacent
if q is in the set 𝑁8 (𝑝).
• m-adjacency: Two pixels p and q with values from V are m-adjacent
if
• q is in 𝑁4 𝑝 , or
• q is in 𝑁𝐷 (𝑝) and the set [𝑁4 𝑝 ∩ 𝑁4 (𝑞) ] has no pixels whose values
are from V. (no intersection)
Adjacency

• 4-adjacency: Two pixels p and q with values from set


“V” are 4-adjacent if q is in the set 𝑁4 (𝑝).

Example: binary image


• V={1}

1 1 0
1 1 0
1 0 1
Adjacency

• Mixed adjacency (m-adjacency) is a modification of


8-adjacency. It is introduced to eliminate the
ambiguities that often arise when 8-adjacency is
used.
For example:
Adjacency

In this example, we can note that to connect between


two pixels (finding a path between two pixels):
• In 8-adjacency way, you can find multiple paths
between two pixels
• While, in m-adjacency, you can find only one path
between two pixels

• So, m-adjacency has eliminated the multiple path


connection that has been generated by the 8-
adjacency.
Connectivity

• Two pixels p and q are said to be connected if there exists a


path between.
• A set of pixels in an image which are all connected to each other
is called a connected component.

If the connectivity were


based on 8-neighbors???

Two connected components


based on 4-connectivity
Distance Measures
• The Euclidean distance between two 2-D points 𝐼(𝑥1 , 𝑦1 ), 𝐽(𝑥2 , 𝑦2 ) is
defined by
• 𝐷𝑒 𝑝, 𝑞 = 𝑥1 − 𝑥2 2 + 𝑦1 − 𝑦2 2
• City Block Distance (𝐷4 𝑑𝑖𝑠𝑡𝑎𝑛𝑐𝑒)
• 𝐷4 𝑝, 𝑞 = 𝑥1 − 𝑥2 + |𝑦1 − 𝑦2 |
• Chessboard distance (𝐷8 𝑑𝑖𝑠𝑡𝑎𝑛𝑐𝑒)
• 𝐷8 𝑝, 𝑞 = max( 𝑥1 − 𝑥2 , 𝑦1 − 𝑦2 )

𝑞(𝑥2 , 𝑦2 ) 𝑞(𝑥2 , 𝑦2 )
𝑞(𝑥2 , 𝑦2 )

D8(b)
D4
𝑝(𝑥1 , 𝑦1 ) 𝑝(𝑥1 , 𝑦1 ) 𝑝(𝑥1 , 𝑦1 ) D8(a)
D8 = max(D8(a) , D8(b))
Distance Measures

Given pixels p, q and z with coordinates


(𝑥, 𝑦), (𝑠, 𝑡), (𝑢, 𝑣) respectively,

the distance function D has following properties:


a) D(p, q) ≥ 0 [D p, q = 0 𝑖𝑓𝑓 𝑝 = 𝑞 ]
b) D p, q = 𝐷(𝑞, 𝑝)
c) D p, 𝑧 ≤ D p, q + D(q, z)
Example

Compute the distance between the two pixels


using the three distances :
𝑞: (1, 1)
𝑃: (2, 2) 1 2 3
1 q
2 p
3

Euclidian distance : (1 − 2)2 + (1 − 2)2 = 2


D4(City Block distance): |1 − 2| + |1 − 2| = 2
D8(chessboard distance ) : max(|1 − 2|, |1 − 2|) = 1

You might also like