SlideShare a Scribd company logo
1 of 31
OpenCV
Blurring and
sharpening of
images
Edge detection
algorithms.
Blurring and sharpening of images
• This segment is about the blurring and sharpening of the images.
• For this we are going to create a customized filter/kernel for blurring and
sharpening separately.
• These filters are nothing but an array of numbers.
• The numbers in the array of the filter determine the operation to be performed.
• The input image is nothing but an array of numbers.
• The numbers indicate the colour intensity of the pixels in the input image.
Contd…
• Any color in the universe can be expressed within 0 to 255 where 0 refers to black
and 255 refers to white.
• As a matter of fact, the grayscale images are two dimensional images since they
contain height and width only.
• Whereas the color images are three dimensional images since they contain height,
width and color channels. (BGR in the case of OpenCV).
• So an image is nothing but an array of numbers.
• The filter which we have assigned is also an array of numbers.
Convolution
• Hence there is an array operation that is going to take place when we apply a
kernel to an image.
• The operation is known as convolution which is indicated by the *.
• The convolution is the combination of addition and multiplication.
• First, there is a matrix multiplication between the image and the kernel.
• Then the product of all the values are then added to produce the final answer.
• In one way, the convolution operation reduces the dimension of the image.
Filter
• So the numbers present in the filter play a major role in determining the operation.
• To obtain a black image using filters, we can use the array filled with zeros.
• Zero multiplied with anything is zero and their sum is zero.
• The resultant is a zero and hence we obtain a black image.
• Similarly, there are other filters for other operations.
• We can play with the numbers in the filters to see how the output image looks like.
Black image using filter
Filter for blurring
• The process of blurring is to make the details less clearer or to diminish the
intensity.
• This can be done by taking the average of the surrounding pixels and replacing it in
the original place.
• So the 3*3 filter for performing blurring operation looks like
• 1/9, 1/9, 1/9
• 1/9, 1/9, 1/9
• 1/9, 1/9, 1/9
Function
• This filter is made by using the array function from the numpy library.
• Then we have to mention two square brackets since the array is 2-D in nature.The
dimensions for the array and the elements to be filled are upto the choice of the user.
• The dimension determines the frequency of convolution (large dimension means lesser
times) and the numbers determine the operation.
• Finally the filter2D function in OpenCV is used to implement our customized filter.
• The first argument is the image location, the second is an number of -1 and the third is our
kernel.
Blurring of image
Sharpening of images
• Image sharpening refers to any enhancement technique that highlights edges and fine
details in an image.
• Image sharpening is widely used in printing and photographic industries for increasing the
local contrast and sharpening the images.
• The filter used here is given below:-
• 0,-1,0
• -1,n,-1
• 0,-1,0
• The value n determines the amplitude of the sharpening.
Sharpening of images
Magnitudes of sharpening
• Higher value
• Lower value
Alternate for blurring
• The blurring done before was fixed.
• So to overcome this disadvantage and to make it variable we use a function called Gaussian Blur.
• The blurring is done by the gaussian function which is mathematical.
• The first argument is the location of the image.
• The second argument is the kernel range. It is important to give an odd and equal value like (3,3)
or (5,5) etc.
• The third argument is a number ranging from 0 to 1. 1 gives a clear image despite the kernel
applied.
• There are two other types of blurring called the median and bilateral blurring.
Gaussian Blurring
Intensities of gaussian blurring
Effect of 1 on gaussian blur
• Blurring without 1 • Blurring with 1
Median blurring
Bilateral blurring
Edge detection-canny
• Edge detection is a technique of image processing used to identify points in a
digital image with discontinuities.
• It sharps the changes in the image brightness.These points where the image
brightness varies sharply are called the edges (or boundaries) of the image.
• The edge detection method used here is called as canny edge detection.
• It is essential that we use grayscale images to lower the computations.
• There are two threshold values in the canny function.
Canny edge detection
Effect of threshold
• More threshold
Sobel edge detection
• Another method for edge detection available in OpenCV is the sobel
method.
• This is also known as Sobel-Feldman operator or Sobel filter.
• By changing the dx and dy values we can get sobel features for x and y axes
separately.
Sobel on x-axis only
Sobel on y-axis only
Combined sobel image
Prewitt edge detection
• The third edge detection method is called as the prewitt method.
• This method uses specified filters for x and y axis and we have to manually
combine them.
Dilated image
Eroded image
Dilated image combined with canny edge
Eroded image combined with canny edge
OpenCV presentation series- part 4

