Image Processing
DTU Electrical Engineering
Copyright By PowCoder代写 加微信 powcoder
• What is Image Processing?
• Linear Filtering
• Non-linear Filters / Thresholding • Morphology
• Connected Components Analysis
DTU Electrical Engineering
• What is Image Processing?
• Linear Filtering
• Non-linear Filters / Thresholding • Morphology
• Connected Components Analysis
DTU Electrical Engineering
What is Image Processing?
• Image processing is:
– the operations we perform on an image to change or enhance it and make it suitable for further analysis,
– so that useful information can be highlighted or get extracted from it.
DTU Electrical Engineering
• What is Image Processing?
• Linear Filtering
• Non-linear Filters / Thresholding • Morphology
• Connected Components Analysis
DTU Electrical Engineering
• Pinhole model
DTU Electrical Engineering
• Image Formation
credtis: I
DTU Electrical Engineering
• What is a (digital) image?
– an image is a matrix/table (descritized 2D space)
– each cell can take discrete/integer values (quantized sample values)
DTU Electrical Engineering
In a computer…
• What is a (digital) image?
– an image is a matrix/table (descritized 2D space)
– each cell can take discrete/integer values (quantized sample values)
an image is a 2 dimensional table of num
DTU Electrical Engineering
• Color Images
– Filter Array
credtis: I
DTU Electrical Engineering
• Color Images
– Filter Array
Reproduce full RGB
credtis: I
DTU Electrical Engineering
• Color Images
– are composed of 3 2D images: R(x,y), G(x,y), B(x,y)
– Each pixel (x,y) of these 3 images consists of values between 0 and 255
– The values of a specific pixel (x1,y1) in the 3 images R, G, B describe the red-ness, green-ness and blue-ness of that particular pixel.
DTU Electrical Engineering
• Color Images
– are composed of 3 2D images: R(x,y), G(x,y), B(x,y)
– Each pixel (x,y) of these 3 images consists of values between 0 and 255
– The values of a specific pixel (x1,y1) in the 3 images R, G, B describe the red-ness, green-ness and blue-ness of that particular pixel.
DTU Electrical Engineering
• RGB Color Space
– all colors can be reproduced by mixing Red, Green and Blue
DTU Electrical Engineering
HSI Color Space
• Many other Color Spaces existe.g. L*a*b* color space
• or HSI/HSV Color spaces
• Perhaps the most intuitive color representation
DTU Electrical Engineering
• What is Image Processing?
• Linear Filtering
• Non-linear Filters / Thresholding • Morphology
• Connected Components Analysis
DTU Electrical Engineering
Linear Filtering
• What are Linear Filters in Image Processing? • What are they used for?
DTU Electrical Engineering
Noise reduction
• Nearby pixels are likely to belong to same object – thus likely to have similar color
• Replace each pixel by average of neighbors
DTU Electrical Engineering Slide from:
Mean filtering
(0 + 0 + 0 + 10 + 40 + 0 + 10 + 0 + 0)/9 = 6.66
DTU Electrical Engineering Slide from:
Mean filtering
(0 + 0 + 0 + 0 + 0 + 10 + 0 + 0 + 0 + 0 + 20 + 10 + 40 + 0 + 0 + 20 + 10 + 0 + 0 + 0 + 30 + 20 + 10 + 0 + 0)/25 = 6.8
DTU Electrical Engineering Slide from:
Mean filtering
(0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 10)/9 = 1.11
DTU Electrical Engineering Slide from:
Mean filtering
(0 + 0 + 0 + 0 + 0 + 10 + 0 + 10 + 20)/9 = 4.44
DTU Electrical Engineering Slide from:
Mean filtering
(0 + 0 + 0 + 0 + 10 + 10 + 10 + 20 + 20)/9 = 7.77
DTU Electrical Engineering Slide from:
Mean filtering
DTU Electrical Engineering Slide from:
Noise reduction using mean filtering
DTU Electrical Engineering Slide from:
• Filtering
– Form a new image whose pixels are a combination of the original pixels
– To get useful information from images
• E.g., extract edges or contours (to understand shape)
– To enhance the image
• E.g., to blur to remove noise
• E.g., to sharpen to “enhance image” a la CSI
DTU Electrical Engineering Slide from:
Mean filtering
• Replace pixel by mean of neighborhood
Local image data Modified image data f S[f]
S[f](m, n) = f(m + i, n + j)/9
DTU Electrical Engineering i= 1 j= 1 Slide from:
A more general version
S[f](m, n) =
X1 X1 i= 1 j= 1
w(i, j)f(m + i, n + j)
Local image data
Kernel / filter
DTU Electrical Engineering Slide from:
A more general version
Local image data
Kernel size = 2k+1
S[f](m, n) =
w(i, j)f(m + i, n + j)
DTU Electrical Engineering Slide from:
A more general version
i= k j= k • w(i,j) = 1/(2k+1)2 for mean filter
• If w(i,j) >=0 and sum to 1, weighted mean • But w(i,j) can be arbitrary real numbers!
S[f](m, n) =
w(i, j)f(m + i, n + j)
DTU Electrical Engineering Slide from:
Convolution and cross-correlation
• Cross correlation
S [ f ] = w ⌦ f S[f](m, n) =
• Convolution
S [ f ] = w ⇤ f S[f](m, n) =
w(i, j)f(m + i, n + j)
w(i, j)f(m i, n j)
DTU Electrical Engineering Slide from:
Cross-correlation
1*1 + 2*2 + 3*3 + 4*4 + 5*5 + 6*6 + 7*7 + 8*8 + 9*9
DTU Electrical Engineering Slide from:
Convolution
1*9 + 2*8 + 3*7 + 4*6 + 5*5 + 6*4 + 7*3 + 8*2 + 9*1
DTU Electrical Engineering Slide from:
Convolution
DTU Electrical Engineering Slide from:
Filters: examples
Blur (with a mean filter) (g)
Original (f)
Kernel (k)
DTU Electrical Engineering
Source: D. : examples
Original (f)
Kernel (k)
Identical image (g)
DTU Electrical Engineering
Source: D.
DTU Electrical Engineering
Source: D.
• What does blurring take away?
Let’s add it back: +α
DTU Electrical Engineering Slide from:
Sharpening
DTU Electrical Engineering Slide from:
Sharpening
• What does blurring take away?
Let’s add it back: +α
DTU Electrical Engineering Slide from:
Sharpening
fsharp = f + ↵(f fblur) = (1 + ↵)f ↵fblur
= (1 + ↵)(w ⇤ f) ↵(v ⇤ f)
= ((1 + ↵)w ↵v) ⇤ f
DTU Electrical Engineering Slide from:
Sharpening filter
Sharpening filter
(accentuates edges)
DTU Electrical Engineering
Source: D.
• What is Image Processing?
• Linear Filtering
• Non-linear Filters / Thresholding • Morphology
• Connected Components Analysis
DTU Electrical Engineering
Non-linear filters: Thresholding
DTU Electrical Engineering Slide from:
Non-linear filters: Thresholding
• What if Threshold could be adaptive (instead of a pre-defined value)? – Otsu’s method performs automatic image thresholding
• The algorithm exhaustively searches for the threshold that minimizes the intra-class variance, defined as a weighted sum of variances of the two classes
DTU Electrical Engineering Source: https://en.wikipedia.org/wiki/Otsu%27s_method
Non-linear filters: Rectification
• g(m,n) = max(f(m,n), 0)
• Crucial component of modern convolutional networks
DTU Electrical Engineering Slide from:
Non-linear filters
• Sometimes mean filtering does not work
DTU Electrical Engineering Slide from:
Non-linear filters
• Sometimes mean filtering does not work
DTU Electrical Engineering Slide from:
Non-linear filters
• Mean is sensitive to outliers
• Median filter: Replace pixel by median of neighbors
DTU Electrical Engineering Slide from:
Non-linear filters
DTU Electrical Engineering Slide from:
• What is Image Processing?
• Linear Filtering
• Non-linear Filters / Thresholding • Morphology
• Connected Components Analysis
DTU Electrical Engineering
Morphology
• The most common binary image operations are called Morphological Operations
• Basic Morphological Operations: • Erosion
• Dilation • Opening • Closing
– All of them rely on convolution with a Structuring Element
» The Structuring Element can be a disk, rectangle, or of any other shape.
• There are also Grayscale Morphological Operations, apart from Binary ones.
DTU Electrical Engineering
Morphology
• The most common binary image operations are called Morphological Operations
• Basic Morphological Operations: • Erosion
DTU Electrical Engineering Source:https://en.wikipedia.org/wiki/Mathematical_morphology
Morphology
• The most common binary image operations are called Morphological Operations
• Basic Morphological Operations: • Dilation
DTU Electrical Engineering Source:https://en.wikipedia.org/wiki/Mathematical_morphology
Morphology
• The most common binary image operations are called Morphological Operations
• Basic Morphological Operations:
• Opening = Erosion and then Dilation
» Morphological opening is useful for removing small objects from an image while preserving the shape and size of larger objects in the image.
DTU Electrical Engineering Source:https://se.mathworks.com/help/images/morphological-dilation-and-erosion.html
Morphology
• The most common binary image operations are called Morphological Operations
• Basic Morphological Operations:
• Closing = Dilation and then Erosion
» Morphological closing is useful for filling small holes from an image while preserving the shape and size of the objects in the image.
DTU Electrical Engineering Source:https://se.mathworks.com/help/images/morphological-dilation-and-erosion.html
• What is Image Processing?
• Linear Filtering
• Non-linear Filters / Thresholding • Morphology
• Connected Components Analysis
DTU Electrical Engineering
Connected Components Analysis
• Connencted Component Analysis checks each pixel of an image for connectivity with its neighboring pixels.
• Each group of connected pixels are considered as one component and are assigned the same label.
• Connectivity is established if two neighboring pixels share same or similar intensity/color value.
• The method works both binary. grayscale, or color images
• Different measures of connectivity arone possible (4-connectivity, or 8-connectivity are typical)
DTU Electrical Engineering
• We discussed about what Image Processing is.
• We learned about : • Color
– RGB, other Color Spaces • Linear Filtering
– convolution, cross-corelation
• Non-linear Filters / Thresholding • Morphology
• Connected Components Analysis
DTU Electrical Engineering
Image Processing
DTU Electrical Engineering
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com