Lect 3

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 24

Basic Concepts in Digital Image Processing

Announcement

Homework #1 was posted in Blackboard and on class website.


Due time: Thursday, September 1, before class starts.
Today’s Agenda

• Interpolation
• Basic Relationships between Pixels
• Mathematical tools for image processing
Image Resampling & Interpolation

Need to resample the image when


• Rescaling
• Geometrical transformation
• The output image coordinates
are not discrete
Interpolation methods:
• Nearest neighbor
• Fast and simple
• Loss of sharpness
• Artifacts (checkerboard)
• Bilinear
• Bicubic
• Images are sharpest
• Fine details are preserved
• Slow
Image Resampling & Interpolation
NN Bilinear Bicubic

Original
72dpi
1250dpi

150dpi
Image Interpolation – Nearest Neighbor

http://www.brockmann-consult.de/beam/doc/help/general/ResamplingMethods.html

Assign each pixel in the output image with the nearest neighbor in the input image.
Image Interpolation – Bilinear

http://www.brockmann-consult.de/beam/doc/help/general/ResamplingMethods.html
Image Resampling & Interpolation

Forward mapping

Input Output
Issues on Image Resampling & Interpolation

Missing points in forward mapping

A hole !

Input Output

Solution: perform a backward mapping

Input Output
Review of Adjacency

Adjacency is the relationship between two pixels p and q


V is a set of intensity values used to define adjacency
• Binary image: V={1} or V={0}
• Gray level image:
Intensity constraints
Three types of adjacency:
4-adjacency 8-adjacency m-adjacency

X
p
and
Connectivity

• Path from p to q: a sequence of distinct and adjacent pixels with


coordinates

Starting point p ending point q


adjacent

• Closed path: if the starting point is the same as the ending point
• p and q are connected: if there is a path from p to q in S
• Connected component: all the pixels in S connected to p
• Connected set: S has only one connected component
Are they connected sets?

4-adjacency: No 8-adjacency: Yes m-adjacency: Yes


Regions

• R is a region if R is a connected set


• Ri and Rj are adjacent if is a connected set
Boundaries

• Inner boundary (boundary) -- the set of pixels each of which


has at least one background neighbor
• Outer boundary – the boundary pixels in the background
Distance Measures

For pixels p, q, and z, with coordinates (x,y), (s,t) and (v,w), D


is a distance function or metric if

(a) D( p, q)  0 D( p, q) = 0 iff p = q
(b) D( p, q) = D(q, p), and
(c ) D ( p , z )  D ( p , q ) + D ( q , z )
Distance Measures

Euclidean distance De ( p , q ) = ( x − s ) 2
+ ( y − t ) 2

City-block (D4) distance D4 ( p, q) =| x − s | + | y − t |


Chessboard (D8) distance (Chebyshev distance)
D8 ( p, q) = max(| x − s |, | y − t |)
Distance: Sample Problem

D4 distance p

6
D8 distance

5 q

Euclidean distance
𝟏 + 𝟓𝟐

Distance vs length of a path?


Mathematic Tools

Array/Matrix operations
Linear/nonlinear operations
Linearity:
Arithmetic Operations – single pixel operations
• Image averaging, image subtraction, image multiplication
Set and logic operations
Spatial operations
• Single pixel operations and neighborhood operations
Image transformation
Probabilistic methods
Mathematic Tools

Array versus Matrix operations


Array Multiplications
𝒂𝟏𝟏 𝒂𝟏𝟐 𝒃𝟏𝟏 𝒃𝟏𝟐 𝒂𝟏𝟏 𝒃𝟏𝟏 𝒂𝟏𝟐 𝒃𝟏𝟐
𝒂𝟐𝟏 𝒂𝟐𝟐 ∙ 𝒃𝟐𝟏 𝒃𝟐𝟐
=
𝒂𝟐𝟏 𝒃𝟐𝟏 𝒂𝟐𝟐 𝒃𝟐𝟐
Matrix Multiplications

𝒂𝟏𝟏 𝒂𝟏𝟐 𝒃𝟏𝟏 𝒃𝟏𝟐 𝒂𝟏𝟏 𝒃𝟏𝟏 + 𝒂𝟏𝟐 𝒃𝟐𝟏 𝒂𝟏𝟏 𝒃𝟏𝟐 + 𝒂𝟏𝟐 𝒃𝟐𝟐
𝒂𝟐𝟏 𝒂𝟐𝟐 × 𝒃𝟐𝟏 𝒃𝟐𝟐
=
𝒂𝟐𝟏 𝒃𝟏𝟏 + 𝒂𝟐𝟐 𝒃𝟐𝟏 𝒂𝟐𝟏 𝒃𝟏𝟐 + 𝒂𝟐𝟐 𝒃𝟐𝟐
Image Averaging – Noise Reduction

Assumption: the noise is uncorrelated in image and has zero mean


Image Subtraction – Enhance Difference
Image Subtraction

The images used in averaging & subtraction must be


registered!
Image Multiplication (Division)
g(x,y)=f(x,y)h(x,y)

g(x,y)=f(x,y)/h(x,y)
Notes on Arithmetic Operations

The images used in averaging & subtraction must be


registered!

Output images should be normalized to the range of [0,255]

f m = f − min( f )
f s = K [ f m / max( f m )]
Set Operations Based on Intensities

Complement – negative image


𝑨𝒄 = 𝒙, 𝒚, 𝑲 − 𝒛 𝒙, 𝒚, 𝒛 ∈ 𝑨
Thresholding
𝑨 ∪ 𝑩 = 𝒙, 𝒚, max 𝒛𝒂 , 𝒛𝒃 𝒙, 𝒚, 𝒛𝒂 ∈ 𝑨, 𝒙, 𝒚, 𝒛𝒃 ∈ 𝑩

You might also like