Presentation is loading. Please wait.

Presentation is loading. Please wait.

CIS 4350 Image ENHANCEMENT SPATIAL DOMAIN

Similar presentations


Presentation on theme: "CIS 4350 Image ENHANCEMENT SPATIAL DOMAIN"— Presentation transcript:

1 CIS 4350 Image ENHANCEMENT SPATIAL DOMAIN
in the SPATIAL DOMAIN Dr. Rolf Lakaemper

2 Most of these slides base on the book Digital Image Processing
by Gonzales/Woods Chapter 3

3 Image Enhancement ? Spatial Domain ?
Introduction Image Enhancement ? enhance otherwise hidden information Filter important image features Discard unimportant image features Spatial Domain ? Refers to the image plane (the ‘natural’ image) Direct image manipulation

4 A 2D grayvalue - image is a 2D -> 1D function,
Remember ? A 2D grayvalue - image is a 2D -> 1D function, v = f(x,y)

5 As we have a function, we can apply operators to this function, e.g.
Remember ? As we have a function, we can apply operators to this function, e.g. T(f(x,y)) = f(x,y) / 2 Operator Image (= function !)

6 T transforms the given image f(x,y) into another image g(x,y)
Remember ? T transforms the given image f(x,y) into another image g(x,y) f(x,y) g(x,y)

7 The operator T can be defined over
Spatial Domain The operator T can be defined over The set of pixels (x,y) of the image The set of ‘neighborhoods’ N(x,y) of each pixel A set of images f1,f2,f3,…

8 Operation on the set of image-pixels
Spatial Domain Operation on the set of image-pixels 6 8 2 3 4 1 12 200 20 10 6 100 10 5 (Operator: Div. by 2)

9 Operation on the set of ‘neighborhoods’ N(x,y) of each pixel
Spatial Domain Operation on the set of ‘neighborhoods’ N(x,y) of each pixel 6 8 12 200 (Operator: sum) 6 8 2 226 12 200 20 10

10 Operation on a set of images f1,f2,…
Spatial Domain Operation on a set of images f1,f2,… 6 8 2 12 200 20 10 11 13 3 (Operator: sum) 14 220 23 14 5 5 1 2 20 3 4

11 Operation on the set of image-pixels
Spatial Domain Operation on the set of image-pixels Remark: these operations can also be seen as operations on the neighborhood of a pixel (x,y), by defining the neighborhood as the pixel itself. The simplest case of operators g(x,y) = T(f(x,y)) depends only on the value of f at (x,y) T is called a gray-level or intensity transformation function

12 Basic Gray Level Transformations
Image Negatives Log Transformations Power Law Transformations Piecewise-Linear Transformation Functions For the following slides L denotes the max. possible gray value of the image, i.e. f(x,y)  [0,L]

13 Image Negatives: T(f)= L-f
Transformations Image Negatives: T(f)= L-f T(f)=L-f Output gray level Input gray level

14 Transformations Log Transformations: T(f) = c * log (1+ f)

15 Transformations Log Transformations InvLog Log

16 Transformations Log Transformations

17 Power Law Transformations
T(f) = c*f 

18 varying gamma () obtains family of possible transformation curves
Transformations varying gamma () obtains family of possible transformation curves  > 0 Compresses dark values Expands bright values  < 0 Expands dark values Compresses bright values

19 Used for gamma-correction
Transformations Used for gamma-correction

20 Used for general purpose contrast manipulation
Transformations Used for general purpose contrast manipulation

21 Piecewise Linear Transformations

22 Thresholding Function
Piecewise Linear Transformations Thresholding Function g(x,y) = L if f(x,y) > t, 0 else t = ‘threshold level’ Output gray level Input gray level

23 Purpose: Highlight a specific range of grayvalues Two approaches:
Piecewise Linear Transformations Gray Level Slicing Purpose: Highlight a specific range of grayvalues Two approaches: Display high value for range of interest, low value else (‘discard background’) Display high value for range of interest, original value else (‘preserve background’)

24 Piecewise Linear Transformations
Gray Level Slicing

25 Extracts the information of a single bitplane
Piecewise Linear Transformations Bitplane Slicing Extracts the information of a single bitplane