More Related Content

What's hot

Muzammil Abdulrahman PPT On Gabor Wavelet Transform (GWT) Based Facial Expres...
Muzammil Abdulrahman PPT On Gabor Wavelet Transform (GWT) Based Facial Expres...Muzammil Abdulrahman PPT On Gabor Wavelet Transform (GWT) Based Facial Expres...
Muzammil Abdulrahman PPT On Gabor Wavelet Transform (GWT) Based Facial Expres...Petroleum Training Institute
 
Morphological image processing
Morphological image processingMorphological image processing
Morphological image processingVinayak Narayanan
 
Contrast enhancement in digital images
Contrast enhancement in digital imagesContrast enhancement in digital images
Contrast enhancement in digital imagesSakher BELOUADAH
 
Image enhancement ppt nal2
Image enhancement ppt nal2Image enhancement ppt nal2
Image enhancement ppt nal2Surabhi Ks
 
COM2304: Morphological Image Processing
COM2304: Morphological Image ProcessingCOM2304: Morphological Image Processing
COM2304: Morphological Image ProcessingHemantha Kulathilake
 
Image Texture Analysis
Image Texture AnalysisImage Texture Analysis
Image Texture Analysislalitxp
 
Image enhancement
Image enhancementImage enhancement
Image enhancementAyaelshiwi
 
Point processing
Point processingPoint processing
Point processingpanupriyaa7
 
Digital Image Fundamentals
Digital Image FundamentalsDigital Image Fundamentals
Digital Image FundamentalsKalyan Acharjya
 
Image enhancement
Image enhancementImage enhancement
Image enhancementvsaranya169
 
5. gray level transformation
5. gray level transformation5. gray level transformation
5. gray level transformationMdFazleRabbi18
 
Morphology in graphics and image processing
Morphology in graphics and image processingMorphology in graphics and image processing
Morphology in graphics and image processingDheeban Smart
 
Image Representation & Descriptors
Image Representation & DescriptorsImage Representation & Descriptors
Image Representation & DescriptorsPundrikPatel
 
Comparative study on image segmentation techniques
Comparative study on image segmentation techniquesComparative study on image segmentation techniques
Comparative study on image segmentation techniquesgmidhubala
 
Chapter 9 morphological image processing
Chapter 9 morphological image processingChapter 9 morphological image processing
Chapter 9 morphological image processingasodariyabhavesh
 

What's hot (20)

4 image enhancement in spatial domain
4 image enhancement in spatial domain4 image enhancement in spatial domain
4 image enhancement in spatial domain
 
Muzammil Abdulrahman PPT On Gabor Wavelet Transform (GWT) Based Facial Expres...
Muzammil Abdulrahman PPT On Gabor Wavelet Transform (GWT) Based Facial Expres...Muzammil Abdulrahman PPT On Gabor Wavelet Transform (GWT) Based Facial Expres...
Muzammil Abdulrahman PPT On Gabor Wavelet Transform (GWT) Based Facial Expres...
 
Morphological image processing
Morphological image processingMorphological image processing
Morphological image processing
 
Contrast enhancement in digital images
Contrast enhancement in digital imagesContrast enhancement in digital images
Contrast enhancement in digital images
 
Image enhancement ppt nal2
Image enhancement ppt nal2Image enhancement ppt nal2
Image enhancement ppt nal2
 
COM2304: Morphological Image Processing
COM2304: Morphological Image ProcessingCOM2304: Morphological Image Processing
COM2304: Morphological Image Processing
 
Image Texture Analysis
Image Texture AnalysisImage Texture Analysis
Image Texture Analysis
 
Image enhancement
Image enhancementImage enhancement
Image enhancement
 
Point processing
Point processingPoint processing
Point processing
 
Image segmentation
Image segmentationImage segmentation
Image segmentation
 
Digital Image Fundamentals
Digital Image FundamentalsDigital Image Fundamentals
Digital Image Fundamentals
 
Image enhancement
Image enhancementImage enhancement
Image enhancement
 
