Image Enhancement – Simple Intensity Processing

Slides:



Advertisements
Similar presentations
Spatial Filtering (Chapter 3)
Advertisements

Image Processing Lecture 4
CS & CS Multimedia Processing Lecture 2. Intensity Transformation and Spatial Filtering Spring 2009.
Spatial Filtering.
Chapter 3 Image Enhancement in the Spatial Domain.
Lecture 6 Sharpening Filters
EE 4780 Image Enhancement. Bahadir K. Gunturk2 Image Enhancement The objective of image enhancement is to process an image so that the result is more.
Digital Image Processing
ECE 472/572 - Digital Image Processing
Image Enhancement in the Spatial Domain II Jen-Chang Liu, 2006.
Digital Image Processing
Digital image processing Chapter 6. Image enhancement IMAGE ENHANCEMENT Introduction Image enhancement algorithms & techniques Point-wise operations Contrast.
Digital Image Processing In The Name Of God Digital Image Processing Lecture3: Image enhancement M. Ghelich Oghli By: M. Ghelich Oghli
Chapter 3: Image Enhancement in the Spatial Domain
6/9/2015Digital Image Processing1. 2 Example Histogram.
Machine Vision and Dig. Image Analysis 1 Prof. Heikki Kälviäinen CT50A6100 Lectures 6&7: Image Enhancement Professor Heikki Kälviäinen Machine Vision and.
Digital Image Processing
Image Enhancement.
Lecture 2. Intensity Transformation and Spatial Filtering
Chapter 3 Image Enhancement in the Spatial Domain.
ECE 472/572 - Digital Image Processing Lecture 4 - Image Enhancement - Spatial Filter 09/06/11.
Chapter 3 (cont).  In this section several basic concepts are introduced underlying the use of spatial filters for image processing.  Mainly spatial.
Chap2 Image enhancement (Spatial domain)
Presentation Image Filters
Spatial Filtering: Basics
Chapter 3 Image Enhancement in the Spatial Domain.
Filtering and Enhancing Images. Major operations 1. Matching an image neighborhood with a pattern or mask 2. Convolution (FIR filtering)
Digital Image Processing Lecture 5: Neighborhood Processing: Spatial Filtering Prof. Charlene Tsai.
Digital Image Processing CSC331 Image Enhancement 1.
Digital Image Processing, 2nd ed. © 2002 R. C. Gonzalez & R. E. Woods  Process an image so that the result will be more suitable.
Chapter 5: Neighborhood Processing
Lecture 5 Mask/Filter Transformation 1.The concept of mask/filters 2.Mathematical model of filtering Correlation, convolution 3.Smoother filters 4.Filter.
Spatial Filtering.
Digital Image Processing, 3rd ed. © 1992–2008 R. C. Gonzalez & R. E. Woods Gonzalez & Woods Chapter 3 Intensity Transformations.
Image Subtraction Mask mode radiography h(x,y) is the mask.
Mestrado em Ciência de Computadores Mestrado Integrado em Engenharia de Redes e Sistemas Informáticos VC 15/16 – TP7 Spatial Filters Miguel Tavares Coimbra.
Digital Image Processing Lecture 5: Neighborhood Processing: Spatial Filtering March 9, 2004 Prof. Charlene Tsai.
EE 7730 Image Enhancement. Bahadir K. Gunturk2 Image Enhancement The objective of image enhancement is to process an image so that the result is more.
Digital Image Processing, 2nd ed. © 2002 R. C. Gonzalez & R. E. Woods Chapter 3 Image Enhancement in the Spatial Domain Chapter.
Image Processing Lab Section 28/3/2016 Prepared by Mahmoud Abdelsatar Demonstrator at IT Dep. Faculty of computers and information Assuit University.
Spatial Filtering (Chapter 3) CS474/674 - Prof. Bebis.
Image Enhancement in the Spatial Domain.
Miguel Tavares Coimbra
Image Subtraction Mask mode radiography h(x,y) is the mask.
Fundamentals of Spatial Filtering:
Digital Image Processing CSC331
Image enhancement algorithms & techniques Point-wise operations
IMAGE ENHANCEMENT TECHNIQUES
Image Segmentation – Edge Detection
ECE 692 – Advanced Topics in Computer Vision
IMAGE PROCESSING INTENSITY TRANSFORMATION AND SPATIAL FILTERING
Spatial Filtering - Enhancement
Image Enhancement.
Digital Image Processing
CIS 601 – 03 Image ENHANCEMENT SPATIAL DOMAIN Longin Jan Latecki
Histogram Histogram is a graph that shows frequency of anything. Histograms usually have bars that represent frequency of occuring of data. Histogram has.
ENG4BF3 Medical Image Processing
CIS 350 – 3 Image ENHANCEMENT SPATIAL DOMAIN
Image Enhancement in the Spatial Domain
Lecture 3 (2.5.07) Image Enhancement in Spatial Domain
Digital Image Processing
CSC 381/481 Quarter: Fall 03/04 Daniela Stan Raicu
Digital Image Processing
Digital Image Processing
Image Enhancement To process an image so that the result is more suitable than the original image for a specific application. Spatial domain methods and.
CIS 4350 Image ENHANCEMENT SPATIAL DOMAIN
Intensity Transformations and Spatial Filtering
Image Enhancement in the Spatial Domain
DIGITAL IMAGE PROCESSING Elective 3 (5th Sem.)
Presentation transcript:

