• Tidak ada hasil yang ditemukan

Neighborhood Processing Image Enhancement

N/A
N/A
Protected

Academic year: 2018

Membagikan "Neighborhood Processing Image Enhancement"

Copied!
74
0
0

Teks penuh

(1)

Neighborhood

Processing

Introduction

(2)

Basic Image Processing

Operations

Neighborhood processing

process the pixel with its neighborsPoint operations

(3)
(4)

Point Processing

Original

Original DarkenDarken

Invert

Invert LightenLighten

Lower Contrast

Lower Contrast

Raise Contrast

Raise Contrast Nonlinear Lower ContrastNonlinear Lower Contrast

Nonlinear Raise Contrast

(5)

Point Processing

Original

Original DarkenDarken

Invert

Invert LightenLighten

Lower Contrast

Lower Contrast

Raise Contrast

Raise Contrast Nonlinear Lower ContrastNonlinear Lower Contrast

Nonlinear Raise Contrast

Nonlinear Raise Contrast

x + 128 x * 2

255 - x ((x / 255.0) ^2) * 255.0

x - 128 x / 2

(6)
(7)

Neighborhood operations

Image Edge detection Blur

Deteksi tepi ( Edge detection ) adalah operasi yang dijalankan untuk

mendeteksi garis tepi (edges) yang membatasi dua wilayah citra homogen yang memiliki tingkat kecerahan yang berbeda

Tujuannya adalah untuk mengubah citra 2D menjadi bentuk kurva

(8)

Neighborhood Processing

3x3 Mask

Output derives from multiplying all elements in the mask

by corresponding elements in the neighborhood and

(9)

Filter

A rule or procedure for processing an imageCombination of mask and function

Goal: separating/attenuating a desired component of an observed image

Type:

Linear (function), Nonlinear (function)

(10)

Steps of

Linear Spatial

Filtering

Position the mask over the current pixel.

Form all products of filter elements with the corresponding

elements of the neighborhood.

Add all products.

Other names for mask:

(11)

Linear Spatial Filter: Example

(12)

Linear Spatial Filter: Example

(13)

20/9 0/9

10/9

Linear Spatial Filter: Example

(3)

15/9 20/9

10/9 15/9

10/9 10/9

Add all products for output.

15/9 + 10/9 + 20/9 +

0/9 + 10/9 + 15/9 +

20/9 + 10/9 + 10/9

= 12.22

Output intensity of blue pixel

= 12.22

(14)

Correlation and

Convolution

(15)

Correlation

Sum of the product of mask and intensity on each point.

(16)
(17)

Example: Correlation (2)

Multiply and sum all products.

10

1 +15

2 +10

3

+10

2 +20

3

+15

4 +5

3 +0

4

+0

5

(18)

Exercise: Correlation

(19)

Convolution

Sum of the response on each point

(20)
(21)

Example: Convolution (2)

Multiply and sum all products.

10

5 +15

4 +10

3

+10

4 +20

3

+15

2 +5

3 +0

2

+0

1

(22)

Exercise: Convolution

(23)
(24)
(25)

Example: HPF (2)

Filtered Image

10 20 10 15 5

5 0 20 -10 0

20 -40 25 15 5

10 5 -35 0 10

(26)

Edges of The Image

A linear filter is represented as a matrix, e.g., the 3 x 3 averaging

filter.

Edges of the Image

There are a number of different approaches to dealing with this problem.

Ignore the edges: The mask is applied to all pixels except the edges and

results in an output image that is smaller than the original. If the mask is very large, a significant amount of information may be lost.

Pad with zeros: We assume that all necessary values outside the image are

zero. It will return an output image of the same size as the original, but may have the effect of introducing unwanted artifacts, e.g., edges, around the image.

1/9

1/9

1/9 1/9 1/9

1/9 1/9 1/9

(27)

Edges of The Image

Batas atau tepi citra (edges of the image)

hal yang harus diselesaikan dalam operasi filtering

misalnya, bagaimana jika sebagian “mask” berada di luar

(28)

Edges of The Image (1)

Tidak mempedulikan batas atau tepi citra

“mask” hanya diaplikasikan pada piksel-piksel citra dimana

seluruh “mask” berada dalam citra.

Pendekatan ini menghasilkan citra output yang ukurannya lebih kecil daripada citra input.

Jika ukuran “mask” sangat besar, akan menyebabkan sejumlah

(29)

Edges of The Image (2)

Tambahkan piksel-piksel dengan nilai 0 (Pad with zeroes)

