SlideShare a Scribd company logo
1 of 20
Digital Image Processing:
Image Enhancement in Spatial
Domain
Nidhi Sharma
Image Enhancement
 Image enhancement in the spatial domain is a technique used to improve the
visual quality of digital images by directly manipulating the pixel values.
 It involves modifying the image pixel by pixel, considering their spatial
relationships within the image.
 Image enhancement approaches fall into two broad categories:
 Spatial domain methods
 Point processes
 Area processes
 Frame process
 Frequency domain methods
Image Enhancement: Spatial Domain
 The term spatial domain refers to the aggregate of pixels composing an
image.
 Spatial domain methods are procedures that operate directly on these pixels.
Spatial domain processes will be denoted by the expression
g (x, y) = T [f (x, y)]
where f(x, y) is the input image, g(x, y) is the processed image, and T is an
operator on f, defined over some neighborhood of (x, y).
For example:
T can operate on a set of input images, such as performing the pixel-by-pixel sum
of K images for noise reduction.
Spatial Image Enhancement
 Single-pixel operation (Intensity Transformation)
Negative Image, contrast stretching etc.
 Neighbourhood operations
Averaging filter, median filtering etc.
 Geometric spatial transformations
Scaling, Rotation, Translations et
Single Pixel Operations
Neighbourhood Operations
Geometric Spatial Operators
Averaging
 Often done to improve SNR.
avgI = (img1+img2+img3+img4+img5)/5;
Remember that the data is Uint8 type…..which may saturate the sum values to 255!
So
avgI = (im2double(img1)+im2double(img2)+ im2double(img3)+ im2double(img4)+
im2double(img5))/5;
Im2double also rescales range to [0,1]
Resizing and Transforming
 Use ‘montage’ to see and compare image side by side
Montage ({image1, image2})
avgGray = im2gray (avgI);
avgIreduced = imresize( avgI, 0.75);
avgIsquared = imresize( avgI, 2000, 2000);
avgIrotated = imrotate( avgI, 30, ‘crop’);
 Imwrite( avgI, “filename.png”); % to save image as a given file name
 Imwrite( avgI, “filename.jpg”, “Quality”, 80); % to save image as a given file name
Some Basic Intensity Transformation
Functions
 Image Negatives
s = L – 1 – r
S is the output intensity value
L is the highest intensity levels
r is the input intensity value
 Particularly suited for enhancing white or gray detail embedded in dark
regions of an image, especially when the black areas are dominant in size
Some Basic Intensity Transformation
Functions
 Log Transformations
 s = c log(1 + r) where , c is a constant
 It maps a narrow range of low intensity values in the input into a wide range of output
levels
 The opposite is true of higher values of input levels
 It expands the values of dark pixels in an image while compressing the higher level
values
 It compresses the dynamic range of images with large variations in pixel values
% Read the input image
inputImage = imread('input_image.jpg'); % Replace 'input_image.jpg' with your image file name and
extension
% Convert the input image to double precision for accurate calculations
inputImage = im2double(inputImage);
% Perform log transformation
c = 1; % Constant value for scaling
outputImage = c * log(1 + inputImage);
% Rescale the output image to the range [0, 1] for display
outputImage = (outputImage - min(outputImage(:))) / (max(outputImage(:)) - min(outputImage(:)));
% Display the input and output images figure;
subplot(1, 2, 1);
imshow(inputImage);
title('Input Image');
subplot(1, 2, 2);
imshow(outputImage);
title('Log Transformed Image');
% Save the output image
imwrite(outputImage, 'output_image.jpg'); % Replace 'output_image.jpg' with your desired output image
file name and extension
Example:
Some Basic Intensity Transformation
Functions
 Power Law (Gamma) Transformations
 s = c rγ
 c and γ are both positive constants
 With fractional values(0<γ<1) of gamma map a narrow range of dark input
