Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 66

CII4F3 / Digital Image Processing

Basic Operations in Digital Image Processing


Dr. Eng. Ir. Wikky Fawwaz Al Maki, S.T., M.Eng.
Intelligent Computing and Multimedia (ICM)

1 11/02/2020 CIG4E3 / Pengolahan Citra Digital


Introduction

Point Operations
Homogenous Point Operations
Non-Homogenous Point Operations
Geomaetric Operations
Other Basic Operation in Digital Image Processing
Basic Gray Level Transformation
Logical Operations
Arithmetic Operations

2 11/02/2020 CIG4E3 / Pengolahan Citra Digital


POINT OPERATIONS

3 11/02/2020 CIG4E3 / Pengolahan Citra Digital


Point operations
 
Point operations changes a pixel’s intensity value according to some function
(don’t care about pixel’s neighbor)

Also called a homogeneous operation

New pixel intensity depends on


Pixel’s previous intensity
Mapping function

New pixel intensity does not depend on


Pixel’s location
Intensities of neighboring pixels

4 11/02/2020 CIG4E3 / Pengolahan Citra Digital


Point operations
 
Procedures that operate directly
on the pixels composing an
image.

where
• is the input image
• is the processed image
• is an operator on

5 11/02/2020 CIG4E3 / Pengolahan Citra Digital


Point Operation Pseudocode

 Input: Image with pixel intensities defined as a matrix

Output: Image with pixel intensities

for m = 1 ... M
for n = 1 ... N
set F(m, n) = f (F(m, n))

6 11/02/2020 CIG4E3 / Pengolahan Citra Digital


HOMOGENEOUS POINT
OPERATIONS

7 11/02/2020 CIG4E3 / Pengolahan Citra Digital


Homogeneous Point Operations
Addition
  (Changes brightness)

Multiplication (Stretches/shrinks image contrast range)

Real‐valued functions
exp(x), (1/x), xp, log(x), etc

Quantizing pixel values

Global thresholding

Gamma correction

8 11/02/2020 CIG4E3 / Pengolahan Citra Digital


Thresholding : Introduction
 Input values below threshold ath set to a0

Input values below threshold ath set to a1

Converts grayscale image to binary image (binarization) if


a0 = 1
a1 = 1

9 11/02/2020 CIG4E3 / Pengolahan Citra Digital


Thresholding function
Producing binary image or
two-level image

The mapping process which


can produce binary images is
called the thresholding
function

Thresholding level : k

10 11/02/2020 CIG4E3 / Pengolahan Citra Digital


Thresholding : Example

11 11/02/2020 CIG4E3 / Pengolahan Citra Digital


Gamma Correction : Introduction
Different camera sensors
Have different response to light
intensity
Produce different electrical
signals for same input

How do we ensure there is


consistency in:
Images recorded by different
cameras for given light input
Light emitted by different display
devices for same image

12 11/02/2020 CIG4E3 / Pengolahan Citra Digital


Gamma Correction : Introduction

What is the relation between


Camera : Light on sensor vs intensity of corresponding pixel
Display : Pixel intensity vs light from that pixel

Relation between pixel value and corresponding physical quantity is


usually complex, non linear

An approximation?

13 11/02/2020 CIG4E3 / Pengolahan Citra Digital


What is Gamma?
Originates from analog photography

Exposure function : relationship


between:
Logarithmic light intensity vs
resulting film density

Gamma : slope of linear range of the


curve

The same in TV broadcasting

14 11/02/2020 CIG4E3 / Pengolahan Citra Digital


What is Gamma?
 
Gamma function : A good approximation of
exposure curve

Inverse of Gamma function is another


gamma function with

Gamma of CRT and LCD monitors:


1.8 – 2.8 (typicaly 2.4)

15 11/02/2020 CIG4E3 / Pengolahan Citra Digital


Gamma Correction
Obtain a measurement b proportional to original light intensity B by applying
inverse gamma function

Gamma correction is important to achieve a device independent representation

16 11/02/2020 CIG4E3 / Pengolahan Citra Digital


Gamma Correction

17 11/02/2020 CIG4E3 / Pengolahan Citra Digital


Effect of Reducing Gamma
 
When the is reduced too much, the image begins to reduce contrast to the point
where the image may start to have slight “washed-out” look, especially in the
background  (a) image has a washed-out appearance,
it needs a compression of lighter
gray levels needs > 1

(b) result after power-law


transformation with = 3.0 (suitable)

(c) transformation with = 4.0 (suitable)

(d) transformation with = 5.0 (high


contrast, the image has areas that
are too dark, some detail is lost)

18 11/02/2020 CIG4E3 / Pengolahan Citra Digital


NON-HOMOGENEOUS POINT
OPERATIONS

19 11/02/2020 CIG4E3 / Pengolahan Citra Digital


Non‐Homogeneous Point Operation
 New pixel value depends on:

Old value + pixel’s location

20 11/02/2020 CIG4E3 / Pengolahan Citra Digital