Dalam pendekatan ini, diasumsikan bahwa semua piksel yang

berada di luar citra mempunyai nilai grey-level nol.

Pendekatan ini menghasilkan citra output yang ukurannya sama

(30)

Filtering in MATLAB

Command: filter2

Syntax: filter2(filter, image, shape); filter2(filter, image);

• shape:

• ‘same’: pad edge with zeros. Size unchanged. (default)

• ‘valid’: apply mask only to inside pixel. Size smaller.

(31)

Filter Construction in

MATLAB

Command: fspecial

Syntax: fspecial(type, parameter); fspecial(type);

type: type of the filter

‘average’ : average filter • ‘gaussian’ : Gaussian filter • ‘laplacian’ : Laplacian filter …

parameter: parameter of the filter (size, sigma, …). Default varies

(32)
(33)
(34)

Filter on Frequency Domain

Low-pass filter (LPF): filter that allows only the low-frequency

components and reduces or eliminates the high-frequency components.

E.g. Gaussian, average

High-pass filter (HPF): filter that allows only the high-frequency

components and reduces or eliminates the low-frequency components.

E.g. Laplacian, Prewitt, Sobel

Spatial data (intensity) transformed by Fourier transform. Simplified version:

high-frequency indicates the abrupt changes in intensity  edges.

(35)

Computing Consideration

Filter may lead to the value outside [0,255]

Solution 1: Make negative values positive (use

absolute value)

good when there are few negative

values and the negative values are close to zero

Solution 2: Clip values

. Values larger than 255 become

255 and values less than 0 become 0.

not good if

there are many values outside the range.

Solution 3: Scaling transformation

. Rescale the range

(36)

Rescaling Intensity

Rescaled value (y)

1. Map

g

L

to 0.

2. Map

g

H

to 255.

3. Interpolate for

the remaining

(37)

Rescaling: MATLAB

Manual:

>> gH = max(filtered_image(:));

>> gL = min(filtered_image(:));

>> scaled = (image – gmin)/(gmax – gmin);

(38)

Rescaling: MATLAB (2)

Command: mat2gray

Syntax: mat2gray(double_image); What this command do?

scale the value in double_image to displayable value. Output is double type.

(39)

Low Pass Filter

Averaging

(40)

Low Pass Filter

Useful for reducing noise and eliminating small details.The elements of the mask must be positive.

Sum of mask elements is 1 (after normalization).

(41)
(42)

Filter Average

Filter average penting dalam permasalahan-permasalahan di

mana aspek citra yang menjadi perhatian adalah bukan detail citra

objek pengamatan :

berapa jumlah objek yang ada pada citra

luas daerah gelap dan daerah terang pada citra.

(43)

Low Pass Filter : Averaging

Mask size determines the degree of smoothing (loss of detail).

3x3 5x5 7x7

15x15 25x25

(44)

Low Pass Filter : Averaging

Mask size determines the degree of smoothing (loss of detail).

(45)

Low Pass Filter : Gaussian

1D Gaussian filter:

2D Gaussian filter:

(46)

Low Pass Filter : Gaussian

σ (sigma) controls the amount of smoothing

As σ increases, more samples must be obtained to represent

the Gaussian function accurately.

σ = 3

(47)

Low Pass Filter : Gaussian

Filter Gaussian

Implementasinya : membangun filter Gaussian, mengalikannya

dengan matriks hasil transformasi Fourier, dan menginversikan hasilnya.

Filter Gaussian merupakan jenis filter yang “paling smooth” dan

(48)

Benefits of Gaussian Filter

They are

mathematically very well behaved

. The

Fourier transform

of a Gaussian filter is

another

Gaussian

.

There are rotationally symmetric, so are very

good starting points for

some edge-detection

algorithms

.

They are separable in

x

and

y

axes. This can lead

to

very fast implementations

.

The

convolution of two Gaussians

is another

(49)

Low Pass Filter : Gaussian

Effect of Gaussian filter = blurringlarger leads to more blur.

(50)

50

Averaging vs Gaussian Smoothing

Averaging

(51)

Gaussian Filter: MATLAB

Construction of Gaussian filter:

command: fspecial(‘gaussian’, size, gamma);

size : size of the filter [row column], default [3 3] gamma : , default 0.5.

>>gaussian1 = fspecial(‘gaussian’, [5 5], 5);

Create the 55 Gaussian filter with the value of 5.

>>gaussian2 = fspecial(‘gaussian’, 3, 0.75);

 Create the 33 Gaussian filter with the  value of 0.75.

