47
Digital Image Processing IMAGE ENHANCEMENT Hamid R. Rabiee Fall 2015 In the Name of Allah

Digital Image Processing - SHARIF UNIVERSITY OF ...ce.sharif.edu/.../Lectures/Lecture8_ImageEnhancement.pdfZero-memory Filters for Enhancement POINT OPERATIONS: Zero memory operations

Embed Size (px)

Citation preview

Page 1: Digital Image Processing - SHARIF UNIVERSITY OF ...ce.sharif.edu/.../Lectures/Lecture8_ImageEnhancement.pdfZero-memory Filters for Enhancement POINT OPERATIONS: Zero memory operations

Digital Image Processing

IMAGE ENHANCEMENT

Hamid R. Rabiee

Fall 2015

In the Name of Allah

Page 2: Digital Image Processing - SHARIF UNIVERSITY OF ...ce.sharif.edu/.../Lectures/Lecture8_ImageEnhancement.pdfZero-memory Filters for Enhancement POINT OPERATIONS: Zero memory operations

Image Enhancement

DEFINITION: accentuation, or sharpening, of image features such as edges, boundaries, or contrast to make a graphic display more useful for display and analysis

NOT INCREASE the inherent information content in the data

INCREASE the dynamic range of the chosen features so that they can be detected easily

AN IMPORTANT PROBLEM: in image enhancement is quantifying the criterion for enhancement

2

Page 3: Digital Image Processing - SHARIF UNIVERSITY OF ...ce.sharif.edu/.../Lectures/Lecture8_ImageEnhancement.pdfZero-memory Filters for Enhancement POINT OPERATIONS: Zero memory operations

Techniques 3

Page 4: Digital Image Processing - SHARIF UNIVERSITY OF ...ce.sharif.edu/.../Lectures/Lecture8_ImageEnhancement.pdfZero-memory Filters for Enhancement POINT OPERATIONS: Zero memory operations

Zero-memory Filters for Enhancement

POINT OPERATIONS: Zero memory operations where a given gray level 𝒖 ∈ [𝟎, 𝑳] is mapped into a gray level 𝒗 ∈ [𝟎, 𝑳] according to a transformation

Input and output gray levels are distributed between [0, L]. Typically, L = 255

1- CONTRAST STRETCHING

The slopes a, b ,g determine the relative contrast stretch

4

Page 5: Digital Image Processing - SHARIF UNIVERSITY OF ...ce.sharif.edu/.../Lectures/Lecture8_ImageEnhancement.pdfZero-memory Filters for Enhancement POINT OPERATIONS: Zero memory operations

Contrast stretchingExamples

5

Page 6: Digital Image Processing - SHARIF UNIVERSITY OF ...ce.sharif.edu/.../Lectures/Lecture8_ImageEnhancement.pdfZero-memory Filters for Enhancement POINT OPERATIONS: Zero memory operations

Contrast stretching Examples 6

Page 7: Digital Image Processing - SHARIF UNIVERSITY OF ...ce.sharif.edu/.../Lectures/Lecture8_ImageEnhancement.pdfZero-memory Filters for Enhancement POINT OPERATIONS: Zero memory operations

Zero-memory Filters for Enhancement

2- NOISE CLIPPING AND THRESHOLDING

A special case of contrast stretching where a = g = 0 is called CLIPPING.

The slopes a, b ,g determine the relative contrast stretch

Useful for binary or other images that have bimodal distribution of gray levels. The a and b define the valley between the peaks of the histogram. For a = b = t, this is called THRESHOLDING (The output becomes binary).

7

Thresholding CLIPPING

Page 8: Digital Image Processing - SHARIF UNIVERSITY OF ...ce.sharif.edu/.../Lectures/Lecture8_ImageEnhancement.pdfZero-memory Filters for Enhancement POINT OPERATIONS: Zero memory operations

Clipping and thresholding 8

Page 9: Digital Image Processing - SHARIF UNIVERSITY OF ...ce.sharif.edu/.../Lectures/Lecture8_ImageEnhancement.pdfZero-memory Filters for Enhancement POINT OPERATIONS: Zero memory operations

Zero-memory Filters for Enhancement

3- GRAY SCALE REVERSAL

Creates digital negative of the image

4- GRAY-LEVEL WINDOW SLICING

9

Without background: With background:

Fully illuminates pixels lying in the interval [a, b] and removes the background.

Page 10: Digital Image Processing - SHARIF UNIVERSITY OF ...ce.sharif.edu/.../Lectures/Lecture8_ImageEnhancement.pdfZero-memory Filters for Enhancement POINT OPERATIONS: Zero memory operations

Digital negatives 10