Image Enhancement – Simple Intensity Processing Dr. Jiajun Wang School of Electronics & Information Engineering Soochow University

Image Enhancement - 1 Outline Review Image enhancement vs. restoration Different approaches Point processing

Image Enhancement - 1 Review

Image Enhancement - 1 Enhancement vs. restoration Image enhancement : processing the image so that the results is more suitable than the original image for a specific application Image restoration : recover image from distortions to its original image

Spatial domain processing Image Enhancement - 1 Different approaches Spatial domain processing Point processing : E.g., contrast stretching Mask processing : and its neighbors covered by mask) E.g., spatial filters Frequency domain processing Select H(u,v) so that the desired image g(x,y) exhibits some highlighted features of f(x,y)

Image Enhancement - 1 Spatial domain approaches

Image Enhancement - 1 Point processing Simple intensity transforms Image negatives Log and power-low transforms Contrast stretching Compression of dynamic range Gray-level slicing Bit-plane slicing Histogram methods Histogram equalization Histogram specification Image subtraction Image averaging

Image Enhancement – Point Processing Image negative ImageNegative.m --------------------------------------------------------------- iptsetpref('ImshowBorder', 'tight') img1 = imread('..\images\xrp1.tif'); figure imshow(img1); title('original image'); img2 = imcomplement(img1); imshow(img2); title('negative image');

Image Enhancement – Point Processing Log transforms Log transforms stretch the low gray-level values while compress the high gray level values.

Image Enhancement – Point Processing Log transforms – example Log transforms stretch the low gray-level values while compress the high gray level values. LogTransform.m ----------------------------------------- clear all close all iptsetpref('ImshowBorder', 'tight') img = zeros(256, 256); img(120:136, 120:136) = 1; figure imshow(img); fimg = fft2(img); fimg = fftshift(fimg); MagImg = abs(fimg); imshow(MagImg,[]); maxV = max(max(MagImg)); limg = log(1+MagImg); imshow(limg,[]); Original image Fourier transform Log transform of FT

Image Enhancement – Point Processing Power-law transforms The power-low transformations are much more versatile.

Image Enhancement – Point Processing Gamma correction The power-low transformations are much more versatile.

Image Enhancement – Point Processing Power-low transform example The power-low transformations are much more versatile.

Image Enhancement – Point Processing Power-low transform example The power-low transformations are much more versatile.

Image Enhancement – Point Processing Piecewise-linear Transformation

Image Enhancement – Point Processing Contrast stretching ImageStreching.m ----------------------------------------- iptsetpref('ImshowBorder', 'tight') img1 = imread('..\images\AllKnives.tif'); figure imshow(img1); title('original image'); minV = double(min(min(img1)))/65535; maxV = double(max(max(img1)))/65535; img2 = imadjust(img1, [minV,maxV], []); imshow(img2); title('streching image'); %imshow(img1, []); % another simple approach Original image Stretched image

Image Enhancement – Point Processing Gray-level slicing

Image Enhancement – Point Processing Bit-plane slicing

Image Enhancement – Point Processing Bit-plane slicing (cont’)

Image Enhancement – Point Processing Histogram equalization Gray-level histogram is a function showing, for each gray level, the number of pixels in the image that have that gray level Normalized histogram (probability):

Image Enhancement – Point Processing Histogram equalization (cont.)

Image Enhancement – Point Processing Histogram equalization (cont.) s=T(r) T is single-valued and monotonically increasing s is value-limited in [0,1]

Image Enhancement – Point Processing Histogram equalization (cont.) PDF relation between ps and pr If the cumulative distribution function is used as the transform then the PDF of the transformed image is

Image Enhancement – Point Processing Histogram equalization (cont.) Transform function is the probability density function (pdf) The transform function is the cumulative distribution function (CDF) Why ? To make the pdf of the transformed image uniform, i.e., to make the histogram of the transformed image uniform.

