SlideShare a Scribd company logo
1 of 19
Digital Image Processing



          Image Enhancement
            (Spatial Filtering 1)


    Course Website: http://www.comp.dit.ie/bmacnamee
2
of
19
                  Neighbourhood Operations
     Neighbourhood operations simply operate
     on a larger neighbourhood of pixels than
     point operations      Origin                         x

     Neighbourhoods are
     mostly a rectangle
     around a central pixel
                                                          (x, y)
     Any size rectangle           Neighbourhood

     and any shape filter
     are possible
                           y             Image f (x, y)
3
of
19
        Simple Neighbourhood Operations
     Some simple neighbourhood operations
     include:
       – Min: Set the pixel value to the minimum in
         the neighbourhood
       – Max: Set the pixel value to the maximum in
         the neighbourhood
       – Median: The median value of a set of
         numbers is the midpoint value in that set (e.g.
         from the set [1, 7, 15, 18, 24] 15 is the
         median). Sometimes the median works better
         than the average
4
    of
                 Simple Neighbourhood Operations
    19                                 Example

    Original Image             x       Enhanced Image   x
     123 127 128 119 115 130

     140 145 148 153 167 172

     133 154 183 192 194 191

     194 199 207 210 198 195

     164 170 175 162 173 151


y                                  y
5
 of
 19
                     The Spatial Filtering Process
Origin                                     x
                                                 a    b   c          r     s      t
                                                 d
                                                 g
                                                      e
                                                      h
                                                           f
                                                           i
                                                                 *   u
                                                                     x
                                                                           v
                                                                           y
                                                                                  w
                                                                                  z
                                                Original Image           Filter
             Simple 3*3                             Pixels
                            e    3*3 Filter
         Neighbourhood
                                               eprocessed = v*e +
                                                            r*a + s*b + t*c +
                                                            u*d + w*f +
  y                       Image f (x, y)                    x*g + y*h + z*i

  The above is repeated for every pixel in the
  original image to generate the filtered image
6
                                                             of
                                                             19
                                                                      Spatial Filtering: Equation Form
                                                                                               a      b

                                                                                             ∑ ∑ w(s, t ) f ( x + s, y + t )
Images taken from Gonzalez & Woods, Digital Image Processing (2002)




                                                                              g ( x, y ) =
                                                                                             s = − at = − b


                                                                                        Filtering can be given
                                                                                        in equation form as
                                                                                        shown above
                                                                                        Notations are based
                                                                                        on the image shown
                                                                                        to the left
7
of
19
                     Smoothing Spatial Filters
     One of the simplest spatial filtering
     operations we can perform is a smoothing
     operation
       – Simply average all of the pixels in a
         neighbourhood around a central value
       – Especially useful
         in removing noise
                               1
                                /9   1
                                      /9    1
                                             /9
         from images                            Simple
                               1
                                /9   1
                                      /9    1
                                             /9 averaging
       – Also useful for
         highlighting gross                     filter
                               1
                                /9   1
                                      /9    1
                                             /9
         detail
8
 of
 19
                               Smoothing Spatial Filtering
Origin                                           x
                                                         104 100 108         1
                                                                                 /9    1
                                                                                           /9   1
                                                                                                    /9

                                                                         *       /9        /9       /9
                                                                             1         1        1
                                                          99 106 98

                                                          95   90   85       1
                                                                                 /9    1
                                                                                           /9   1
                                                                                                    /9
                          1
                           /9 1/9 1/9
                          104 100 108
                                                      Original Image                  Filter
             Simple 3*3   99 106 1/9
                          /9 1/9 98
                          1             3*3 Smoothing     Pixels
         Neighbourhood    95 1/9 1/9
                          /9 90 85
                          1             Filter
                                                     e = 1/9*106 +
                                                         1
                                                           /9*104 + 1/9*100 + 1/9*108 +
                                                         1
                                                           /9*99 + 1/9*98 +
  y                           Image f (x, y)             1
                                                           /9*95 + 1/9*90 + 1/9*85
                                                       = 98.3333
  The above is repeated for every pixel in the
  original image to generate the smoothed image