Clamping

 Deals with pixel values outside displayable range

Function below will clamp (force) all values to fall within range [a,b]

21 11/02/2020 CIG4E3 / Pengolahan Citra Digital


Example: Modify Intensity and Clamp

Point operation: increase image contrast by 50% then clamp values


above 255

Increase contrast by 50%

22 11/02/2020 CIG4E3 / Pengolahan Citra Digital


Clamping : Intensity Windowing

A clamp operation, then linearly stretching image intensities to fill


possible range

To window an image {a, b} with max intensity M

23 11/02/2020 CIG4E3 / Pengolahan Citra Digital


Clamping : Intensity Windowing # 2

24 11/02/2020 CIG4E3 / Pengolahan Citra Digital


GEOMETRIC OPERATIONS

25 11/02/2020 CIG4E3 / Pengolahan Citra Digital


Geometric Operations : Introduction
Filters, point operations change intensity

Pixel position (and geometry) unchanged

Geometric operations: change image


geometry

Examples: translating, rotating, scaling an


image

26 11/02/2020 CIG4E3 / Pengolahan Citra Digital


Geometric Operations : Introduction
 Example applications of geometric operations:
Zooming images, windows to arbitrary size
Computer graphics: deform textures and map to arbitrary surfaces
Definition: Geometric operation transforms image I to new image I’ by modifying
coordinates of image pixels

Intensity value originally at (x,y) moved to new position (x’,y’)

27 11/02/2020 CIG4E3 / Pengolahan Citra Digital


Geometric Operations

Since image coordinates can only be discrete values, some


transformations may yield (x’,y’) that’s not discrete

Solution: interpolate nearby values

28 11/02/2020 CIG4E3 / Pengolahan Citra Digital


Simple Mapping
 Translation: (shift) by a vector (dx, dy)

Scaling : (contracting or stretching)


along x or y axis by a factor sx or sy

29 11/02/2020 CIG4E3 / Pengolahan Citra Digital


Simple Mapping #2
 
Shearing: along x axis dan y axis by
factor bx dan by

Rotation: rotating the image by an


angle

30 11/02/2020 CIG4E3 / Pengolahan Citra Digital


Image Flipping and Rotation by 90 degrees
We can achieve 90, 180 degree rotation easily

Basic ide : Look up a transformed pixel address instead of the current one

To flip an image upside down:


At pixel location x, look up the color at location x(1-y)

For horizontal flip :


At pixel location xy, look up (1-x)y

Rotating an image 90 degrees counterclockwise


At pixel location xy, look up (y, 1-x)

31 11/02/2020 CIG4E3 / Pengolahan Citra Digital


Image Flipping and Rotation by 90 degrees

 
Image warping : we can use a function
to select which pixel somewhere else in
the image to look up

For example : apply function on both


coordinates (x,y)

32 11/02/2020 CIG4E3 / Pengolahan Citra Digital


Non Linear Image Warping

33 11/02/2020 CIG4E3 / Pengolahan Citra Digital


Image Warping

34 11/02/2020 CIG4E3 / Pengolahan Citra Digital


Homogenous Coordinates

Notation useful for converting scaling, translation, rotating into


point-matrix multiplication

To convert ordinary coordinates into homogenous coordinates

35 11/02/2020 CIG4E3 / Pengolahan Citra Digital


Affine (3-point) mapping
Can use homogenous coordinates to rewrite translation, rotation, scaling, etc as
vector-matrix multiplication

Affine mapping : can the derive values of matrix that achieve desired
transformation (or combination of transformations)

Inverse of transform matrix is inverse mapping

36 11/02/2020 CIG4E3 / Pengolahan Citra Digital


OTHER OPERATIONS IN DIGITAL
IMAGE PROCESSING

37 11/02/2020 CIG4E3 / Pengolahan Citra Digital


Contrast Stretching
Transforming each pixel to obtain an
image with higher contrast

The gray level below the value k is


set to be darker whereas the gray
level above the value k is set to be
brighter

Method: contrast stretching

38 11/02/2020 CIG4E3 / Pengolahan Citra Digital


Contrast Stretching
(a) increase the dynamic range of the gray
levels in the image
(b) a low-contrast image : result from poor
illumination, lack of dynamic range in
the imaging sensor, or even wrong
setting of a lens aperture of image
acquisition
(c) result of contrast stretching: (r1 ,s1 ) =
(rmin,0) and (r2 ,s2 ) = (rmax,L-1)
(d) result of thresholding (r1=r2=m, binary
image). m, mean grey level in the
image.

39 11/02/2020 CIG4E3 / Pengolahan Citra Digital


Contrast Stretching
The locations of (r1 ,s1 ) and (r2 ,s2 ) control the shape of the
transformation function.

If r1= s1 and r2= s2 the transformation is a linear function and


produces no changes.

If r1=r2 , s1=0 and s2=L-1, the transformation becomes a thresholding


function that creates a binary image.

