View
218
Download
1
Category
Preview:
Citation preview
Multimedia SystemsMultimedia Systems
Image IIImage II
(Image Enhancement)(Image Enhancement)
Course PresentationCourse Presentation
(Image Enhancement)(Image Enhancement)
Mahdi Amiri
March 2014
Sharif University of Technology
Image EnhancementDefinitionDefinition
Image enhancement deals with the improvement of
visual appearance of the scene, to improve the detectability
of objects to be used by either a machine vision system or a
human observer.
Sources of image deterioration
Multimedia Systems, Mahdi Amiri, Image IIPage 1
Sources of image deterioration
Noise
Low Resolution
Quantization levels
Source of noise
Electronic signal fluctuations in detector ( CCD chip )
Note: Enhancement vs. Restoration
Image enhancement is the improvement of digital
image quality (wanted e.g. for visual inspection or
for machine analysis), without knowledge about the
source of degradation. If the source of degradation is
known, one calls the process image restoration.
Here, we are not going to specifically differentiate
these techniques.
Image EnhancementHave seen so farHave seen so far
Multimedia Systems, Mahdi Amiri, Image IIPage 2
Gamma CorrectionGamma Correction Histogram EqualizationHistogram Equalization
Image EnhancementImage NoiseImage Noise
The random variation of brightness or color information in images
An undesirable by-product of image capture
Multimedia Systems, Mahdi Amiri, Image IIPage 3
‘grainy’ image, noise from a digital camera‘grainy’ image, noise from a digital camera Image with salt and pepper noiseImage with salt and pepper noise
Image FiltersGaussian smoothingGaussian smoothing
Noise fluctuations are rapid, ie, high frequency.
Gaussian filters are a class of smoothing filters where the kernel
values have a 2D Gaussian shape.
Multimedia Systems, Mahdi Amiri, Image IIPage 4
2D Gaussian Filter2D Gaussian Filter
1 2 1
2 4 2
1 2 1
1 4 6 4 1
4 16 24 16 4
6 24 36 24 6
4 16 24 16 4
1 4 6 4 1
1/16
3x3 Kernel3x3 Kernel
1/256
5x5 Kernel5x5 Kernel
1D Gaussian Filter1D Gaussian Filter
Sweep The ImageSweep The Image
Image FiltersMean FilterMean Filter
To replace each pixel value in an image with the mean (`average')
value of its neighbors
Kernel: represents the shape and size of the neighborhood
1/9 1/9 1/9
Multimedia Systems, Mahdi Amiri, Image IIPage 5
1/9 1/9 1/9
1/9 1/9 1/9
1/9 1/9 1/9
Typ. Mean Filter Typ. Mean Filter
KernelKernel
A halftone printA halftone print Mean filteredMean filtered
Image FiltersMedian FilterMedian Filter
Replacing each entry with the median of neighboring entries
Nonlinear digital filtering technique
Used to remove noise
Pro: under certain conditions, it preserves edges while removing
noise
Multimedia Systems, Mahdi Amiri, Image IIPage 6
noise
1D Example: Input: x = [2 80 6 3], Window size: 3Input: x = [2 80 6 3], Window size: 3
The median filtered output signal y:The median filtered output signal y:
y[1] = Median[2 2 80] = 2 (Left padding with 2)y[1] = Median[2 2 80] = 2 (Left padding with 2)
y[2] = Median[2 80 6] = Median[2 6 80] = 6y[2] = Median[2 80 6] = Median[2 6 80] = 6
y[3] = Median[80 6 3] = Median[3 6 80] = 6y[3] = Median[80 6 3] = Median[3 6 80] = 6
y[4] = Median[6 3 3] = Median[3 3 6] = 3 (Right padding with 3)y[4] = Median[6 3 3] = Median[3 3 6] = 3 (Right padding with 3)
i.e. y = [2 6 6 3].i.e. y = [2 6 6 3].
Median Filter
2D Median Filter Example2D Median Filter Example
Multimedia Systems, Mahdi Amiri, Image IIPage 7
Input ImageInput Image Mean Filtered ImageMean Filtered Image Median Median FilterdFilterd ImageImage
Box FilteringOriginal unfiltered imageOriginal unfiltered image
Multimedia Systems, Mahdi Amiri, Image IIPage 8
0 0 0
0 1 0
0 0 0
KernelKernel
Box FilteringExample Java CodeExample Java Code
public int[] BoxFiltering(
int[] pixels,int width, int height, float[] kernel) {
int[] temp = new int[width*height] ;
float denominator = 0.0f ;
float red, green, blue ;
int ired, igreen, iblue, indexOffset, rgb ;
int[] indices = {
-(width + 1), -width, -(width - 1),
-1, 0, +1
, width – 1, width, width + 1
} ;
[Part A]
red = green = blue = 0.0f ;
indexOffset = (i*width)+j ;
for (int k=0;k<kernel.length;k++) {
rgb = pixels[indexOffset+indices[k]] ;
red += ((rgb & 0xff0000)>>16)*kernel[k] ;
green += ((rgb & 0xff00)>>8)*kernel[k] ;
blue += (rgb & 0xff)*kernel[k] ;
}
ired = (int)(red / denominator) ;
igreen = (int)(green / denominator) ;
SeeSee
http://techhttp://tech--algorithm.com/articles/boxfilteringalgorithm.com/articles/boxfiltering--
interactiveinteractive--applet/applet/
Multimedia Systems, Mahdi Amiri, Image IIPage 9
} ;
for (int i=0;i<kernel.length;i++)
denominator += kernel[i] ;
if (denominator==0.0f) denominator = 1.0f ;
for (int i=1;i<height-1;i++) {
for (int j=1;j<width-1;j++) {
[Include Part A]
}
}
return temp ; }
igreen = (int)(green / denominator) ;
iblue = (int)(blue / denominator) ;
if (ired>0xff) ired = 0xff ;
else if (ired<0) ired = 0 ;
if (igreen>0xff) igreen = 0xff ;
else if (igreen<0) igreen = 0 ;
if (iblue>0xff) iblue = 0xff ;
else if (iblue<0) iblue = 0 ;
temp[indexOffset] = 0xff000000 | ((ired<<16) &
0xff0000) |
((igreen<<8) & 0xff00) | (iblue & 0xff) ;
The parameter pixels is an array containing a total of width*height pixel information. The parameter kernel is an array with The parameter pixels is an array containing a total of width*height pixel information. The parameter kernel is an array with a fa fixed ixed
length of nine. This is because the implementation assumes a window of size 3x3. The function also assume each pixel is in thlength of nine. This is because the implementation assumes a window of size 3x3. The function also assume each pixel is in the e
form ARGB (alpha, red, green, blue), where blue is the least significant byte. Alpha is the transparency information and shouform ARGB (alpha, red, green, blue), where blue is the least significant byte. Alpha is the transparency information and should ld just just
be left untouched. The array indices is a simple optimization table used to find neighboring pixels. The denominator is the sbe left untouched. The array indices is a simple optimization table used to find neighboring pixels. The denominator is the sum um of of
parameter kernel, it will be the denominator when calculating average.parameter kernel, it will be the denominator when calculating average.
Box FilteringSmoothing (~ Mean Filter)Smoothing (~ Mean Filter)
1 1 1
1 2 1
1 1 1
KernelKernel(without denominator)(without denominator)
1/10 1/10 1/10
1/10 2/10 1/10
1/10 1/10 1/10
KernelKernel(with denominator)(with denominator)
Multimedia Systems, Mahdi Amiri, Image IIPage 10
0 0 0
0 1 0
0 0 0
1 1 11/10 1/10 1/10
Box FilteringSharpening (Edge Enhancement)Sharpening (Edge Enhancement)
-1 -1 -1
-1 9 -1
-1 -1 -1
KernelKernel(without denominator)(without denominator)
Multimedia Systems, Mahdi Amiri, Image IIPage 11
-1 -1 -1
0 0 0
0 1 0
0 0 0
Box FilteringRaisedRaised
0 0 -2
0 2 0
1 0 0
KernelKernel(without denominator)(without denominator)
Multimedia Systems, Mahdi Amiri, Image IIPage 12
0 0 0
0 1 0
0 0 0
1 0 0
Box FilteringMotion BlurMotion Blur
0 0 1
0 0 0
1 0 0
KernelKernel(without denominator)(without denominator)
Multimedia Systems, Mahdi Amiri, Image IIPage 13
0 0 0
0 1 0
0 0 0
1 0 0
Box FilteringEdge DetectionEdge Detection
KernelKernel(without denominator)(without denominator)
-1 -1 -1
-1 8 -1
-1 -1 -1
Multimedia Systems, Mahdi Amiri, Image IIPage 14
0 0 0
0 1 0
0 0 0
-1 -1 -1
Image EnhancementDespeckleDespeckle
Speckle detection and deletion.
Allows the removal of speckle in scanned or faxed
images. The speckle is the presence of black points of noise
in images acquired by a scanner or received by fax.
Multimedia Systems, Mahdi Amiri, Image IIPage 15
Image EnhancementMorphological OperationsMorphological Operations
Mathematical morphology is a set-theoretical approach to multi-
dimensional digital signal or image analysis, based on shape. The signals
are locally compared with so-called structuring elements S of arbitrary
shape with a reference point R.
We will define these operations without any mathematical rigour, For a
binary image:
Erosion: The eroded image of an object O with respect to a structuring
element S with a reference point R, O����S , is the set of all reference points
for which S is completely contained in O.
structuring
element
Ref.: ikpe1101.ikp.kfa-juelich.de/briefbook_data_analysis/node178.html
Multimedia Systems, Mahdi Amiri, Image IIPage 16
for which S is completely contained in O.
Dilation: The dilated image of an object O with respect to a structuring
element S with a reference point R, O����S , is the set of all reference points
for which O and S have at least one common point.
Opening: Is defined as an erosion, followed by a dilation: (O����S)����S
Closing: Is defined as a dilation, followed by an erosion: (O����S)����S
Sample structuring elements
Morphological OperationsA Simple ExampleA Simple Example
Structural
element
(SE)
Multimedia Systems, Mahdi Amiri, Image IIPage 17
Erosion with Z8 Dilation with Z8
Other example application: Major preprocessing step for
object tracking or optical character recognition.
Morphological OperationsExample ApplicationExample Application
original frame
Color filtering based object tracking application example
Multimedia Systems, Mahdi Amiri, Image IIPage 18
HSV thresholded image
H: 32-256, S: 142-196, V: 0-256After erosion and dilation (opening)
Erosion SE: 3×3 Rect. (Z8)
Dilation SE: 8×8 Rect. (Z8)
Now the desired object can be detected by
finding the largest closed area.
original frame
(zoomed-out)
640×480
Color AdjustmentsExample of color correction in PhotoshopExample of color correction in Photoshop
Multimedia Systems, Mahdi Amiri, Image IIPage 19
White balancing
method for color
correction is shown in
the next slid.
White BalancingColor TemperatureColor Temperature
Note: 25°C (Celsius )
(about 77° Fahrenheit or 298 Kelvin)
Multimedia Systems, Mahdi Amiri, Image IIPage 20
Color Temperature comparison Color Temperature comparison
of common electric lamps of common electric lamps
(Warmer light ~ Lower color (Warmer light ~ Lower color
temperature)temperature)
Color Temperature: Based on the
color given off by a glowing hot
piece of platinum.
When moving from a bright daylight environment to a room lit by a candle, our When moving from a bright daylight environment to a room lit by a candle, our
brain can quickly adjust to the changes, making white appear white, whereas brain can quickly adjust to the changes, making white appear white, whereas
film is balanced for one particular color and anything that deviates from this will film is balanced for one particular color and anything that deviates from this will
produce a color cast.produce a color cast.
Incorrect white balance Correct white balance
Using portable references for white balancing
Example for the psychological effects of color: A warmer (i.e., lower color temperature) Example for the psychological effects of color: A warmer (i.e., lower color temperature)
light is often used in public areas to promote relaxation, while a cooler (higher color light is often used in public areas to promote relaxation, while a cooler (higher color
temperature) light is used to enhance concentration in offices.temperature) light is used to enhance concentration in offices.
Color TemperatureThe Psychology of ColorThe Psychology of Color
While perceptions of color are somewhat
subjective, there are some color effects
that have universal meaning.
Multimedia Systems, Mahdi Amiri, Image IIPage 21
Source: www.100wpthemes.com/building-website/wordpress-tips
/how-to-choose-a-color-scheme-for-your-wordpress-theme/
Office: Blue, Most productive color.
Bedroom: Green, Tranquility and Health.
Girl's Room: Pink, Calming, Warm.
Kitchen: Yellow, Increases metabolism, brightens room,
gives you energy.
Living Room: Lavender (pale purple), Calms the nerves,
allows relaxation.
Dining Room: Red, Encourages appetite.
Image EnhancementRealReal--time Filteringtime Filtering
Application
HD video conferencing, multi-focus imaging
Multimedia Systems, Mahdi Amiri, Image IIPage 23
Image EditorsPaint.NETPaint.NET
Paint.NET is a proprietary freeware raster graphics editor program
for Microsoft Windows, developed on the .NET Framework.
http://www.getpaint.net/http://www.getpaint.net/
Multimedia Systems, Mahdi Amiri, Image IIPage 24
Image EditorsGIMPGIMP
GIMP (short for the GNU Image Manipulation Program) is a free software
raster graphics editor. (Microsoft's Windows, Apple's Mac OS X, GNU/Linux)
http://www.gimp.org/http://www.gimp.org/
Multimedia Systems, Mahdi Amiri, Image IIPage 25
SeeSee: http://en.wikipedia.org/wiki/Comparison_of_raster_graphics_editors: http://en.wikipedia.org/wiki/Comparison_of_raster_graphics_editors
GIMP 2.2.8 running under X11 on Mac OS XGIMP 2.2.8 running under X11 on Mac OS X GIMP 2.6 running on GIMP 2.6 running on UbuntuUbuntu
Recommended