Image Enhancement – Point Processing Histogram equalization (cont.) HE - discrete form HE steps G – Number of gray levels, N – Number of pixels Calculate the histogram H[r], r=1,2,…G-1 Normalize the histogram H[r] = H[r]/N; Form the CDF: Hc[0] = H[0], Hc[r] = Hc[r-1] + H[r] Set s = T[p] = round (Hc[p] (G-1))

Image Enhancement – Point Processing Histogram equalization (cont.)

Image Enhancement – Point Processing Histogram equalization (cont.) Discussion Can contrast stretching achieve similar result as histogram equalization? If yes, why histogram equalization then? Why isn’t the transformed histogram uniform?

Image Enhancement – Point Processing Histogram matching (specification) The desired shape of histogram is specified (not necessarily uniform) Derivation of histogram matching function: z=G-1(T(r)) s uniform r input z desired z=G-1(s) s=T(r) histogram equalization histogram equalization s=G(z)

Inverse function of G Original -> uniform (equalization) Desired -> uniform (equalization) Inverse function of G

Image Enhancement – Point Processing Image averaging original image f(x,y) + noisy image g(x,y) noise n(x,y)

Image Enhancement – Point Processing Image averaging (cont.) If the noise is uncorrelated and has zero expectation, then

Image Enhancement – Point Processing Image averaging – example Original image Noised image (Gaussian)

Image Enhancement – Point Processing Image averaging – example (cont’) clear all close all iptsetpref('ImshowBorder', 'tight') img1 = imread('..\images\lenna.bmp'); img1 = rgb2gray(img1); figure imshow(img1); title('original image'); img = zeros(size(img1)); for i=1:10 img2 = imnoise(img1, 'gaussian'); img = imadd(img, double(img2)); end img = uint8(img/10); imshow(img) imshow(img2) Noised image (Gaussian) Average of 10 noised image

Image Enhancement – Point Processing Image subtraction ImageSubtract.m clear all close all iptsetpref('ImshowBorder', 'tight') img1 = imread('..\images\lenna.bmp'); img1 = rgb2gray(img1); figure imshow(img1); title('original image'); h = fspecial('gaussian', [5 5], 1); % Gaussian filter img = imfilter(img1,h); imshow(img) img2 = imsubtract(img1, img); img2 = imcomplement(img2); imshow(img2,[]); Difference between original and blurred image

Image Enhancement – Spatial Filters Dr. Jiajun Wang School of Electronics and Information Engineering Soochow University

Image Enhancement - 2 Outline Review - Different approaches Spatial filters Smoothing filters Sharpening filters Summery

Different approaches - review Image Enhancement - 2 Different approaches - review Spatial domain processing Point processing : E.g., contrast stretching Mask processing : and its neighbors covered by mask) E.g., spatial filters Frequency domain processing Select H(u,v) so that the desired image g(x,y) exhibits some highlighted features of f(x,y)

Image Enhancement - 2 Spatial filtering Mask 1D : FIR window 2D : spatial mask Use spatial filters (masks) for linear and nonlinear image enhancement. The process consists of moving the filter mask from point to point in an image. At each point (x,y), the response of the filter at that point is calculated using a predefined relationship. The mask is in general of odd sizes.

Spatial filtering (cont’) Image Enhancement - 2 Spatial filtering (cont’) Operation Steps Select a single pixel. Determine the pixel’s neighborhood. Apply a function to the values of the pixels in the neighborhood. This function must return a scalar. Find the pixel in the output image whose position corresponds to that of the center pixel in the input image. Set this output pixel to the value returned by the function. Repeat steps 1 through 4 for each pixel in the input image.

Padding of borders Image Enhancement - 2 Spatial filtering (cont’) Determine the center pixel: For any m-by-n neighborhood, the center pixel is floor(([m n]+1)/2). Some of the pixels in a neighborhood may be missing, especially if the center pixel is on the border of the image. Notice that in the figure, the upper left and bottom right neighborhoods include “pixels” that are not part of the image. To process these neighborhoods, sliding neighborhood operations pad the borders of the image, usually with 0’s. In other words, these functions process the border pixels by assuming that the image is surrounded by additional rows and columns of 0’s. These rows and columns do not become part of the output image and are used only as parts of the neighborhoods of the actual pixels in the image. - Boundary padding options X Input array values outside the bounds of the array are implicitly assumed to have the value X. When no boundary option is specified, IMFILTER uses X = 0. 'symmetric' Input array values outside the bounds of the array are computed by mirror-reflecting the array across the array border. 'replicate' Input array values outside the bounds of the array are assumed to equal the nearest array border value. 'circular' Input array values outside the bounds of the array are computed by implicitly assuming the input array is periodic.

