cs6825: point processing
DESCRIPTION
CS6825: Point Processing. Contents – not complete. What is point processing? Altering/TRANSFORMING the image at a pixel only as a function of that pixel itself. Negative images Thresholding Logarithmic transformation Power law transforms Grey level slicing Bit plane slicing. - PowerPoint PPT PresentationTRANSCRIPT
CS6825: Point CS6825: Point ProcessingProcessing
Contents – not completeContents – not complete What is point processing?What is point processing?
• Altering/TRANSFORMING the image at a pixel Altering/TRANSFORMING the image at a pixel only as a function of that pixel itself.only as a function of that pixel itself.
Negative imagesNegative images ThresholdingThresholding Logarithmic transformationLogarithmic transformation Power law transformsPower law transforms Grey level slicingGrey level slicing Bit plane slicingBit plane slicing
Why Transform images?Why Transform images? Image has noise in itImage has noise in it Image is low contrastImage is low contrast Want to find things in an imageWant to find things in an image Want to emphasize things in an imageWant to emphasize things in an image Want to remove things in an imageWant to remove things in an image Want to de-emphasize things in an Want to de-emphasize things in an
imageimage For fun?For fun?
What are we doing in this What are we doing in this lecturelecture
Teaching you what image transformation Teaching you what image transformation at a point is.at a point is.
Showing you a number of common (but, Showing you a number of common (but, by no means alls) point-based transformsby no means alls) point-based transforms
Hopefully, you will understand, Hopefully, you will understand, “You must “You must know why you want to transform and know why you want to transform and image first. Then hopefully you can image first. Then hopefully you can remember these transforms to see if any remember these transforms to see if any will work for you”.will work for you”.
2 basic kinds of Point 2 basic kinds of Point ProcessingProcessing
Spatial ProcessingSpatial Processing Pixel values are directly changed in the 2D Pixel values are directly changed in the 2D
array of pixel values we use to represent an array of pixel values we use to represent an image.image.
This 2D of array of pixel values is referred to This 2D of array of pixel values is referred to as the image SPATIAL DOMAIN.as the image SPATIAL DOMAIN.
The word SPATIAL comes from the fact as The word SPATIAL comes from the fact as we move through the image in x and y we move through the image in x and y directions it is moving through the space of directions it is moving through the space of the image.the image.
2 basic kinds of Point 2 basic kinds of Point ProcessingProcessing
Frequency ProcessingFrequency Processing We will discuss this later in classWe will discuss this later in class For now, just like you have radio signals that For now, just like you have radio signals that
could be shown in the spatial domain, you could be shown in the spatial domain, you also can represent them in the frequency also can represent them in the frequency domain.....Remember you tune into radio domain.....Remember you tune into radio stations by frequency!stations by frequency!
Again we will discuss this later.Again we will discuss this later.
Spatial domain Frequency Domain
General Spatial ProcessingGeneral Spatial Processing
Origin x
y Image f (x, y)
(x, y)
Spatial Processing Algorithms can be Spatial Processing Algorithms can be reduced to the formreduced to the formg (x, y) = T[ f (x, y)]g (x, y) = T[ f (x, y)]
where where f (x, y)f (x, y) is the is the input image, input image, g (x, y)g (x, y) is is the processed image the processed image and and TT is some is some operator defined over operator defined over some neighbourhood some neighbourhood of of (x, y)(x, y)
Point Processing Spatial Point Processing Spatial ProcessingProcessing
The simplest spatial domain The simplest spatial domain operations occur when the operations occur when the neighbourhood is simply the pixel neighbourhood is simply the pixel itselfitself
In this case In this case TT is referred to as a is referred to as a point point processing operationprocessing operation
Point processing operations take the Point processing operations take the formform
PPnewnew(r,c) = T ( P(r,c) )(r,c) = T ( P(r,c) )
Point Processing Spatial Point Processing Spatial ProcessingProcessing
We will discuss:We will discuss:• Negative Image TransformationNegative Image Transformation• ThresholdingThresholding• General Kinds of TransformationsGeneral Kinds of Transformations• Contrast StretchingContrast Stretching• Piecewise Linear transformationsPiecewise Linear transformations• Grey Level SlicingGrey Level Slicing• Logarithmic transformationsLogarithmic transformations• Power Law transformationsPower Law transformations• Gamma correctionGamma correction
Note: We will discuss histograms and more point-based Note: We will discuss histograms and more point-based operations related to it in a future lectureoperations related to it in a future lecture
Point Processing Example: Point Processing Example: Negative ImagesNegative Images
Negative images enhancing white or grey Negative images enhancing white or grey detail embedded in dark regions of an imagedetail embedded in dark regions of an image• Note how much clearer tissue is in the negative Note how much clearer tissue is in the negative
image belowimage below
Pnew = 255 - POriginal
ImageNegative Image
Ima
ge
s ta
ken
fro
m G
on
zale
z &
Wo
od
s, D
igita
l Im
ag
e P
roce
ssin
g (
20
02
)
Point Processing Example: Point Processing Example: ThresholdingThresholding
Thresholding transformations are Thresholding transformations are useful for segmentation in which we useful for segmentation in which we want to isolate/emphasize an object want to isolate/emphasize an object of interest from a backgroundof interest from a background
Result called “BINARY” image.Result called “BINARY” image.
Pnew = 255.0
0.0 r <= threshold
r > threshold
Ima
ge
s ta
ken
fro
m G
on
zale
z &
Wo
od
s, D
igita
l Im
ag
e P
roce
ssin
g (
20
02
)
Basic Grey Level Basic Grey Level TransformationsTransformations
There are many different kinds of grey level There are many different kinds of grey level transformationstransformations
Three of the most Three of the most common are shown common are shown herehere• Linear Linear
i.e. Negative/Identityi.e. Negative/Identity
• LogarithmicLogarithmic i.e. Log/Inverse logi.e. Log/Inverse log
• Power lawPower law nnthth power/n power/nthth root root
Ima
ge
s ta
ken
fro
m G
on
zale
z &
Wo
od
s, D
igita
l Im
ag
e P
roce
ssin
g (
20
02
)
Contrast Stretching for Low-Contrast Stretching for Low-Contrast ImagesContrast Images
Have an image of low contrast Have an image of low contrast Image has only a small number of grey levels (or Image has only a small number of grey levels (or
colors)colors)
Stretch the over-concentrated grey levels Stretch the over-concentrated grey levels via a nonlinear mappingvia a nonlinear mapping• One technique - Piece-wise linear stretching functionOne technique - Piece-wise linear stretching function• Assign slopes of the stretching region to be greater Assign slopes of the stretching region to be greater
than 1than 1
input gray level u
outp
ut g
ray
leve
lv
a bo
Note: a to b in the inputgrey levels get stretched to theLarger range of to .
Piecewise Linear TransformationPiecewise Linear Transformation We use user-defined transforms, defined by a We use user-defined transforms, defined by a
set of lines “pieced” together….piecewise set of lines “pieced” together….piecewise linear.linear.
The images below show a contrast stretching The images below show a contrast stretching linear transform to add contrast to a poor linear transform to add contrast to a poor quality imagequality image
Ima
ge
s ta
ken
fro
m G
on
zale
z &
Wo
od
s, D
igita
l Im
ag
e P
roce
ssin
g (
20
02
)
Gray Level SlicingGray Level Slicing Highlights a specific range of grey Highlights a specific range of grey
levelslevels• Similar to thresholdingSimilar to thresholding• Other levels can be Other levels can be
suppressed or maintainedsuppressed or maintained• Useful for highlighting featuresUseful for highlighting features
in an imagein an image
Ima
ge
s ta
ken
fro
m G
on
zale
z &
Wo
od
s, D
igita
l Im
ag
e P
roce
ssin
g (
20
02
)
Logarithmic TransformationsLogarithmic Transformations
The general form of the log The general form of the log transformation is transformation is
PPnewnew = c * log(1 +P) = c * log(1 +P) The log transformation maps a narrow The log transformation maps a narrow
range of low input grey level values range of low input grey level values into a wider range of output valuesinto a wider range of output values
The inverse log transformation The inverse log transformation performs the opposite transformationperforms the opposite transformation
Logarithmic TransformationsLogarithmic Transformations
In the following example the Fourier In the following example the Fourier transform of an image is put through transform of an image is put through a log transform to reveal more detaila log transform to reveal more detail
Pnew = log(1 + P)
Ima
ge
s ta
ken
fro
m G
on
zale
z &
Wo
od
s, D
igita
l Im
ag
e P
roce
ssin
g (
20
02
)
Power Law TransformationsPower Law Transformations Power law transformations have the Power law transformations have the
following formfollowing form PPnewnew = c * P = c * P γγ
Map a narrow range Map a narrow range of dark input values of dark input values into a wider range of into a wider range of output values or vice output values or vice versaversa
Varying Varying γγ gives a whole gives a whole family of curvesfamily of curvesIm
ag
es
take
n f
rom
Go
nza
lez
& W
oo
ds,
Dig
ital I
ma
ge
Pro
cess
ing
(2
00
2)
Power Law ExamplePower Law Example
Original Transformed
00.10.20.30.40.50.60.70.80.9
1
0 0.2 0.4 0.6 0.8 1
Old Intensities
Tra
nsf
orm
ed I
nte
nsi
ties
γ = 0.6
Power Law Example (cont…)Power Law Example (cont…)
γ = 0.4
00.10.20.30.40.50.60.70.80.9
1
0 0.2 0.4 0.6 0.8 1
Original Intensities
Tra
nsf
orm
ed I
nte
nsi
ties
Power Law Example (cont…)Power Law Example (cont…)
γ = 0.3
00.10.20.30.40.50.60.70.80.9
1
0 0.2 0.4 0.6 0.8 1
Original Intensities
Tra
nsf
orm
ed I
nte
nsi
ties
Power Law Example (cont…)Power Law Example (cont…) The images to the The images to the
right show a right show a magnetic resonance magnetic resonance (MR) image of a (MR) image of a fractured human fractured human spine spine
Different curves Different curves highlight different highlight different detaildetail
s = r 0.6
s = r 0.4
s = r 0.3
Ima
ge
s ta
ken
fro
m G
on
zale
z &
Wo
od
s, D
igita
l Im
ag
e P
roce
ssin
g (
20
02
)
Power Law ExamplePower Law Example
Power Law Example (cont…)Power Law Example (cont…)
γ = 5.0
00.10.20.30.40.50.60.70.80.9
1
0 0.2 0.4 0.6 0.8 1
Original Intensities
Tra
nsf
orm
ed I
nte
nsi
ties
Power Law ExamplePower Law Example An aerial photo An aerial photo
of a runway is of a runway is shownshown
This time This time power law power law transforms are transforms are used to darken used to darken the imagethe image
Different curves Different curves highlight highlight different detaildifferent detail
Ima
ge
s ta
ken
fro
m G
on
zale
z &
Wo
od
s, D
igita
l Im
ag
e P
roce
ssin
g (
20
02
)
s = r 3.0
s = r 4.0
s = r 5.0
Gamma CorrectionGamma Correction Many of you might be familiar with Many of you might be familiar with
gamma correction of computer gamma correction of computer monitorsmonitors
Problem is thatProblem is thatdisplay devices do display devices do not respond linearly not respond linearly to different to different intensitiesintensities
Can be corrected Can be corrected using a log using a log transformtransform
Ima
ge
s ta
ken
fro
m G
on
zale
z &
Wo
od
s, D
igita
l Im
ag
e P
roce
ssin
g (
20
02
)
Gamma Correction Gamma Correction One can form an approximate model for One can form an approximate model for
displayed luminance displayed luminance LiLi due to the due to the excitation of gun excitation of gun ii with voltage with voltage VVii for a for a Monitor as: Monitor as:
Typically, 1< Gamma Typically, 1< Gamma γγ <= 2.5 , standard Gamma = <= 2.5 , standard Gamma = 2.2 2.2
Original image Gamma correction= 1.5
Gamma Correction Gamma Correction
New Image pixel = (Original Image pixel )New Image pixel = (Original Image pixel ) --γγ
New Image pixel = (Original Image pixel )^-1.5New Image pixel = (Original Image pixel )^-1.5
Original image New ImageGamma correction= 1.5
Gamma Correction ExamplesGamma Correction Examples Here is an example at different gammas.Here is an example at different gammas.
L0, gamma= 1
L02.2, gamma = 1/(2.2) L0
1/2.2 , gamma = 2.2
This is the best gamma
Bit Plane SlicingBit Plane Slicing
Often by isolating particular bits of the Often by isolating particular bits of the pixel values in an image we can highlight pixel values in an image we can highlight interesting aspects of that imageinteresting aspects of that image• Higher-order bits usually contain most of the Higher-order bits usually contain most of the
significant visual informationsignificant visual information• Lower-order bits containLower-order bits contain
subtle detailssubtle details
Ima
ge
s ta
ken
fro
m G
on
zale
z &
Wo
od
s, D
igita
l Im
ag
e P
roce
ssin
g (
20
02
)
Bit Plane Slicing ExampleBit Plane Slicing ExampleIm
ag
es
take
n f
rom
Go
nza
lez
& W
oo
ds,
Dig
ital I
ma
ge
Pro
cess
ing
(2
00
2)
[10000000] [01000000]
[00100000][00001000]
[00000100] [00000001]
[00010000]
[00000010]
SummarySummary There are many more transformations. There are many more transformations.
We will see some later in classWe will see some later in class We concentrated on some common point-We concentrated on some common point-
based transformations in the spatial based transformations in the spatial domain.domain.
Know what your problem is and then Know what your problem is and then decide on or if there is transformation that decide on or if there is transformation that can help.can help.
Your class website has some other Your class website has some other material that explores this.material that explores this.