9
                                                             of
                                                             19
                                                                                     Image Smoothing Example
                                                                      The image at the top left
Images taken from Gonzalez & Woods, Digital Image Processing (2002)




                                                                      is an original image of
                                                                      size 500*500 pixels
                                                                      The subsequent images
                                                                      show the image after
                                                                      filtering with an averaging
                                                                      filter of increasing sizes
                                                                         – 3, 5, 9, 15 and 35
                                                                      Notice how detail begins
                                                                      to disappear
10
of
19
                   Weighted Smoothing Filters
     More effective smoothing filters can be
     generated by allowing different pixels in the
     neighbourhood different weights in the
     averaging function
        – Pixels closer to the
                                   1
                                       /16   /16
                                             2
                                                   /16
                                                   1


          central pixel are more
          important
                                   2
                                       /16   /16
                                             4
                                                   /16
                                                   2


        – Often referred to as a   1
                                       /16   /16
                                             2
                                                   /16
                                                   1
          weighted averaging
                                     Weighted
                                   averaging filter
11
                                                             of
                                                             19
                                                                                     Another Smoothing Example
                                                                      By smoothing the original image we get rid
Images taken from Gonzalez & Woods, Digital Image Processing (2002)




                                                                      of lots of the finer detail which leaves only
                                                                      the gross features for thresholding




                                                                          Original Image   Smoothed Image   Thresholded Image
12
                                                             of
                                                                                  Averaging Filter Vs. Median Filter
                                                             19                                           Example
Images taken from Gonzalez & Woods, Digital Image Processing (2002)




                                                                         Original Image     Image After      Image After
                                                                          With Noise      Averaging Filter   Median Filter

                                                                      Filtering is often used to remove noise from
                                                                      images
                                                                      Sometimes a median filter works better than
                                                                      an averaging filter
13
of
     Simple Neighbourhood Operations
19                         Example

                                     x
           123 127 128 119 115 130

           140 145 148 153 167 172

           133 154 183 192 194 191

           194 199 207 210 198 195

           164 170 175 162 173 151


       y
14
of
19
        Strange Things Happen At The Edges!

     At the edges of an image we are missing
     pixels to form a neighbourhood
              Origin                             x
                    e               e




                        e

                                            e




                    e       e               e
                y               Image f (x, y)
15
of
        Strange Things Happen At The Edges!
19                                  (cont…)
     There are a few approaches to dealing with
     missing edge pixels:
       – Omit missing pixels
          • Only works with some filters
          • Can add extra code and slow down processing
       – Pad the image
          • Typically with either all white or all black pixels
       – Replicate border pixels
       – Truncate the image
       – Allow pixels wrap around the image
          • Can cause some strange image artefacts
16
of
     Simple Neighbourhood Operations
19                         Example

                                     x
           123 127 128 119 115 130

           140 145 148 153 167 172

           133 154 183 192 194 191

           194 199 207 210 198 195

           164 170 175 162 173 151


       y
17
                                                             of
                                                                         Strange Things Happen At The Edges!
                                                             19                                      (cont…)
Images taken from Gonzalez & Woods, Digital Image Processing (2002)




                                                                                              Filtered Image:
                                                                                              Zero Padding




                                                                      Original                Filtered Image:
                                                                       Image                  Replicate Edge Pixels




                                                                                              Filtered Image:
                                                                                              Wrap Around Edge Pixels
18
of
19
                            Correlation & Convolution
     The filtering we have been talking about so
     far is referred to as correlation with the filter
     itself referred to as the correlation kernel
     Convolution is a similar operation, with just
     one subtle difference
        a    b   c          r     s      t   eprocessed = v*e +
        d
         f
             e
             g
                 e
                 h
                        *   u
                            x
                                  v
                                  y
                                         w
                                         z
                                                          z*a + y*b + x*c +
                                                          w*d + u*e +
                                                          t*f + s*g + r*h
       Original Image           Filter
           Pixels

     For symmetric filters it makes no difference