values into a wider range of output values, with the opposite being true for
higher values (γ >1)of input levels.
 C=gamma=1 means it is an identity transformations.
 Variety of devices used for image capture , printing, and display respond
according to a power law.
 Process used to correct these power law response phenomena is called
gamma correction.
Some Basic Intensity Transformation
Functions
Some Basic Intensity Transformation
Functions
Power Law (Gamma) Transformations
 Images that are not corrected properly look either bleached out or too dark.
 Varying gamma changes not only intensity, but also the ratio of red to green to blue in
a color images.
 Gamma correction has become increasingly important, as the use of the digital images
over internet.
 Useful for general purpose contrast manipulation.
 Apply gamma correction on CRT (Television, monitor), printers, scanners etc.
 Gamma value depends on device.
Some Basic Intensity Transformation
Functions
DIP-Enhancement-Spatial.pptx

More Related Content

Similar to DIP-Enhancement-Spatial.pptx

Image processing
Image processingImage processing
Image processingmaheshpene
 
image processing intensity transformation
image processing intensity transformationimage processing intensity transformation
image processing intensity transformationalobaidimki
 
Digital Image Processing_ ch2 enhancement spatial-domain
Digital Image Processing_ ch2 enhancement spatial-domainDigital Image Processing_ ch2 enhancement spatial-domain
Digital Image Processing_ ch2 enhancement spatial-domainMalik obeisat
 
Image Enhancement - Point Processing
Image Enhancement - Point ProcessingImage Enhancement - Point Processing
Image Enhancement - Point ProcessingGayathri31093
 
Image processing basics using matlab
Image processing basics using matlabImage processing basics using matlab
Image processing basics using matlabAnkur Tyagi
 
Image Enhancement in Spatial Domain
Image Enhancement in Spatial DomainImage Enhancement in Spatial Domain
Image Enhancement in Spatial DomainDEEPASHRI HK
 
Introduction to image contrast and enhancement method
Introduction to image contrast and enhancement methodIntroduction to image contrast and enhancement method
Introduction to image contrast and enhancement methodAbhishekvb
 
Image enhancement lecture
Image enhancement lectureImage enhancement lecture
Image enhancement lectureISRAR HUSSAIN
 
Image Enhancement in the Spatial Domain.pdf
Image Enhancement in the Spatial Domain.pdfImage Enhancement in the Spatial Domain.pdf
Image Enhancement in the Spatial Domain.pdfkamaluddinnstu
 
Image Enhancement in the Spatial Domain U2.ppt
Image Enhancement in the Spatial Domain U2.pptImage Enhancement in the Spatial Domain U2.ppt
Image Enhancement in the Spatial Domain U2.pptssuser7ec6af
 
Digital Image Processing (Lab 07)
Digital Image Processing (Lab 07)Digital Image Processing (Lab 07)
Digital Image Processing (Lab 07)Moe Moe Myint
 
Image enhancement ppt nal2
Image enhancement ppt nal2Image enhancement ppt nal2
Image enhancement ppt nal2Surabhi Ks
 
Intensity Transformation Functions of image with Matlab
Intensity Transformation Functions of image with Matlab Intensity Transformation Functions of image with Matlab
Intensity Transformation Functions of image with Matlab Shafi Sourov
 
Working with images in matlab graphics
Working with images in matlab graphicsWorking with images in matlab graphics
Working with images in matlab graphicsmustafa_92
 
3 intensity transformations and spatial filtering slides
3 intensity transformations and spatial filtering slides3 intensity transformations and spatial filtering slides
3 intensity transformations and spatial filtering slidesBHAGYAPRASADBUGGE
 

Similar to DIP-Enhancement-Spatial.pptx (20)

Image processing
Image processingImage processing
Image processing
 
image processing intensity transformation
image processing intensity transformationimage processing intensity transformation
image processing intensity transformation
 
Image enhancement
Image enhancementImage enhancement
Image enhancement
 
