25
Multimedia Systems Multimedia Systems Image II Image II (Image Enhancement) (Image Enhancement) Course Presentation Course Presentation (Image Enhancement) (Image Enhancement) Mahdi Amiri April 2013 Sharif University of Technology

Lec08, Image II (Enhancement), v1.05.ppt

  • Upload
    others

  • View
    12

  • Download
    0

Embed Size (px)

Citation preview

Microsoft PowerPoint - Lec08, Image II (Enhancement), v1.05.ppt [Compatibility Mode]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
Note: Enhancement vs. Restoration
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.
Multimedia Systems, Mahdi Amiri, Image IIPage 2
Gamma CorrectionGamma Correction Histogram EqualizationHistogram Equalization
Image Enhancement Image 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 Filters Gaussian 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
22D Gaussian FilterD Gaussian Filter
1 2 1
2 4 2
1 2 1
1/16
11D Gaussian FilterD Gaussian Filter
Sweep The ImageSweep The Image
Image Filters Mean FilterMean Filter
To replace each pixel value in an image with the mean (`average')
value of its neighbors
1/9 1/9 1/9
1/9 1/9 1/9
1/9 1/9 1/9
1/9 1/9 1/9
KernelKernel
Image Filters Median FilterMedian Filter
Replacing each entry with the median of neighboring entries
Nonlinear digital filtering technique
Used to remove noise
noise
noise
1D Example: Input: x = [Input: x = [2 80 6 32 80 6 3], Window size: ], Window size: 33
The median filtered output signal y:The median filtered output signal y:
y[y[11] = Median[] = Median[2 2 802 2 80] = ] = 2 2 (Left padding with (Left padding with 22))
y[y[22] = Median[] = Median[2 80 62 80 6] = Median[] = Median[2 6 802 6 80] = ] = 66
y[y[33] = Median[] = Median[80 6 380 6 3] = Median[] = Median[3 6 803 6 80] = ] = 66
y[y[44] = Median[] = Median[6 3 36 3 3] = Median[] = Median[3 3 63 3 6] = ] = 3 3 (Right padding with (Right padding with 33))
i.e. y = [i.e. y = [2 6 6 32 6 6 3].].
Median Filter
Input ImageInput Image Mean Filtered ImageMean Filtered Image Median Median FilterdFilterd ImageImage
Box Filtering Original unfiltered imageOriginal unfiltered image
Multimedia Systems, Mahdi Amiri, Image IIPage 8
0 0 0
0 1 0
0 0 0
public int[] BoxFiltering(
int[] temp = new int[width*height] ;
float denominator = 0.0f ;
int[] indices = {
-1, 0, +1
} ;
red += ((rgb & 0xff0000)>>16)*kernel[k] ;
green += ((rgb & 0xff00)>>8)*kernel[k] ;
blue += (rgb & 0xff)*kernel[k] ;
}
} ;
denominator += kernel[i] ;
[Include Part A]
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 length of nine. This is because the implementation assumes a window of size 33xx33. The function also assume each pixel is in the . The function also assume each pixel is in the
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 Filtering Smoothing (~ Mean Filter)Smoothing (~ Mean Filter)
1 1 1
1 2 1
1 1 1
0 0 0
0 1 0
0 0 0
Box Filtering Sharpening (Edge Enhancement)Sharpening (Edge Enhancement)
-1 -1 -1
-1 9 -1
-1 -1 -1
-1 -1 -1
0 0 0
0 1 0
0 0 0
Box Filtering RaisedRaised
0 0 -2
0 2 0
1 0 0
0 0 0
0 1 0
0 0 0
1 0 0
0 0 1
0 0 0
1 0 0
0 0 0
0 1 0
0 0 0
1 0 0
KernelKernel ((without denominator)without denominator)
0 0 0
0 1 0
0 0 0
-1 -1 -1
Image Enhancement DespeckleDespeckle
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 Enhancement Morphological 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, OS , is the set of all reference points
for which S is completely contained in O.
structuring
element
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, OS , 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: (OS)S
Closing: Is defined as a dilation, followed by an erosion: (OS)S
Sample structuring elements
Structural
element
(SE)
Erosion with Z8 Dilation with Z8
Other example application: Major preprocessing step for
object tracking or optical character recognition.
Morphological Operations Example ApplicationExample Application
original frame
HSV thresholded image
H: 32-256, S: 142-196, V: 0-256 After 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
640×480
Color Adjustments Example of color correction in Example of color correction in PPhotoshophotoshop
Multimedia Systems, Mahdi Amiri, Image IIPage 19
White balancing
Note: 25°C (Celsius )
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 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.
Image Enhancement RealReal--time Filteringtime Filtering
Application
Multimedia Systems, Mahdi Amiri, Image IIPage 21
Image Editors Paint.NETPaint.NET
for Microsoft Windows, developed on the .NET Framework.
http://www.getpaint.net/http://www.getpaint.net/
Image Editors GIMPGIMP
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/
SeeSee: http://en.wikipedia.org/wiki/Comparison_of_raster_graphics_editors: http://en.wikipedia.org/wiki/Comparison_of_raster_graphics_editors
GIMP GIMP 22..22..8 8 running under Xrunning under X11 11 on Mac OS Xon Mac OS X GIMP GIMP 22..6 6 running on running on UbuntuUbuntu
Thank You
Thank You