Purpose: blurring or noise reduction Low pass spatial filtering Image Enhancement - 2 Smoothing filters Purpose: blurring or noise reduction Low pass spatial filtering Neighborhood averaging Can use different size of masks Sum of the mask coefficients is 1 Drawbacks: blur edges and other sharp features Median filtering Nonlinear The gray level of each pixel is replaced by the median of its neighbors Good at denoising Objective of blurring: removal of small objects from an image prior to (large) object extraction, or bridging of small gaps in lines or curves.

Smoothing filters (cont.) Image Enhancement - 2 Smoothing filters (cont.) The basic strategy behind weighted averaging is simply an attempt to reduce blurring in the smoothing process. However, in practice, it is difficult in general to see the difference between the images smoothed by using either of the masks above because of their small sizes.

Smoothing filters - examples Image Enhancement - 2 Smoothing filters - examples ImageSmoothing.m I = uint8(zeros(128,128)); I(:,33:64) = uint8(64); I(:,65:96) = uint8(128); I(:,97:128) = uint8(192) figure;imshow(I) figure;plot(I(64,:)); K = imfilter(I, fspecial('average',9)); figure;imshow(K) figure;plot(K(64,:)); L = medfilt2(I,[3 3]); figure, imshow(L) figure, plot(L(64,:));

Smoothing filters - examples Image Enhancement - 2 Smoothing filters - examples The above figure illustrates the effects of smoothing as a function of filter size.

Median filters Max filters Min filters Image Enhancement - 2 Order statistics filters Median filters Max filters Min filters

Median filters - examples Image Enhancement - 2 Median filters - examples MedianFiltering.m --------------------------------------------------------------------------------- clear all close all iptsetpref('ImshowBorder', 'tight') I = imread('eight.tif'); J = imnoise(I,'salt & pepper',0.02); imshow(I) figure, imshow(J) K = filter2(fspecial('average',3),J)/255; L = medfilt2(J,[3 3]); figure, imshow(K) figure, imshow(L)

Image Enhancement - 2 Sharpening filters Purpose Approach Highlight fine details or enhance details that have been blurred Approach First-order derivative Second-order derivative Basic high pass spatial filters Sum of the mask coefficients is 0 Visual effect : enhanced edges on a dark background Basic idea: sharpening could be accomplished by digital differentiation. Image differentiation enhances edges and other discontinuities. Requirements for first- and second-order derivatives. See pp. 125. First-order derivatives produce thick edges and second-order derivatives produce much finer ones. 2nd –order derivatives enhance fine details (include noises) much more than the 1st order derivatives. 2nd –order derivatives have a transition from positive to negative and thus produce double edges. See pp. 127.

Image Enhancement - 2 Sharpening filters (cont.)

Laplacian – second order derivative Image Enhancement - 2 Sharpening filters - Laplacian Laplacian – second order derivative

Image Enhancement - 2 Sharpening filters – Laplacian (cont.)

Image Enhancement - 2 Sharpening filters - Laplacian examples

Sharpening filters - Laplacian examples Image Enhancement - 2 Sharpening filters - Laplacian examples ImageSharpening.m I = imread('moon.tif'); figure; imshow(I); h1 = [0 1 0; 1 -4 1; 0 1 0]; % Laplacian derivative I1 = imfilter(I, h1); figure; imshow(I1); I11 = double(I)-double(I1); I11 = mat2gray(I11); figure; imshow(I11); h2 = [0 -1 0; -1 5 -1; 0 -1 0]; % Laplacian filter I2 = imfilter(I, h2); figure; imshow(I2); h3 = fspecial('unsharp'); % unsharp filter I3 = imfilter(I,h3); figure, imshow(I3)

Sharpening filters – High boosting Image Enhancement - 2 Sharpening filters – High boosting Unsharp masking Subtracting a blurred image from its original High-boosting filtering Highpass = Original – Lowpass High boost = (A)Original – Lowpass = (A-1)Original + Highpass Visual effect : brighten while sharpening on the original image

Sharpening filters (cont.) Image Enhancement - 2 Sharpening filters (cont.) One of the principal applications of boost filtering is when the image is darker than desired.

Image Enhancement - 2 Sharpening filters - examples

Image Enhancement - 2 Sharpening filters - Gradient First order derivative filters

Image Enhancement - 2 Sharpening filters (cont.)

Image Enhancement - 2 Sharpening filters - examples

Smoothing filters (blurr details) Image Enhancement - 2 Summery Smoothing filters (blurr details) Average median Sharpening filters (highlight details) Highpass filters Unsharp masking High-boost filters Derivative filters