Image enhancement
Image enhancementImage enhancement
Image enhancement
 
5. gray level transformation
5. gray level transformation5. gray level transformation
5. gray level transformation
 
Morphology in graphics and image processing
Morphology in graphics and image processingMorphology in graphics and image processing
Morphology in graphics and image processing
 
Image Representation & Descriptors
Image Representation & DescriptorsImage Representation & Descriptors
Image Representation & Descriptors
 
Comparative study on image segmentation techniques
Comparative study on image segmentation techniquesComparative study on image segmentation techniques
Comparative study on image segmentation techniques
 
COM2304: Color and Color Models
COM2304: Color and Color ModelsCOM2304: Color and Color Models
COM2304: Color and Color Models
 
Chapter 9 morphological image processing
Chapter 9 morphological image processingChapter 9 morphological image processing
Chapter 9 morphological image processing
 
Image enhancement
Image enhancementImage enhancement
Image enhancement
 

Similar to OpenCV presentation series- part 4

Digital image processing techniques
Digital image processing techniquesDigital image processing techniques
Digital image processing techniquesShab Bi
 
Object detection at night
Object detection at nightObject detection at night
Object detection at nightSanjay Crúzé
 
1 [Autosaved].pptx
1 [Autosaved].pptx1 [Autosaved].pptx
1 [Autosaved].pptxSsdSsd5
 
12-Image enhancement and filtering.ppt
12-Image enhancement and filtering.ppt12-Image enhancement and filtering.ppt
12-Image enhancement and filtering.pptAJAYMALIK97
 
Image enhancement techniques
Image enhancement techniquesImage enhancement techniques
Image enhancement techniquesBulbul Agrawal
 
image enhancement image enhancement imag
image enhancement image enhancement imagimage enhancement image enhancement imag
image enhancement image enhancement imagNaveenKumar5162
 
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
 
Digital image processing ppt
Digital image processing pptDigital image processing ppt
Digital image processing pptkhanam22
 
Image processing sw & hw
Image processing sw & hwImage processing sw & hw
Image processing sw & hwamalalhait
 
Image enhancement
Image enhancementImage enhancement
Image enhancementKuppusamy P
 
Ch2
Ch2Ch2
Ch2teba
 

Similar to OpenCV presentation series- part 4 (20)

Digital image processing techniques
Digital image processing techniquesDigital image processing techniques
Digital image processing techniques
 
Digital image processing
Digital image processingDigital image processing
Digital image processing
 
Digital image processing
Digital image processingDigital image processing
Digital image processing
 
Presentation shortstory
Presentation shortstoryPresentation shortstory
Presentation shortstory
 
Object detection at night
Object detection at nightObject detection at night
Object detection at night
 
WT in IP.ppt
WT in IP.pptWT in IP.ppt
WT in IP.ppt
 
Chap5 imange enhancemet
Chap5 imange enhancemetChap5 imange enhancemet
Chap5 imange enhancemet
 
1 [Autosaved].pptx
1 [Autosaved].pptx1 [Autosaved].pptx
1 [Autosaved].pptx
 
OpenCV.pdf
OpenCV.pdfOpenCV.pdf
OpenCV.pdf
 
12-Image enhancement and filtering.ppt
12-Image enhancement and filtering.ppt12-Image enhancement and filtering.ppt
12-Image enhancement and filtering.ppt
 
Image enhancement techniques
Image enhancement techniquesImage enhancement techniques
Image enhancement techniques
 
image enhancement image enhancement imag
image enhancement image enhancement imagimage enhancement image enhancement imag
image enhancement image enhancement imag
 
aip.pptx
aip.pptxaip.pptx
aip.pptx
 
Chapter 3 image enhancement (spatial domain)
Chapter 3 image enhancement (spatial domain)Chapter 3 image enhancement (spatial domain)
Chapter 3 image enhancement (spatial domain)
 
Digital image processing ppt
Digital image processing pptDigital image processing ppt
Digital image processing ppt
 
DIP Lecture 7-9.pdf
DIP Lecture 7-9.pdfDIP Lecture 7-9.pdf
DIP Lecture 7-9.pdf
 
Image processing sw & hw
Image processing sw & hwImage processing sw & hw
Image processing sw & hw
 
Image enhancement
Image enhancementImage enhancement
Image enhancement
 