19
of
19
                                          Summary
     In this lecture we have looked at the idea of
     spatial filtering and in particular:
        – Neighbourhood operations
        – The filtering process
        – Smoothing filters
        – Dealing with problems at image edges when
          using filtering
        – Correlation and convolution
     Next time we will looking at sharpening
     filters and more on filtering and image
     enhancement

More Related Content

What's hot

Digital Image Processing: Image Segmentation
Digital Image Processing: Image SegmentationDigital Image Processing: Image Segmentation
Digital Image Processing: Image SegmentationMostafa G. M. Mostafa
 
Image Restoration
Image RestorationImage Restoration
Image RestorationPoonam Seth
 
Image Enhancement using Frequency Domain Filters
Image Enhancement using Frequency Domain FiltersImage Enhancement using Frequency Domain Filters
Image Enhancement using Frequency Domain FiltersKarthika Ramachandran
 
Edge Detection algorithm and code
Edge Detection algorithm and codeEdge Detection algorithm and code
Edge Detection algorithm and codeVaddi Manikanta
 
Image Processing: Spatial filters
Image Processing: Spatial filtersImage Processing: Spatial filters
Image Processing: Spatial filtersA B Shinde
 
Image segmentation
Image segmentationImage segmentation
Image segmentationkhyati gupta
 
BASICS OF DIGITAL IMAGE PROCESSING,MARIA PETROU
BASICS OF DIGITAL IMAGE PROCESSING,MARIA PETROUBASICS OF DIGITAL IMAGE PROCESSING,MARIA PETROU
BASICS OF DIGITAL IMAGE PROCESSING,MARIA PETROUanjunarayanan
 
06 spatial filtering DIP
06 spatial filtering DIP06 spatial filtering DIP
06 spatial filtering DIPbabak danyal
 
Boundary Extraction
Boundary ExtractionBoundary Extraction
Boundary ExtractionMaria Akther
 