Page 11: Digital Image Processing - SHARIF UNIVERSITY OF ...ce.sharif.edu/.../Lectures/Lecture8_ImageEnhancement.pdfZero-memory Filters for Enhancement POINT OPERATIONS: Zero memory operations

Zero-memory Filters for Enhancement

5- BIT EXTRACTION

B = number of bits used to represent u as an integer. This extracts the n-thmost-significant bit.

6- BIT REMOVAL

11

Most-significant-bit removal Least-significant-bit removal

Page 12: Digital Image Processing - SHARIF UNIVERSITY OF ...ce.sharif.edu/.../Lectures/Lecture8_ImageEnhancement.pdfZero-memory Filters for Enhancement POINT OPERATIONS: Zero memory operations

Level slicing of intensitywindow

12

visual and infrared (IR) images

Segmented Images

Page 13: Digital Image Processing - SHARIF UNIVERSITY OF ...ce.sharif.edu/.../Lectures/Lecture8_ImageEnhancement.pdfZero-memory Filters for Enhancement POINT OPERATIONS: Zero memory operations

13

Page 14: Digital Image Processing - SHARIF UNIVERSITY OF ...ce.sharif.edu/.../Lectures/Lecture8_ImageEnhancement.pdfZero-memory Filters for Enhancement POINT OPERATIONS: Zero memory operations

Zero-memory Filters for Enhancement

7- RANGE COMPRESSION

Intensity to contrast transformation.

14

Page 15: Digital Image Processing - SHARIF UNIVERSITY OF ...ce.sharif.edu/.../Lectures/Lecture8_ImageEnhancement.pdfZero-memory Filters for Enhancement POINT OPERATIONS: Zero memory operations

Range compression 15

Original log

Page 16: Digital Image Processing - SHARIF UNIVERSITY OF ...ce.sharif.edu/.../Lectures/Lecture8_ImageEnhancement.pdfZero-memory Filters for Enhancement POINT OPERATIONS: Zero memory operations

Image Subtraction and Change Detection

A simple but powerful method is to align the two images and subtract them

16

Page 17: Digital Image Processing - SHARIF UNIVERSITY OF ...ce.sharif.edu/.../Lectures/Lecture8_ImageEnhancement.pdfZero-memory Filters for Enhancement POINT OPERATIONS: Zero memory operations

Histogram Modeling

The HISTOGRAM of an image represents the relative frequency of occurrence of the various gray levels in the image

Histogram-modeling techniques modify an image so that its histogram has a desired shape

Useful in stretching the low-contrast levels of images with narrow histograms

Histogram Equalization

Histogram Specification

17

Page 18: Digital Image Processing - SHARIF UNIVERSITY OF ...ce.sharif.edu/.../Lectures/Lecture8_ImageEnhancement.pdfZero-memory Filters for Enhancement POINT OPERATIONS: Zero memory operations

Histogram Equalization

Goal: Uniform distribution of the output image

18

Page 19: Digital Image Processing - SHARIF UNIVERSITY OF ...ce.sharif.edu/.../Lectures/Lecture8_ImageEnhancement.pdfZero-memory Filters for Enhancement POINT OPERATIONS: Zero memory operations

Histogram equalization 19

input image,its histogram

Processed

image,its histogram

input image Equalized image

Page 20: Digital Image Processing - SHARIF UNIVERSITY OF ...ce.sharif.edu/.../Lectures/Lecture8_ImageEnhancement.pdfZero-memory Filters for Enhancement POINT OPERATIONS: Zero memory operations

Example 20

Page 21: Digital Image Processing - SHARIF UNIVERSITY OF ...ce.sharif.edu/.../Lectures/Lecture8_ImageEnhancement.pdfZero-memory Filters for Enhancement POINT OPERATIONS: Zero memory operations

Spatial Operations

Many image enhancement techniques are based on spatial operations performed on local neighborhoods of input pixels

Often, the image is convolved with a finite impulse response filter called SPATIAL MASK

Spatial Averaging and Spatial Low-pass Filtering

21

Input ImageOutput Image

Page 22: Digital Image Processing - SHARIF UNIVERSITY OF ...ce.sharif.edu/.../Lectures/Lecture8_ImageEnhancement.pdfZero-memory Filters for Enhancement POINT OPERATIONS: Zero memory operations

All equal weights

Spatial Averaging Filter

22

Number of Pixels in window W

Page 23: Digital Image Processing - SHARIF UNIVERSITY OF ...ce.sharif.edu/.../Lectures/Lecture8_ImageEnhancement.pdfZero-memory Filters for Enhancement POINT OPERATIONS: Zero memory operations

Spatial averagingfilters for smoothing images containing

Gaussiannoise

23

Page 24: Digital Image Processing - SHARIF UNIVERSITY OF ...ce.sharif.edu/.../Lectures/Lecture8_ImageEnhancement.pdfZero-memory Filters for Enhancement POINT OPERATIONS: Zero memory operations