Intermediate values of (r1 ,s1 ) and (r2 ,s2 ) produce various degrees
of spread in the gray levels of the output image, thus affecting its
contrast.

40 11/02/2020 CIG4E3 / Pengolahan Citra Digital


Contrast Stretching
See the difference?

41 11/02/2020 CIG4E3 / Pengolahan Citra Digital


Contrast Stretching
See the difference?

42 11/02/2020 CIG4E3 / Pengolahan Citra Digital


Inverting images

2 steps
1. Multiple intensity by ‐1
2. Add constant (e.g. ) to put
result in range [0, ]

original Inverted image

43 11/02/2020 CIG4E3 / Pengolahan Citra Digital


Image Negatives (Inverted Images)
Image negatives useful for enhancing white or grey detail
embedded in dark regions of an image
Note how much clearer the tissue is in the negative image of the
mammogram below

44 11/02/2020 CIG4E3 / Pengolahan Citra Digital


BASIC GRAY LEVEL
TRANSFORMATION

45 11/02/2020 CIG4E3 / Pengolahan Citra Digital


Basic of transformation
 
Usually, image transformation is applied to neighboring pixels
Case : averaging

Spatial filtering :

Spatial filter = spatial mask, kernel, mask or window

The kernel of spatial filter has a specific size (3x3, 5x5, etc)

46 11/02/2020 CIG4E3 / Pengolahan Citra Digital


The smallest probability of neighborhood has the size 1x1. The output image (g)
only depends on the pixel values of the input image (f) at a single point. If T is a
intensity (gray level or mapping) transformation function, then the transformation
of an input image can be mathematically expressed as:

s=T(r) where s is a pixel at g and r is a pixel at f


47 11/02/2020 CIG4E3 / Pengolahan Citra Digital
Introduction
3 most common gray level transformation:

Linear
Negative / identity

Logarithmic
Log / inverse log

Power law
nth power

48 11/02/2020 CIG4E3 / Pengolahan Citra Digital


Logarithmic Transformation
Maps narrow range of input pixels  wider range of output pixels

Inverse log transformation does opposite transformation

The general form of the log transformation is

Log transformation of Fourier transform shows more detail

49 11/02/2020 CIG4E3 / Pengolahan Citra Digital


Power Law Transformation
 Power law transformation have the form

Map narrow range of the dark input values into


wider range of output values or vice versa

Varying gives a whole family of curves

50 11/02/2020 CIG4E3 / Pengolahan Citra Digital


Power Law Transformation

Magnetic Resonance (MR) image of


fractured human spine

Different power values highlight


different details

51 11/02/2020 CIG4E3 / Pengolahan Citra Digital


LOGIC OPERATIONS

52 11/02/2020 CIG4E3 / Pengolahan Citra Digital


Logic Operations
Logic operation performs on gray-level images, the pixel values are processed
as binary numbers
light represents a binary 1, and dark represents a binary 0
NOT operation = negative transformation

53 11/02/2020 CIG4E3 / Pengolahan Citra Digital


Boolean operator
Basic Boolean operator  AND, OR, NOT
Other Boolean operators: NAND, NOR, XOR

54 11/02/2020 CIG4E3 / Pengolahan Citra Digital


Example of AND Operation

55 11/02/2020 CIG4E3 / Pengolahan Citra Digital


Example of OR Operation

56 11/02/2020 CIG4E3 / Pengolahan Citra Digital


ARITHMETIC OPERATION

57 11/02/2020 CIG4E3 / Pengolahan Citra Digital


Introduction
X opr Y = Z
– X: image
– Y: image or scalar quantity
– Z: image

Computation Level:
– Pointwise: every element X and Y
– Matrix based: involves neighbor pixels

58 11/02/2020 CIG4E3 / Pengolahan Citra Digital


Arithmetic Operation
Operation

Arithmetic operation in digital


image processing:
– Addition
– Substraction
– Multiplication X Y Z

– Division Operation

In RGB image case, the operations is Y

employed to each plane / channel


X Z

59 11/02/2020 CIG4E3 / Pengolahan Citra Digital


Image Addition
If Y is an image:
– Z : sum of the brightness level of each pixels at X and Y

If Y is a scalar quantity:
– Z : a brighter image of X
– increased brightness level is similar to those of Y

60 11/02/2020 CIG4E3 / Pengolahan Citra Digital


Image Subtraction

 Enhancement of the differences between images

61 11/02/2020 CIG4E3 / Pengolahan Citra Digital


Image Subtraction

 Enhancement of the differences between images

62 11/02/2020 CIG4E3 / Pengolahan Citra Digital


WHAT POINT OPERATIONS CAN’T
DO?

63 11/02/2020 CIG4E3 / Pengolahan Citra Digital


Sharpening

64 11/02/2020 CIG4E3 / Pengolahan Citra Digital


Artistic pattern

Cool artistic pattern by combining pixels

65 11/02/2020 CIG4E3 / Pengolahan Citra Digital


THANK YOU
66 11/02/2020 CIG4E3 / Pengolahan Citra Digital

You might also like