Ch2
Ch2Ch2
Ch2
 
Image processing.pdf
Image processing.pdfImage processing.pdf
Image processing.pdf
 

More from Sairam Adithya

COUNTERS(Synchronous & Asynchronous)
COUNTERS(Synchronous & Asynchronous)COUNTERS(Synchronous & Asynchronous)
COUNTERS(Synchronous & Asynchronous)Sairam Adithya
 
SEQUENTIAL LOGIC CIRCUITS (FLIP FLOPS AND LATCHES)
SEQUENTIAL LOGIC CIRCUITS (FLIP FLOPS AND LATCHES)SEQUENTIAL LOGIC CIRCUITS (FLIP FLOPS AND LATCHES)
SEQUENTIAL LOGIC CIRCUITS (FLIP FLOPS AND LATCHES)Sairam Adithya
 
Medical waste segregation using deep learning
Medical waste segregation using deep learningMedical waste segregation using deep learning
Medical waste segregation using deep learningSairam Adithya
 
OpenCV presentation series- part 1
OpenCV presentation series- part 1OpenCV presentation series- part 1
OpenCV presentation series- part 1Sairam Adithya
 
A Brief Introduction to Diabetes Mellitus
A Brief Introduction to Diabetes MellitusA Brief Introduction to Diabetes Mellitus
A Brief Introduction to Diabetes MellitusSairam Adithya
 
Detection of medical instruments project- PART 2
Detection of medical instruments project- PART 2Detection of medical instruments project- PART 2
Detection of medical instruments project- PART 2Sairam Adithya
 
Detection of medical instruments project- PART 1
Detection of medical instruments project- PART 1Detection of medical instruments project- PART 1
Detection of medical instruments project- PART 1Sairam Adithya
 
TASK-OPTIMIZED DEEP NEURAL NETWORK TO REPLICATE THE HUMAN AUDITORY CORTEX
TASK-OPTIMIZED DEEP NEURAL NETWORK TO REPLICATE THE HUMAN AUDITORY CORTEXTASK-OPTIMIZED DEEP NEURAL NETWORK TO REPLICATE THE HUMAN AUDITORY CORTEX
TASK-OPTIMIZED DEEP NEURAL NETWORK TO REPLICATE THE HUMAN AUDITORY CORTEXSairam Adithya
 

More from Sairam Adithya (8)

COUNTERS(Synchronous & Asynchronous)
COUNTERS(Synchronous & Asynchronous)COUNTERS(Synchronous & Asynchronous)
COUNTERS(Synchronous & Asynchronous)
 
SEQUENTIAL LOGIC CIRCUITS (FLIP FLOPS AND LATCHES)
SEQUENTIAL LOGIC CIRCUITS (FLIP FLOPS AND LATCHES)SEQUENTIAL LOGIC CIRCUITS (FLIP FLOPS AND LATCHES)
SEQUENTIAL LOGIC CIRCUITS (FLIP FLOPS AND LATCHES)
 
Medical waste segregation using deep learning
Medical waste segregation using deep learningMedical waste segregation using deep learning
Medical waste segregation using deep learning
 
OpenCV presentation series- part 1
OpenCV presentation series- part 1OpenCV presentation series- part 1
OpenCV presentation series- part 1
 
A Brief Introduction to Diabetes Mellitus
A Brief Introduction to Diabetes MellitusA Brief Introduction to Diabetes Mellitus
A Brief Introduction to Diabetes Mellitus
 
Detection of medical instruments project- PART 2
Detection of medical instruments project- PART 2Detection of medical instruments project- PART 2
Detection of medical instruments project- PART 2
 
Detection of medical instruments project- PART 1
Detection of medical instruments project- PART 1Detection of medical instruments project- PART 1
Detection of medical instruments project- PART 1
 
TASK-OPTIMIZED DEEP NEURAL NETWORK TO REPLICATE THE HUMAN AUDITORY CORTEX
TASK-OPTIMIZED DEEP NEURAL NETWORK TO REPLICATE THE HUMAN AUDITORY CORTEXTASK-OPTIMIZED DEEP NEURAL NETWORK TO REPLICATE THE HUMAN AUDITORY CORTEX
TASK-OPTIMIZED DEEP NEURAL NETWORK TO REPLICATE THE HUMAN AUDITORY CORTEX
 