Median Filtering

Example

24

Page 25: Digital Image Processing - SHARIF UNIVERSITY OF ...ce.sharif.edu/.../Lectures/Lecture8_ImageEnhancement.pdfZero-memory Filters for Enhancement POINT OPERATIONS: Zero memory operations

Properties of Median Filter

It is a nonlinear filter. Thus for two sequences x (m) and y (m)

It is useful for removing isolated lines or pixels while preserving spatial resolutions

Its performance is poor when the number of noise pixels in the window is greater than or half the number of pixels in the window

25

Page 26: Digital Image Processing - SHARIF UNIVERSITY OF ...ce.sharif.edu/.../Lectures/Lecture8_ImageEnhancement.pdfZero-memory Filters for Enhancement POINT OPERATIONS: Zero memory operations

Example 26

Page 27: Digital Image Processing - SHARIF UNIVERSITY OF ...ce.sharif.edu/.../Lectures/Lecture8_ImageEnhancement.pdfZero-memory Filters for Enhancement POINT OPERATIONS: Zero memory operations

27

Page 28: Digital Image Processing - SHARIF UNIVERSITY OF ...ce.sharif.edu/.../Lectures/Lecture8_ImageEnhancement.pdfZero-memory Filters for Enhancement POINT OPERATIONS: Zero memory operations

Unsharp Masking and Crispening

The unsharp masking technique is used commonly in the printing industry for crispening the edges

In general the unsharp masking operation can be represented by

Discrete Laplacian

28

Gradient Function

Page 29: Digital Image Processing - SHARIF UNIVERSITY OF ...ce.sharif.edu/.../Lectures/Lecture8_ImageEnhancement.pdfZero-memory Filters for Enhancement POINT OPERATIONS: Zero memory operations

Unsharp Masking Operations 29

Page 30: Digital Image Processing - SHARIF UNIVERSITY OF ...ce.sharif.edu/.../Lectures/Lecture8_ImageEnhancement.pdfZero-memory Filters for Enhancement POINT OPERATIONS: Zero memory operations

30

Page 31: Digital Image Processing - SHARIF UNIVERSITY OF ...ce.sharif.edu/.../Lectures/Lecture8_ImageEnhancement.pdfZero-memory Filters for Enhancement POINT OPERATIONS: Zero memory operations

Spatial Low-pass, High-pass, and Band-pass Filtering

31

Spatial Low-pass Filter

Spatial High-pass Filter

Spatial Band-pass Filter

Page 32: Digital Image Processing - SHARIF UNIVERSITY OF ...ce.sharif.edu/.../Lectures/Lecture8_ImageEnhancement.pdfZero-memory Filters for Enhancement POINT OPERATIONS: Zero memory operations

Spatial Low-pass, High-pass, and Band-pass Filtering

Low-pass filters are useful for noise smoothing and interpolation

High-pass filters are useful in extracting edges and in sharpening images

Band-pass filters are useful in the enhancement of edges and other high-pass image characteristics in the presence of noise

32

Page 33: Digital Image Processing - SHARIF UNIVERSITY OF ...ce.sharif.edu/.../Lectures/Lecture8_ImageEnhancement.pdfZero-memory Filters for Enhancement POINT OPERATIONS: Zero memory operations

33

Page 34: Digital Image Processing - SHARIF UNIVERSITY OF ...ce.sharif.edu/.../Lectures/Lecture8_ImageEnhancement.pdfZero-memory Filters for Enhancement POINT OPERATIONS: Zero memory operations

Magnification and Interpolation (Zooming)

Replication

Linear Interpolation

34

Page 35: Digital Image Processing - SHARIF UNIVERSITY OF ...ce.sharif.edu/.../Lectures/Lecture8_ImageEnhancement.pdfZero-memory Filters for Enhancement POINT OPERATIONS: Zero memory operations

35

Page 36: Digital Image Processing - SHARIF UNIVERSITY OF ...ce.sharif.edu/.../Lectures/Lecture8_ImageEnhancement.pdfZero-memory Filters for Enhancement POINT OPERATIONS: Zero memory operations

36

Page 37: Digital Image Processing - SHARIF UNIVERSITY OF ...ce.sharif.edu/.../Lectures/Lecture8_ImageEnhancement.pdfZero-memory Filters for Enhancement POINT OPERATIONS: Zero memory operations

Generalized Linear Filtering 37

Zonal Mask

Page 38: Digital Image Processing - SHARIF UNIVERSITY OF ...ce.sharif.edu/.../Lectures/Lecture8_ImageEnhancement.pdfZero-memory Filters for Enhancement POINT OPERATIONS: Zero memory operations

Root Filtering

