Presentation is loading. Please wait.

Presentation is loading. Please wait.

Image Enhancement in the Spatial Domain

Similar presentations


Presentation on theme: "Image Enhancement in the Spatial Domain"— Presentation transcript:

1 Image Enhancement in the Spatial Domain
Lecture 3 Image Enhancement in the Spatial Domain

2 Lecture 3 Image Enhancement in Spatial Domain
Machine Vision R. Ebrahimpour, 2008

3 Principle Objective of Enhancement

4 Image Enhancement in 2 domains
Spatial Domain : (image plane) Techniques are based on direct manipulation of pixels in an image Frequency Domain : Techniques are based on modifying the Fourier transform of an image There are some enhancement techniques based on various combinations of methods from these two categories.

5 Good images For human visual
The visual evaluation of image quality is a highly subjective process. It is hard to standardize the definition of a good image. For machine perception The evaluation task is easier. A good image is one which gives the best machine recognition results. A certain amount of trial and error usually is required before a particular image enhancement approach is selected.

6 Spatial domain Spatial domain processing: procedures that operate directly on the pixels of the input image to generate the pixel values of processed (output) image. g(x,y)=T[f(x,y)] f(x,y): input image g(x,y): processed image T: an operator defined over some neighborhood of (x,y) Neighborhood around (x,y): usually a square or rectangular subimage area centered at (x,y). The center of the subimage is moved pixel by pixel. At each location (x,y) the operator T is applied to find the value of g(x,y).

7

8 Point Processing Simplest form of T (the operator): the neighborhood is 1x1. g(x,y) only depends of value of f at (x,y). T: a gray-level transformation (mapping) This type of processing is called point processing

9 Spatial domain: Point Processing
s=T(r) • r: gray-level at (x,y) in original image f(x,y) • s: gray-level at (x,y) in processed image g(x,y)

10 Example: Contrast Stretching & Thresholding

11

12 3 basic gray-level transformation functions
1)Linear function Negative and identity transformations 2) Logarithm function Log and inverse-log transformation 3) Power-law function nth power and nth root transformations

13 Image Negatives s = L – 1 –r

14 Log Transformations s = c log (1+r) c is a constant and r>=0
Log curve maps a narrow range of low gray-level values in the input image into a wider range of output levels Used to expand the values of dark pixels in an image while compressing the higher-level values.

15 Example: s = log (1+r)

16 Power-law transformation

17 Gamma Correction

18

19

20 Piecewise-Linear Transformation Functions

21 Gray-level slicing Objective: Highlighting a specific range of gray levels in an image

22 Bit-plane slicing

23

24 Histogram Processing Normalized Histogram:
gives an estimate of the probability of occurrence of gray level. The sum of all components of a normalized histogram is equal to 1.

25

26

27

28 Histogram Equalization
As the low-contrast image’s histogram is narrow and centered toward the middle of the gray scale, if we distribute the histogram to a wider range the quality of the image will be improved. We can do it by adjusting the Probability Density Function(PDF) of the original histogram of the image so that the probability spread Equally.

29 Histogram transformation
S=T(r)

30 Histogram Equalization
The PDF of the transformed variable s is determined by the gray-level PDF of the input image and by the chosen transformation function A transformation function is a cumulative distribution function (CDF) of random variable r:

31 The discrete version of transformation

32 The discrete version of transformation 3 6
2 3 4 5 The discrete version of transformation 3 6 8 9 4x4 Image with Gray Levels between 0 and 9 Input Image Output Image r Nr ÷16 Pr S (تجمعی) x9 New S 1 2 6 6/16 6/16 = 3.375 ≈ 3 3 5 تقسیم بر 16 5/16 11/16 = ضرب در 9 6.375 ≈ 6 4 4/16 15/16 = ≈ 8 1/16 16/16 = 9 7 8

33 Histogram Matching (Specification)
Histogram equalization has a disadvantage which is that it can generate only one type of output image. With Histogram Specification, we can specify the shape of the histogram that we wish the output image to have. It doesn’t have to be a uniform histogram. Procedure …. 1) Obtain the transformation function T(r) by calculating the histogram equalization of the input image: 2) Obtain the transformation function G(z) by calculating histogram equalization of the desired density function Obtain the inversed transformation function Obtain the output image by applying the processed gray-level from the inversed transformation function to all the pixels in the input image

34 Example: Desired probability density function:

35 گام اول گام دوم گام سوم

36 Indirect approach: First equalize the histogram using transform s = T(r). Equalize the desired histogram v = G(z). Set v = s to obtain the composite transform

37