26 Piecewise Linear Transformations
BP 0 BP 5 BP 7

27 How does the transformation function look for bitplanes 0,1,… ?
Piecewise Linear Transformations Exercise: How does the transformation function look for bitplanes 0,1,… ? What is the easiest way to filter a single bitplane (e.g. in MATLAB) ?

28 Histogram Processing Histograms 1 4 5 3 1 5 1 Number of Pixels
3 1 5 1 Number of Pixels gray level

29 Histogram Equalization:
Histograms Histogram Equalization: Preprocessing technique to enhance contrast in ‘natural’ images Target: find gray level transformation function T to transform image f such that the histogram of T(f) is ‘equalized’

30 Histogram Equalization
Equalized Histogram: The image consists of an equal number of pixels for every gray-value, the histogram is constant !

31 Example: T We are looking for this transformation !
Histogram Equalization Example: T We are looking for this transformation !

32 Observation (continous model !):
Histogram Equalization Target: Find a transformation T to transform the grayvalues g1[0..1] of an image I to grayvalues g2 = T(g1) such that the histogram is equalized, i.e. there’s an equal amount of pixels for each grayvalue. Observation (continous model !): Assumption: Total image area = 1 (normalized). Then: The area(!) of pixels of the transformed image in the gray-value range 0..g2 equals the gray-value g2.

33 Histogram Equalization
The area(!) of pixels of the transformed image in the gray-value range 0..g2 equals the gray-value g2. Every g1 is transformed to a grayvalue that equals the area (discrete: number of pixels) in the image covered by pixels having gray-values from 0 to g1. The transformation T function t is the area- integral: T: g2 = 0..g1 I da

34 Histogram Equalization
Discrete: g1 is mapped to the (normalized) number of pixels having grayvalues 0..g1 .

35 The results achieved do NOT hold for discrete spaces !
Histogram Equalization Mathematically the transformation is deducted by theorems in continous (not discrete) spaces. The results achieved do NOT hold for discrete spaces ! (Why ?) However, it’s visually close.

36 Histogram Equalization
Conclusion: The transformation function that yields an image having an equalized histogram is the integral of the histogram of the source-image The discrete integral is given by the cumulative sum, MATLAB function: cumsum() The function transforms an image into an image, NOT a histogram into a histogram ! The histogram is just a control tool ! In general the transformation does not create an image with an equalized histogram in the discrete case !

37 Operation on a set of images f1,f2,…
Operations on a set of images Operation on a set of images f1,f2,… 6 8 2 12 200 20 10 11 13 3 (Operator: sum) 14 220 23 14 5 5 1 2 20 3 4

38 Logic (Bitwise) Operations
Operations on a set of images Logic (Bitwise) Operations AND OR NOT

39 The operators AND,OR,NOT are functionally complete:
Operations on a set of images The operators AND,OR,NOT are functionally complete: Any logic operator can be implemented using only these 3 operators

40 Any logic operator can be implemented using only these 3 operators:
Operations on a set of images Any logic operator can be implemented using only these 3 operators: A B Op 1 Op= NOT(A) AND NOT(B) OR NOT(A) AND B

41 Image 1 AND Image 2 Operations on a set of images 1 2 3 9 7 3 6 4 1 1
1 1 (Operator: AND) 2 2 2 1 1 1 1 2 2 2 2

42 Used for Bitplane-Slicing and
Operations on a set of images Image 1 AND Image 2: Used for Bitplane-Slicing and Masking

43 Operations on a set of images
Exercise: Define the mask-image, that transforms image1 into image2 using the OR operand 1 2 3 9 7 3 6 4 255 2 7 255 (Operator: OR) 255 3 7 255

44 Arithmetic Operations on a set of images
1 2 3 9 7 3 6 4 2 3 4 10 (Operator: +) 9 5 8 6 1 1 1 1 2 2 2 2

45 What could the operators + and – be used for ?
Operations Exercise: What could the operators + and – be used for ?

46 (MATLAB) Example: Operator – Foreground-Extraction
Operations (MATLAB) Example: Operator – Foreground-Extraction