COM2304: Intensity Transformation and Spatial Filtering – I (Intensity Transf...
COM2304: Intensity Transformation and Spatial Filtering – I (Intensity Transf...COM2304: Intensity Transformation and Spatial Filtering – I (Intensity Transf...
COM2304: Intensity Transformation and Spatial Filtering – I (Intensity Transf...Hemantha Kulathilake
 
Image feature extraction
Image feature extractionImage feature extraction
Image feature extractionRishabh shah
 
Image Representation & Descriptors
Image Representation & DescriptorsImage Representation & Descriptors
Image Representation & DescriptorsPundrikPatel
 
Image processing second unit Notes
Image processing second unit NotesImage processing second unit Notes
Image processing second unit NotesAAKANKSHA JAIN
 
Chapter 3 image enhancement (spatial domain)
Chapter 3 image enhancement (spatial domain)Chapter 3 image enhancement (spatial domain)
Chapter 3 image enhancement (spatial domain)asodariyabhavesh
 

What's hot (20)

Digital Image Processing: Image Segmentation
Digital Image Processing: Image SegmentationDigital Image Processing: Image Segmentation
Digital Image Processing: Image Segmentation
 
Image Restoration
Image RestorationImage Restoration
Image Restoration
 
Image Enhancement using Frequency Domain Filters
Image Enhancement using Frequency Domain FiltersImage Enhancement using Frequency Domain Filters
Image Enhancement using Frequency Domain Filters
 
Edge Detection algorithm and code
Edge Detection algorithm and codeEdge Detection algorithm and code
Edge Detection algorithm and code
 
Image compression .
Image compression .Image compression .
Image compression .
 
image compression ppt
image compression pptimage compression ppt
image compression ppt
 
Module 31
Module 31Module 31
Module 31
 
Image Processing: Spatial filters
Image Processing: Spatial filtersImage Processing: Spatial filters
Image Processing: Spatial filters
 
Chapter 5
Chapter 5Chapter 5
Chapter 5
 
Image segmentation
Image segmentationImage segmentation
Image segmentation
 
BASICS OF DIGITAL IMAGE PROCESSING,MARIA PETROU
BASICS OF DIGITAL IMAGE PROCESSING,MARIA PETROUBASICS OF DIGITAL IMAGE PROCESSING,MARIA PETROU
BASICS OF DIGITAL IMAGE PROCESSING,MARIA PETROU
 
IMAGE SEGMENTATION.
IMAGE SEGMENTATION.IMAGE SEGMENTATION.
IMAGE SEGMENTATION.
 
06 spatial filtering DIP
06 spatial filtering DIP06 spatial filtering DIP
06 spatial filtering DIP
 
Boundary Extraction
Boundary ExtractionBoundary Extraction
Boundary Extraction
 
COM2304: Intensity Transformation and Spatial Filtering – I (Intensity Transf...
COM2304: Intensity Transformation and Spatial Filtering – I (Intensity Transf...COM2304: Intensity Transformation and Spatial Filtering – I (Intensity Transf...
COM2304: Intensity Transformation and Spatial Filtering – I (Intensity Transf...
 
Image feature extraction
Image feature extractionImage feature extraction
Image feature extraction
 
Image Representation & Descriptors
Image Representation & DescriptorsImage Representation & Descriptors
Image Representation & Descriptors
 
Image processing second unit Notes
Image processing second unit NotesImage processing second unit Notes
Image processing second unit Notes
 
Image segmentation
Image segmentationImage segmentation
Image segmentation
 
Chapter 3 image enhancement (spatial domain)
Chapter 3 image enhancement (spatial domain)Chapter 3 image enhancement (spatial domain)
Chapter 3 image enhancement (spatial domain)
 

Viewers also liked

Spatial filtering using image processing
Spatial filtering using image processingSpatial filtering using image processing
Spatial filtering using image processingAnuj Arora
 
Image enhancement techniques
Image enhancement techniquesImage enhancement techniques
Image enhancement techniquessakshij91
 
Image enhancement
Image enhancementImage enhancement
Image enhancementAyaelshiwi
 
COM2304: Intensity Transformation and Spatial Filtering – III Spatial Filters...
COM2304: Intensity Transformation and Spatial Filtering – III Spatial Filters...COM2304: Intensity Transformation and Spatial Filtering – III Spatial Filters...
COM2304: Intensity Transformation and Spatial Filtering – III Spatial Filters...Hemantha Kulathilake
 
Image Enhancement in Spatial Domain
Image Enhancement in Spatial DomainImage Enhancement in Spatial Domain
Image Enhancement in Spatial DomainDEEPASHRI HK
 
Image enhancement techniques
Image enhancement techniquesImage enhancement techniques
Image enhancement techniquesSaideep
 
Smoothing Filters in Spatial Domain
Smoothing Filters in Spatial DomainSmoothing Filters in Spatial Domain
Smoothing Filters in Spatial DomainMadhu Bala
 
Enhancement in spatial domain
Enhancement in spatial domainEnhancement in spatial domain
Enhancement in spatial domainAshish Kumar
 

Viewers also liked (10)

Spatial filtering using image processing
Spatial filtering using image processingSpatial filtering using image processing
Spatial filtering using image processing
 
SPATIAL FILTER
SPATIAL FILTERSPATIAL FILTER
SPATIAL FILTER
 
Unit3 dip
Unit3 dipUnit3 dip
Unit3 dip
 
Image enhancement techniques
Image enhancement techniquesImage enhancement techniques
Image enhancement techniques
 
Image enhancement
Image enhancementImage enhancement
Image enhancement
 
COM2304: Intensity Transformation and Spatial Filtering – III Spatial Filters...
COM2304: Intensity Transformation and Spatial Filtering – III Spatial Filters...COM2304: Intensity Transformation and Spatial Filtering – III Spatial Filters...
COM2304: Intensity Transformation and Spatial Filtering – III Spatial Filters...
 
Image Enhancement in Spatial Domain
Image Enhancement in Spatial DomainImage Enhancement in Spatial Domain
Image Enhancement in Spatial Domain
 
Image enhancement techniques
Image enhancement techniquesImage enhancement techniques
Image enhancement techniques
 
Smoothing Filters in Spatial Domain
Smoothing Filters in Spatial DomainSmoothing Filters in Spatial Domain
Smoothing Filters in Spatial Domain
 
Enhancement in spatial domain
Enhancement in spatial domainEnhancement in spatial domain
Enhancement in spatial domain
 

More from Gichelle Amon (20)

Kerberos
KerberosKerberos
Kerberos
 
Network security
Network securityNetwork security
Network security
 
Os module 2 d
Os module 2 dOs module 2 d
Os module 2 d
 
Os module 2 c
Os module 2 cOs module 2 c
Os module 2 c
 
Image segmentation ppt
Image segmentation pptImage segmentation ppt
Image segmentation ppt
 
Lec3 final
Lec3 finalLec3 final
Lec3 final
 
Lec 3
Lec 3Lec 3
Lec 3
 
Lec2 final
Lec2 finalLec2 final
Lec2 final
 
Lec 4
Lec 4Lec 4
Lec 4
 
Lec1 final
Lec1 finalLec1 final
Lec1 final
 
Module 3 law of contracts
Module 3  law of contractsModule 3  law of contracts
Module 3 law of contracts
 
Transport triggered architecture
Transport triggered architectureTransport triggered architecture
Transport triggered architecture
 
Time triggered arch.
Time triggered arch.Time triggered arch.
Time triggered arch.
 
Subnetting
SubnettingSubnetting
Subnetting
 
Os module 2 c
Os module 2 cOs module 2 c
Os module 2 c
 
Os module 2 ba
Os module 2 baOs module 2 ba
Os module 2 ba
 
Lec5
Lec5Lec5
Lec5
 
Delivery
DeliveryDelivery
Delivery
 
Addressing
AddressingAddressing
Addressing
 
6 spatial filtering p2
6 spatial filtering p26 spatial filtering p2
6 spatial filtering p2
 

Recently uploaded

microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxcallscotland1987
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Association for Project Management
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 

Recently uploaded (20)

microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 

5 spatial filtering p1

  • 1. Digital Image Processing Image Enhancement (Spatial Filtering 1) Course Website: http://www.comp.dit.ie/bmacnamee
  • 2. 2 of 19 Neighbourhood Operations Neighbourhood operations simply operate on a larger neighbourhood of pixels than point operations Origin x Neighbourhoods are mostly a rectangle around a central pixel (x, y) Any size rectangle Neighbourhood and any shape filter are possible y Image f (x, y)
  • 3. 3 of 19 Simple Neighbourhood Operations Some simple neighbourhood operations include: – Min: Set the pixel value to the minimum in the neighbourhood – Max: Set the pixel value to the maximum in the neighbourhood – Median: The median value of a set of numbers is the midpoint value in that set (e.g. from the set [1, 7, 15, 18, 24] 15 is the median). Sometimes the median works better than the average
  • 4. 4 of Simple Neighbourhood Operations 19 Example Original Image x Enhanced Image x 123 127 128 119 115 130 140 145 148 153 167 172 133 154 183 192 194 191 194 199 207 210 198 195 164 170 175 162 173 151 y y
  • 5. 5 of 19 The Spatial Filtering Process Origin x a b c r s t d g e h f i * u x v y w z Original Image Filter Simple 3*3 Pixels e 3*3 Filter Neighbourhood eprocessed = v*e + r*a + s*b + t*c + u*d + w*f + y Image f (x, y) x*g + y*h + z*i The above is repeated for every pixel in the original image to generate the filtered image
  • 6. 6 of 19 Spatial Filtering: Equation Form a b ∑ ∑ w(s, t ) f ( x + s, y + t ) Images taken from Gonzalez & Woods, Digital Image Processing (2002) g ( x, y ) = s = − at = − b Filtering can be given in equation form as shown above Notations are based on the image shown to the left
  • 7. 7 of 19 Smoothing Spatial Filters One of the simplest spatial filtering operations we can perform is a smoothing operation – Simply average all of the pixels in a neighbourhood around a central value – Especially useful in removing noise 1 /9 1 /9 1 /9 from images Simple 1 /9 1 /9 1 /9 averaging – Also useful for highlighting gross filter 1 /9 1 /9 1 /9 detail
  • 8. 8 of 19 Smoothing Spatial Filtering Origin x 104 100 108 1 /9 1 /9 1 /9 * /9 /9 /9 1 1 1 99 106 98 95 90 85 1 /9 1 /9 1 /9 1 /9 1/9 1/9 104 100 108 Original Image Filter Simple 3*3 99 106 1/9 /9 1/9 98 1 3*3 Smoothing Pixels Neighbourhood 95 1/9 1/9 /9 90 85 1 Filter e = 1/9*106 + 1 /9*104 + 1/9*100 + 1/9*108 + 1 /9*99 + 1/9*98 + y Image f (x, y) 1 /9*95 + 1/9*90 + 1/9*85 = 98.3333 The above is repeated for every pixel in the original image to generate the smoothed image
  • 9. 9 of 19 Image Smoothing Example The image at the top left Images taken from Gonzalez & Woods, Digital Image Processing (2002) is an original image of size 500*500 pixels The subsequent images show the image after filtering with an averaging filter of increasing sizes – 3, 5, 9, 15 and 35 Notice how detail begins to disappear
  • 10. 10 of 19 Weighted Smoothing Filters More effective smoothing filters can be generated by allowing different pixels in the neighbourhood different weights in the averaging function – Pixels closer to the 1 /16 /16 2 /16 1 central pixel are more important 2 /16 /16 4 /16 2 – Often referred to as a 1 /16 /16 2 /16 1 weighted averaging Weighted averaging filter
  • 11. 11 of 19 Another Smoothing Example By smoothing the original image we get rid Images taken from Gonzalez & Woods, Digital Image Processing (2002) of lots of the finer detail which leaves only the gross features for thresholding Original Image Smoothed Image Thresholded Image
  • 12. 12 of Averaging Filter Vs. Median Filter 19 Example Images taken from Gonzalez & Woods, Digital Image Processing (2002) Original Image Image After Image After With Noise Averaging Filter Median Filter Filtering is often used to remove noise from images Sometimes a median filter works better than an averaging filter
  • 13. 13 of Simple Neighbourhood Operations 19 Example x 123 127 128 119 115 130 140 145 148 153 167 172 133 154 183 192 194 191 194 199 207 210 198 195 164 170 175 162 173 151 y
  • 14. 14 of 19 Strange Things Happen At The Edges! At the edges of an image we are missing pixels to form a neighbourhood Origin x e e e e e e e y Image f (x, y)
  • 15. 15 of Strange Things Happen At The Edges! 19 (cont…) There are a few approaches to dealing with missing edge pixels: – Omit missing pixels • Only works with some filters • Can add extra code and slow down processing – Pad the image • Typically with either all white or all black pixels – Replicate border pixels – Truncate the image – Allow pixels wrap around the image • Can cause some strange image artefacts
  • 16. 16 of Simple Neighbourhood Operations 19 Example x 123 127 128 119 115 130 140 145 148 153 167 172 133 154 183 192 194 191 194 199 207 210 198 195 164 170 175 162 173 151 y
  • 17. 17 of Strange Things Happen At The Edges! 19 (cont…) Images taken from Gonzalez & Woods, Digital Image Processing (2002) Filtered Image: Zero Padding Original Filtered Image: Image Replicate Edge Pixels Filtered Image: Wrap Around Edge Pixels
  • 18. 18 of 19 Correlation & Convolution The filtering we have been talking about so far is referred to as correlation with the filter itself referred to as the correlation kernel Convolution is a similar operation, with just one subtle difference a b c r s t eprocessed = v*e + d f e g e h * u x v y w z z*a + y*b + x*c + w*d + u*e + t*f + s*g + r*h Original Image Filter Pixels For symmetric filters it makes no difference
  • 19. 19 of 19 Summary In this lecture we have looked at the idea of spatial filtering and in particular: – Neighbourhood operations – The filtering process – Smoothing filters – Dealing with problems at image edges when using filtering – Correlation and convolution Next time we will looking at sharpening filters and more on filtering and image enhancement