(52)
(53)

High Pass Filter

Useful for

highlighting fine details

.

The elements of the mask contain both

positive

and

negative

weights.

Sum of mask elements is 0.

1st derivative

of Gaussian

2nd derivative

(54)

Edge Sharpening

Also known as edge enhancement, edge crispening, unsharp masking.

Process to make the edge slightly sharper (tajam) and crisper

(tegas).

E.g. linear edge sharpening, unsharp masking, high boost filtering

High pass filter (HPF)

(55)

High Pass Filter : MATLAB

Command: filter2

Syntax: filter2(filter, image, shape); filter2(filter, image);

• shape:

• ‘same’: pad edge with zeros. Size unchanged. (default)

• ‘valid’: apply mask only to inside pixel. Size smaller.

• ‘full’: pad edge with zeros and applying the filter at all places on and around the image where the mask intersects the image matrix. Size larger.

(56)

LPF - HPF

LPF = perbedaan warna rendah

HPF = perbedaan warna tinggi atau signifikan

(57)

Unsharp Masking

and High Boost

(58)
(59)

Unsharp Masking

Obtain a

sharp image

by

subtracting

a lowpass filtered

(i.e., smoothed) image

from

the

original

image:

-

=

(60)

[unsharp_image] = [input](a [filter]  [input])

= (I* – a [filter]) [input]

= [unsharp_filter]  [input]

I* : matrix whose center member is 1 and the others are zero.

E.g. for 3  3 matrix I* =

For 33 matrix, after some rearranging term:

[unsharp_filter] =

(61)

Unsharp Filter: MATLAB

Command: fspecial

Syntax: fspecial(‘unsharp’, alpha);

alpha : alpha value for unsharp filter

Size of the filter is fixed to 3  3

(62)

Effect of Unsharp Masking

BEFORE AFTER

(63)

High Boost Filter

Image sharpening emphasizes edges but low frequency components are lost. (menekankan ketajaman)

High boost filter: amplify input image, then subtract a lowpass image.

Best result when 3/5  A  5/6

Used in dark image.

Boost the intensity of the original image.

(64)

Effect of High Boost Filter

(65)

High Boost Filter : MATLAB

(66)
(67)

Image Derivatives

How can we differentiate a

digital

image F[x,y]?

Option 1: reconstruct a continuous image,

f,

then

compute the derivative

Option 2: take discrete derivative (finite difference)

1 -1

How would you implement this as a linear filter?

-1

1

(68)

Image Gradient

The gradient points in the direction of most rapid increase in intensity

The

gradient

of an image:

The edge strength is given by the gradient magnitude (besar gradient):

The gradient direction is given by:

(69)
(70)

Metode Robert

adalah teknik differensial pada arah horisontal dan differensial

(71)

Image Gradient

A different approximation of the gradient:

•We can implement and using the following masks:

*

(x+1/2,y+1/2)

(72)

Metode Prewitt

Metode Prewitt merupakan pengembangan metode robert

dengan menggunakan filter HPF yang diberi satu angka nol

(73)

Metode Sobel

Metode ini mengambil prinsip dari fungsi laplace dan gaussian

(74)

Image Gradient : MATLAB

Command: fspecial • Syntax:

• fspecial(‘prewitt’);

• fspecial (‘sobel’);

Referensi

Dokumen terkait

Based on our numerical experiment, we show that the edge detection and the image denoising methods exploiting tight wavelet frame decomposition give better results compare with

Conclusion There are too many automatic systems built based on image processing techniques, including pre processing, edge detection, image segmentation, and feature extraction to

The Elastic Bunch Graph Matching is responsible for evaluating the graph the input image graph and the face bunch graph of identical Thus for an image graph G with nodes n = 1, 2…N and

Keywords: - Object measurement, Area Calculation, Image Processing, Canny edge detection.. Introduction The real-time object measurement system is a program for detecting the

An image enhancement method based on a s-sharp function and pixel neighborhood information ABSTRACT Image enhancement is a significant field in image processing.. This paper

abcdefghijk are Input image, Resized image, Gray image, Noise removal Image, Color filter, Filtered image, Contrast enhanced, Otsu segmentation, Conversion to HIS, Neural network,

2 Convert the gray image to an edge image.3 Compute the horizontal and vertical projection profiles of candidate text regions using a histogram with an appropriate threshold value.4 Use

Keywords – Traffic light control,, Electronic sensors, Image Processing, Image matching, edge detection I.. INTRODUCTION In modern life we have to face with many problems one of