47 Operations (MATLAB) Example: Operator + Image Averaging

48 CIS 4350 Image ENHANCEMENT SPATIAL DOMAIN
in the SPATIAL DOMAIN Part 2

49 Histogram equalization Now: Histogram statistics
So far (part 1) : Histogram definition Histogram equalization Now: Histogram statistics

50 The histogram shows the number of pixels having a certain gray-value
Remember: The histogram shows the number of pixels having a certain gray-value number of pixels grayvalue (0..1)

51 The sum of all values in the normalized histogram is 1.
Histograms The NORMALIZED histogram is the histogram divided by the total number of pixels in the source image. The sum of all values in the normalized histogram is 1. The value given by the normalized histogram for a certain gray value can be read as the probability of randomly picking a pixel having that gray value

52 What can the (normalized) histogram tell about the image ?
Histograms What can the (normalized) histogram tell about the image ?

53 The MEAN VALUE (or average gray level)
Histograms The MEAN VALUE (or average gray level) M = g g h(g) 1*0.3+2*0.1+3*0.2+4*0.1+5*0.2+6*0.1= 2.6 0.3 0.2 0.1 0.0

54 Histograms The MEAN value is the average gray value of the image, the ‘overall brightness appearance’.

55 The STANDARD DEVIATION
Histograms 2. The VARIANCE V = g (g-M)2 h(g) (with M = mean) or similar: The STANDARD DEVIATION D = sqrt(V)

56 Histograms VARIANCE gives a measure about the distribution of the histogram values around the mean. 0.3 0.2 0.1 0.0 0.3 0.2 0.1 0.0 V > V2

57 Histograms The STANDARD DEVIATION is a value on the gray level axis, showing the average distance of all pixels to the mean 0.3 0.2 0.1 0.0 0.3 0.2 0.1 0.0 D > D2

58 Histograms VARIANCE and STANDARD DEVIATION of the histogram tell us about the average contrast of the image ! The higher the VARIANCE (=the higher the STANDARD DEVIATION), the higher the image’s contrast !

59 Image and blurred version
Histograms Example: Image and blurred version

60 Histograms with MEAN and
STANDARD DEVIATION M= D=0.32 M=0.71 D=0.27

61 Design an autofocus system for a digital camera !
Histograms Exercise: Design an autofocus system for a digital camera ! The system should analyse an area in the middle of the picture and automatically adjust the lens such that this area is sharp.

62 …histograms can give us a first hint how to create image databases:
In between the basics… …histograms can give us a first hint how to create image databases:

63 Feature Based Coding Determine a feature-vector for a given image
Compare images by their feature-vectors Two operations need to be defined: a mapping of shape into the feature space and a similarity of feature vectors. Where are the histograms ? Representation Feature Extraction Vector Comparison

64 Feature Based Coding Determine a feature-vector for a given image
Compare images by their feature-vectors Two operations need to be defined: a mapping of shape into the feature space and a similarity of feature vectors. HERE ! Question: how can we compare histograms (vectors) ? Representation HISTOGRAM Histogram Comp.

65 Vector Comparison Vector Comparison ,

66 Vector Comparison

67 Vector Comparison

68 What’s the meaning of the Cosine Distance with respect to histograms ?
Vector Comparison What’s the meaning of the Cosine Distance with respect to histograms ? i.e.: what’s the consequence of eliminating the vector’s length information ?

69 More Vector Distances:
Vector Comparison More Vector Distances: Quadratic Form Distance Earth Movers Distance Proportional Transportation Distance

70 Histogram Intersection (non symmetric):
Vector Comparison Histogram Intersection (non symmetric): d(h1,h2) = 1 -  min(h1 ,h2 ) /  h1 Ex.: What could be a huge drawback of image comparison using histogram intersection ? i i i i i

71 Histograms Exercise: Outline an image database system, using statistical (histogram) information

72 Histograms Discussion: Which problems could occur if the database consists of the following images ?

73 Histograms

74 And now to something completely different …
Spatial Filtering End of histograms. And now to something completely different …


Download ppt "CIS 4350 Image ENHANCEMENT SPATIAL DOMAIN"

Similar presentations


Ads by Google