Digital Image Processing_ ch2 enhancement spatial-domain
Digital Image Processing_ ch2 enhancement spatial-domainDigital Image Processing_ ch2 enhancement spatial-domain
Digital Image Processing_ ch2 enhancement spatial-domain
 
Image Enhancement - Point Processing
Image Enhancement - Point ProcessingImage Enhancement - Point Processing
Image Enhancement - Point Processing
 
Image processing basics using matlab
Image processing basics using matlabImage processing basics using matlab
Image processing basics using matlab
 
Image Enhancement in Spatial Domain
Image Enhancement in Spatial DomainImage Enhancement in Spatial Domain
Image Enhancement in Spatial Domain
 
Introduction to image contrast and enhancement method
Introduction to image contrast and enhancement methodIntroduction to image contrast and enhancement method
Introduction to image contrast and enhancement method
 
Image enhancement lecture
Image enhancement lectureImage enhancement lecture
Image enhancement lecture
 
Image Enhancement in the Spatial Domain.pdf
Image Enhancement in the Spatial Domain.pdfImage Enhancement in the Spatial Domain.pdf
Image Enhancement in the Spatial Domain.pdf
 
4 image enhancement in spatial domain
4 image enhancement in spatial domain4 image enhancement in spatial domain
4 image enhancement in spatial domain
 
3rd unit.pptx
3rd unit.pptx3rd unit.pptx
3rd unit.pptx
 
Image Enhancement in the Spatial Domain U2.ppt
Image Enhancement in the Spatial Domain U2.pptImage Enhancement in the Spatial Domain U2.ppt
Image Enhancement in the Spatial Domain U2.ppt
 
Image enhancement
Image enhancementImage enhancement
Image enhancement
 
Digital Image Processing (Lab 07)
Digital Image Processing (Lab 07)Digital Image Processing (Lab 07)
Digital Image Processing (Lab 07)
 
Image enhancement ppt nal2
Image enhancement ppt nal2Image enhancement ppt nal2
Image enhancement ppt nal2
 
Intensity Transformation Functions of image with Matlab
Intensity Transformation Functions of image with Matlab Intensity Transformation Functions of image with Matlab
Intensity Transformation Functions of image with Matlab
 
Image enhancement
Image enhancementImage enhancement
Image enhancement
 
Working with images in matlab graphics
Working with images in matlab graphicsWorking with images in matlab graphics
Working with images in matlab graphics
 
3 intensity transformations and spatial filtering slides
3 intensity transformations and spatial filtering slides3 intensity transformations and spatial filtering slides
3 intensity transformations and spatial filtering slides
 

Recently uploaded

Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .Satyam Kumar
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfAsst.prof M.Gokilavani
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx959SahilShah
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)Dr SOUNDIRARAJ N
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxDeepakSakkari2
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxKartikeyaDwivedi3
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...asadnawaz62
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)dollysharma2066
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
pipeline in computer architecture design
pipeline in computer architecture  designpipeline in computer architecture  design
pipeline in computer architecture designssuser87fa0c1
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxk795866
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidNikhilNagaraju
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AIabhishek36461
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfAsst.prof M.Gokilavani
 

Recently uploaded (20)

9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
 
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptx
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
Design and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdfDesign and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdf
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptx
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
pipeline in computer architecture design
pipeline in computer architecture  designpipeline in computer architecture  design
pipeline in computer architecture design
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptx
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfid
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AI
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
 