38 Histogram specification is a trial-and-error process
There are no rules for specifying histograms, and one must resort to analysis on a case-by-case basis for any given enhancement task. Histogram processing methods are global processing, in the sense that pixels are modified by a transformation function based on the gray-level content of an entire image.

39 Local Enhancement

40 Enhancement using Arithmetic/Logic Operations
Mask Processing Enhancement using Arithmetic/Logic Operations Logical Operations

41 Image Subtraction h(x,y) is the mask

42 Image Averaging A noisy image: Averaging M different noisy images:

43 a) original image b) image corrupted by additive Gaussian noise with zero mean and a standard deviation of 64 gray levels. c). -f). results of averaging K = 8, 16, 64 and noisy images

44

45 Spatial Filtering use filter (can also be called as mask/ kernel/ template or window) odd sizes, e.g. 3x3, 5x5,… (for a 3 x 3 filter)

46 simply move the filter mask
from point to point in an image.

47 Linear Filtering Also called convolution
a=(m-1)/2 and b=(n-1)/2, m x n (odd numbers) Also called convolution

48 Smoothing Spatial Filters
used for blurring and for noise reduction blurring is used in preprocessing steps, such as removal of small details from an image prior to object extraction bridging of small gaps in lines or curves noise reduction can be accomplished by blurring with a linear filter and also by a nonlinear filter

49 Averaging Filters output is simply the average of the pixels contained in the neighborhood of the filter mask. called averaging filters or lowpass filters. replacing the value of every pixel in an image by the average of the gray levels in the neighborhood will reduce the “sharp” transitions in gray levels. sharp transitions random noise in the image edges of objects in the image thus, smoothing can reduce noises (desirable) and blur edges (undesirable)

50 3x3 Smoothing Linear Filters
weighted average box filter the center is the most important and other pixels are inversely weighted as a function of their distance from the center of the mask

51 Weighted average filter
the basic strategy behind weighting the enter point the highest and then reducing the value of the coefficients as a function of increasing distance from the origin is simply an attempt to reduce blurring in the smoothing process. General form : smoothing mask مجموع کلیه ضرایب ماسک

52 Example:

53 Example:

54 Order-Statistics Filters )nonlinear Filters)
the response is based on ordering (ranking) the pixels contained in the image area encompassed by the filter. Example: Median Filter Max Filter Min Filter Median filtering Used primarily for noise reduction without any changes in edge of objects: The gray level of each pixel is replaced by the median of the gray levels in the neighborhood of that pixel (instead of by the average as before). quite popular because for certain types of random noise (impulse noise, salt and pepper noise) , they provide excellent noise-reduction capabilities, with considering less blurring than linear smoothing filters of similar size.

55 Project # 2 Median Filter
forces the points with distinct gray levels to be more like their neighbors.

56 Sharpening Spatial Filters
To highlight fine detail or to enhance blurred detail. smoothing ~ integration sharpening ~ differentiation Averaging is analogous to integration and causes blurring, so differentiation is expected to have opposite results and sharpen an image thus, image differentiation enhances edges and other discontinuities (noise) deemphasizes area with slowly varying gray-level values. Categories of sharpening filters: Derivative operators Basic highpass spatial filtering High-boost filtering

57 First derivative: Second derivative: Gradient operator
Laplacian operator

58 Discrete Form of Laplacian

59 Laplacian mask

60 Effect of Laplacian Operator
as it is a derivative operator, it highlights gray-level discontinuities in an image it deemphasizes regions with slowly varying gray levels tends to produce images that have featureless background. Correct the effect of featureless background: easily by adding the original and Laplacian image. Sharpen image by Laplacian with addition of original image(Laplacian enhanced image)

61 Example:

62 Mask of Laplacian + addition(Laplacian enhanced image)

63

64 High-boost Filtering (UNSHARP MASKING)
The complete unsharp filtering operator(Unsharp Maskingenhanced image) Unsharp masking: Highpass filtered image = Original – lowpass filtered image Sharpened image = original image – blurred image High-boost Filtering: :(A-1)Original+Original-Lowpass : (A-1)Original+Highpass

65 if we use Laplacian filter to create sharpen image fs(x,y) with addition of original image:

66 High-boost Masks A >=1
if A = 1, it becomes “standard” Laplacian sharpening

67 Project # 3 Example:

68 Gradient Operator first derivatives are implemented using the magnitude of the gradient

69 Gradient Mask simplest approximation, 2x2

70 Roberts cross-gradient operators, 2x2

71 Sobel operators, 3x3

72 Example:

73 Sobel Edge Detector Threshold Edges Image I

74 Sobel Edge Detector

75 Project # 4 Sobel Edge Detector


Download ppt "Image Enhancement in the Spatial Domain"

Similar presentations


Ads by Google