Recently uploaded

How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docxPoojaSen20
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 

Recently uploaded (20)

How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docx
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 

OpenCV presentation series- part 4

  • 2. Blurring and sharpening of images • This segment is about the blurring and sharpening of the images. • For this we are going to create a customized filter/kernel for blurring and sharpening separately. • These filters are nothing but an array of numbers. • The numbers in the array of the filter determine the operation to be performed. • The input image is nothing but an array of numbers. • The numbers indicate the colour intensity of the pixels in the input image.
  • 3. Contd… • Any color in the universe can be expressed within 0 to 255 where 0 refers to black and 255 refers to white. • As a matter of fact, the grayscale images are two dimensional images since they contain height and width only. • Whereas the color images are three dimensional images since they contain height, width and color channels. (BGR in the case of OpenCV). • So an image is nothing but an array of numbers. • The filter which we have assigned is also an array of numbers.
  • 4. Convolution • Hence there is an array operation that is going to take place when we apply a kernel to an image. • The operation is known as convolution which is indicated by the *. • The convolution is the combination of addition and multiplication. • First, there is a matrix multiplication between the image and the kernel. • Then the product of all the values are then added to produce the final answer. • In one way, the convolution operation reduces the dimension of the image.
  • 5. Filter • So the numbers present in the filter play a major role in determining the operation. • To obtain a black image using filters, we can use the array filled with zeros. • Zero multiplied with anything is zero and their sum is zero. • The resultant is a zero and hence we obtain a black image. • Similarly, there are other filters for other operations. • We can play with the numbers in the filters to see how the output image looks like.
  • 7. Filter for blurring • The process of blurring is to make the details less clearer or to diminish the intensity. • This can be done by taking the average of the surrounding pixels and replacing it in the original place. • So the 3*3 filter for performing blurring operation looks like • 1/9, 1/9, 1/9 • 1/9, 1/9, 1/9 • 1/9, 1/9, 1/9
  • 8. Function • This filter is made by using the array function from the numpy library. • Then we have to mention two square brackets since the array is 2-D in nature.The dimensions for the array and the elements to be filled are upto the choice of the user. • The dimension determines the frequency of convolution (large dimension means lesser times) and the numbers determine the operation. • Finally the filter2D function in OpenCV is used to implement our customized filter. • The first argument is the image location, the second is an number of -1 and the third is our kernel.
  • 10. Sharpening of images • Image sharpening refers to any enhancement technique that highlights edges and fine details in an image. • Image sharpening is widely used in printing and photographic industries for increasing the local contrast and sharpening the images. • The filter used here is given below:- • 0,-1,0 • -1,n,-1 • 0,-1,0 • The value n determines the amplitude of the sharpening.
  • 12. Magnitudes of sharpening • Higher value • Lower value
  • 13. Alternate for blurring • The blurring done before was fixed. • So to overcome this disadvantage and to make it variable we use a function called Gaussian Blur. • The blurring is done by the gaussian function which is mathematical. • The first argument is the location of the image. • The second argument is the kernel range. It is important to give an odd and equal value like (3,3) or (5,5) etc. • The third argument is a number ranging from 0 to 1. 1 gives a clear image despite the kernel applied. • There are two other types of blurring called the median and bilateral blurring.
  • 16. Effect of 1 on gaussian blur • Blurring without 1 • Blurring with 1
  • 19. Edge detection-canny • Edge detection is a technique of image processing used to identify points in a digital image with discontinuities. • It sharps the changes in the image brightness.These points where the image brightness varies sharply are called the edges (or boundaries) of the image. • The edge detection method used here is called as canny edge detection. • It is essential that we use grayscale images to lower the computations. • There are two threshold values in the canny function.
  • 21. Effect of threshold • More threshold
  • 22. Sobel edge detection • Another method for edge detection available in OpenCV is the sobel method. • This is also known as Sobel-Feldman operator or Sobel filter. • By changing the dx and dy values we can get sobel features for x and y axes separately.
  • 26. Prewitt edge detection • The third edge detection method is called as the prewitt method. • This method uses specified filters for x and y axis and we have to manually combine them.
  • 29. Dilated image combined with canny edge
  • 30. Eroded image combined with canny edge