The effect of a-rooting is to enhance higher spatial frequencies (low amplitudes) relative to lower spatial frequencies (high amplitudes).

38

Page 39: Digital Image Processing - SHARIF UNIVERSITY OF ...ce.sharif.edu/.../Lectures/Lecture8_ImageEnhancement.pdfZero-memory Filters for Enhancement POINT OPERATIONS: Zero memory operations

Generalized Cepstrum and Homomorphic Filtering

If the magnitude term in the previous slide is replaced by the logarithm of |𝒗(𝒌, 𝒍)| and we define

then the inverse transform of 𝒔(𝒌, 𝒍), denoted by 𝒄(𝒎, 𝒏), is called the generalized CEPSTRUM of the image

In practice a positive constant is added to |𝒗 𝒌, 𝒍 | to prevent the logarithm from going to negative infinity

The image c (m, n) is also

39

Page 40: Digital Image Processing - SHARIF UNIVERSITY OF ...ce.sharif.edu/.../Lectures/Lecture8_ImageEnhancement.pdfZero-memory Filters for Enhancement POINT OPERATIONS: Zero memory operations

MULTISPECTRAL IMAGE ENHANCEMENT

In multispectral imaging there is a sequence of I images 𝑼𝒊 𝒎,𝒏 , 𝒊 =𝟏, 𝟐, … , 𝑰 where the number I is typically between 2 and 12

It is desired to combine these images to generate a single or a few display images that are representative of their features

There are three common methods of enhancing such images

Intensity Ratios

Log-Ratios

Principal Components

40

Page 41: Digital Image Processing - SHARIF UNIVERSITY OF ...ce.sharif.edu/.../Lectures/Lecture8_ImageEnhancement.pdfZero-memory Filters for Enhancement POINT OPERATIONS: Zero memory operations

41

Page 42: Digital Image Processing - SHARIF UNIVERSITY OF ...ce.sharif.edu/.../Lectures/Lecture8_ImageEnhancement.pdfZero-memory Filters for Enhancement POINT OPERATIONS: Zero memory operations

Intensity Ratios

where Ui (m, n) represents the intensity and is assumed to be positive

This method gives 12 - I combinations for the ratios, the few most suitable of which are chosen by visual inspection.

Sometimes the ratios are defined with respect to the average image to reduce the number of combinations.

42

Page 43: Digital Image Processing - SHARIF UNIVERSITY OF ...ce.sharif.edu/.../Lectures/Lecture8_ImageEnhancement.pdfZero-memory Filters for Enhancement POINT OPERATIONS: Zero memory operations

Log-Ratios

The log-ratio Li,j gives a better display when the dynamic range of Ri,j is very large,

43

Page 44: Digital Image Processing - SHARIF UNIVERSITY OF ...ce.sharif.edu/.../Lectures/Lecture8_ImageEnhancement.pdfZero-memory Filters for Enhancement POINT OPERATIONS: Zero memory operations

Principal Components

For each (m, n) define the I x 1 vector

The I x I KL transform of u(m, n), denoted by f, is determined from the autocorrelation matrix of the ensemble of vectors{ui (m, n), i = 1, . . . , I}.

The rows of f, which are eigenvectors of the autocorrelation matrix, are arranged in decreasing order of their associated eigenvalues.

Then for any 𝑰𝟎 ≤ 𝑰, the images vi (m, n), i = 1 , . . . , I0 obtained from the KL transformed vector v(m, n) = f u(m, n) are the first 𝑰𝟎principal components of the multispectral images.

44

Page 45: Digital Image Processing - SHARIF UNIVERSITY OF ...ce.sharif.edu/.../Lectures/Lecture8_ImageEnhancement.pdfZero-memory Filters for Enhancement POINT OPERATIONS: Zero memory operations

False Color And Pseudocolor

FALSE COLOR implies mapping a color image into another color image to provide a more striking color contrast (which may not be natural) to attract the attention of the viewer

PSEUDOCOLOR refers to mapping a set of images ui(m, n), i=1,...,I into a color image. Usually the mapping is determined such that different features of the data set can be distinguished by different colors

45

Pseudocolor image enhancement

Page 46: Digital Image Processing - SHARIF UNIVERSITY OF ...ce.sharif.edu/.../Lectures/Lecture8_ImageEnhancement.pdfZero-memory Filters for Enhancement POINT OPERATIONS: Zero memory operations

Color Image Enhancement

improvement of color balance or color contrast in a color image

46

Color image enhancement

Page 47: Digital Image Processing - SHARIF UNIVERSITY OF ...ce.sharif.edu/.../Lectures/Lecture8_ImageEnhancement.pdfZero-memory Filters for Enhancement POINT OPERATIONS: Zero memory operations

End of Lecture

Thank You!

Tables, Pictures & equations are taken from Jain Book.