DIP-Enhancement-Spatial.pptx

  • 1. Digital Image Processing: Image Enhancement in Spatial Domain Nidhi Sharma
  • 2. Image Enhancement  Image enhancement in the spatial domain is a technique used to improve the visual quality of digital images by directly manipulating the pixel values.  It involves modifying the image pixel by pixel, considering their spatial relationships within the image.  Image enhancement approaches fall into two broad categories:  Spatial domain methods  Point processes  Area processes  Frame process  Frequency domain methods
  • 3. Image Enhancement: Spatial Domain  The term spatial domain refers to the aggregate of pixels composing an image.  Spatial domain methods are procedures that operate directly on these pixels. Spatial domain processes will be denoted by the expression g (x, y) = T [f (x, y)] where f(x, y) is the input image, g(x, y) is the processed image, and T is an operator on f, defined over some neighborhood of (x, y). For example: T can operate on a set of input images, such as performing the pixel-by-pixel sum of K images for noise reduction.
  • 4. Spatial Image Enhancement  Single-pixel operation (Intensity Transformation) Negative Image, contrast stretching etc.  Neighbourhood operations Averaging filter, median filtering etc.  Geometric spatial transformations Scaling, Rotation, Translations et
  • 8. Averaging  Often done to improve SNR. avgI = (img1+img2+img3+img4+img5)/5; Remember that the data is Uint8 type…..which may saturate the sum values to 255! So avgI = (im2double(img1)+im2double(img2)+ im2double(img3)+ im2double(img4)+ im2double(img5))/5; Im2double also rescales range to [0,1]
  • 9. Resizing and Transforming  Use ‘montage’ to see and compare image side by side Montage ({image1, image2}) avgGray = im2gray (avgI); avgIreduced = imresize( avgI, 0.75); avgIsquared = imresize( avgI, 2000, 2000); avgIrotated = imrotate( avgI, 30, ‘crop’);
  • 10.  Imwrite( avgI, “filename.png”); % to save image as a given file name  Imwrite( avgI, “filename.jpg”, “Quality”, 80); % to save image as a given file name
  • 11. Some Basic Intensity Transformation Functions  Image Negatives s = L – 1 – r S is the output intensity value L is the highest intensity levels r is the input intensity value  Particularly suited for enhancing white or gray detail embedded in dark regions of an image, especially when the black areas are dominant in size
  • 12. Some Basic Intensity Transformation Functions  Log Transformations  s = c log(1 + r) where , c is a constant  It maps a narrow range of low intensity values in the input into a wide range of output levels  The opposite is true of higher values of input levels  It expands the values of dark pixels in an image while compressing the higher level values  It compresses the dynamic range of images with large variations in pixel values
  • 13. % Read the input image inputImage = imread('input_image.jpg'); % Replace 'input_image.jpg' with your image file name and extension % Convert the input image to double precision for accurate calculations inputImage = im2double(inputImage); % Perform log transformation c = 1; % Constant value for scaling outputImage = c * log(1 + inputImage); % Rescale the output image to the range [0, 1] for display outputImage = (outputImage - min(outputImage(:))) / (max(outputImage(:)) - min(outputImage(:))); % Display the input and output images figure; subplot(1, 2, 1); imshow(inputImage); title('Input Image'); subplot(1, 2, 2); imshow(outputImage); title('Log Transformed Image'); % Save the output image imwrite(outputImage, 'output_image.jpg'); % Replace 'output_image.jpg' with your desired output image file name and extension
  • 15. Some Basic Intensity Transformation Functions  Power Law (Gamma) Transformations  s = c rγ  c and γ are both positive constants  With fractional values(0<γ<1) of gamma map a narrow range of dark input values into a wider range of output values, with the opposite being true for higher values (γ >1)of input levels.  C=gamma=1 means it is an identity transformations.  Variety of devices used for image capture , printing, and display respond according to a power law.  Process used to correct these power law response phenomena is called gamma correction.
  • 16. Some Basic Intensity Transformation Functions
  • 17. Some Basic Intensity Transformation Functions
  • 18. Power Law (Gamma) Transformations  Images that are not corrected properly look either bleached out or too dark.  Varying gamma changes not only intensity, but also the ratio of red to green to blue in a color images.  Gamma correction has become increasingly important, as the use of the digital images over internet.  Useful for general purpose contrast manipulation.  Apply gamma correction on CRT (Television, monitor), printers, scanners etc.  Gamma value depends on device.
  • 19. Some Basic Intensity Transformation Functions