Upload
jesse-bradley
View
221
Download
0
Embed Size (px)
Citation preview
CS6825: CS6825: More Dealings with Probability More Dealings with Probability
Expected Values (signal prediction), Expected Values (signal prediction), Mean Squared Error (signal error), Mean Squared Error (signal error), Crosscorrelation function (signal similarity) Crosscorrelation function (signal similarity)
Predicting Image valuesPredicting Image values
Sometimes you may want to model image Sometimes you may want to model image values….to predict the chance of an image values….to predict the chance of an image value.value.
We discussed the Probability function as one We discussed the Probability function as one way.way.
Another metric used with probability is--- the Another metric used with probability is--- the Expected Value …Expected Value …here the image value is here the image value is treated as a treated as a random variablerandom variable
Expect value = Mean valueExpect value = Mean value
Expected Image valuesExpected Image values
Expected value of a Expected value of a random variable random variable is the integral of the random variable is the integral of the random variable with respect to its probability (with respect to its probability (definition from definition from
wikipedia) wikipedia) measure measure
The Expected Value of an image f is The Expected Value of an image f is represented mathematically as:represented mathematically as:
i
iPfE ) = weighted sum of possible values, weighted by Probability()( i
Where P is the probability function of the image f.
Expected ValueExpected Value
You will see the use of E(f) = You will see the use of E(f) = expected value of image in many expected value of image in many algorithms.algorithms.
Changing subjects--- Changing subjects--- Signal ErrorSignal Error
A useful concept that can be related A useful concept that can be related to probability is signal (image) error.to probability is signal (image) error.
Error in Images (or any signal)Error in Images (or any signal)
Sensor ErrorsSensor Errors Transmission ErrorsTransmission Errors Human Operator ErrorsHuman Operator Errors
What to do?What to do?
Understand you error – measure itUnderstand you error – measure it Try to recover from the errorTry to recover from the error
• In case of images at the low-level part of In case of images at the low-level part of a vision system (the beginning) this a vision system (the beginning) this might be applying filters to try to might be applying filters to try to recover as close as possible the original recover as close as possible the original signal. (signal. (note we will talk about such filters in our lecture on noisenote we will talk about such filters in our lecture on noise))
Measuring ErrorMeasuring Error
Error can be random or can follow a Error can be random or can follow a trendtrend..
Trends Trends generally we model with some generally we model with some kind of kind of statistical modelstatistical model. That means . That means probability.probability.
Common metric = Common metric = MeanMean Squared Error. Squared Error.
(recall we equated Expected value E(f) = Mean of f)
Measuring ErrorMeasuring Error
We could simple measure error as the difference in We could simple measure error as the difference in the received signal the received signal ff and the original signal and the original signal s. s. Error = f-sError = f-s
Problem Problem f-gf-g could be negative. could be negative.• Well …square it = (f-s)*(f-s)Well …square it = (f-s)*(f-s)
Problem if the images are changing over time (Problem if the images are changing over time (most most applications this is the case..outdoor scenes, manufacturing applications this is the case..outdoor scenes, manufacturing
conveyor beltconveyor belt))• Error = E((f-s)*(f-s)) = Error = E((f-s)*(f-s)) = Mean Squared ErrorMean Squared Error
Using MSE to improve thingsUsing MSE to improve things
PROPOSAL: create a filter PROPOSAL: create a filter HH to to produce a new image produce a new image gg that will that will hopefully be more like hopefully be more like ss
?? Can we use Mean Squared ?? Can we use Mean Squared Error to help us??Error to help us??
s(x,y) = image no noise
f(x,y) = input image we are given with noise and other distortions
g(x,y) = new image we produce through filtering with H that we hope is more like s
Minimizing Mean Squared ErrorMinimizing Mean Squared Error
SOLUTION: calculate H to minimize the MSESOLUTION: calculate H to minimize the MSE
Now the math starts!....Now the math starts!....fun…we will see an instancefun…we will see an instance
of this problem later in the Noise Lectureof this problem later in the Noise Lecture
with the application of the Wienner Filter forwith the application of the Wienner Filter for
reducing image blurreducing image blur
Moving On – Signal SimilarityMoving On – Signal Similarity
Moving on…..lets look at a concept that can use Moving on…..lets look at a concept that can use probability - Signal similarity.probability - Signal similarity.
Suppose you have an image of a tank you want to Suppose you have an image of a tank you want to recognize.recognize.
Possible Solution: take an image of the scene and Possible Solution: take an image of the scene and see if this image is present or similar to the tank see if this image is present or similar to the tank image.image.
Signal Similarity as Pattern Signal Similarity as Pattern RecognitionRecognition
Possible Solution: take an image of the Possible Solution: take an image of the scene and see if this image is present scene and see if this image is present or similar to the tank image.or similar to the tank image.
This is a simple (crude) form of Pattern This is a simple (crude) form of Pattern Recognition.Recognition.
Signal Similarity as Error Signal Similarity as Error Reduction MeasureReduction Measure
Another Use of Signal Similarity--- Another Use of Signal Similarity--- related to error.related to error.
If the signal If the signal gg is similar to is similar to ss then we then we have reduced the error.have reduced the error.
Signal Similarity – expressed as Signal Similarity – expressed as CrosscorrelationCrosscorrelation
You may want to know how similar the signal g is to You may want to know how similar the signal g is to the original s. This can be measured by the the original s. This can be measured by the statistical function called the statistical function called the CROSS CORRELATION.CROSS CORRELATION.
The The more similarmore similar g and s are, the g and s are, the less error less error there is.there is.
Crosscorrelation - similarity in s Crosscorrelation - similarity in s and g.and g.
i,ji,j are the 2D shift we are moving the signals apart by. are the 2D shift we are moving the signals apart by. i,ji,j are the are the correlation variablescorrelation variables..
If g=s or very similar to g we get a peak (not necessarily the If g=s or very similar to g we get a peak (not necessarily the largest/maximum) at the value largest/maximum) at the value i=0, j=0 i=0, j=0 which is not true usually which is not true usually if s and g are dissimilarif s and g are dissimilar..
Hence, if a local maximum at Hence, if a local maximum at i=0,j=0i=0,j=0 there is some similarity there is some similarity between the two, if this is global maximum it may be s=gbetween the two, if this is global maximum it may be s=g
i
s(r,c) * g(r+i, j+c) s g [i,j] j
Crosscorrelation - if similar why Crosscorrelation - if similar why a peak at a peak at i=0, j=0i=0, j=0
To make it easier to understand, lets think of one row of an image (a To make it easier to understand, lets think of one row of an image (a 1D signal…1D signal…jj only only). Suppose we have the ). Suppose we have the s(j)s(j) function function
Now, let’s Now, let’s suppose we have g be identical to s suppose we have g be identical to s (the best we can (the best we can have). This is what will look like.have). This is what will look like.
Maximum is at j=0 but, note it is not 0 for other j.Maximum is at j=0 but, note it is not 0 for other j.
j
s g [j]
s( c)
s g [j]
Maximum at j = 0
s(c) * g(j+c) s g [j]
Crosscorrelation - if similar why Crosscorrelation - if similar why a peak at a peak at i=0, j=0i=0, j=0
jj = 0 is a peak = 0 is a peak
jj = 30 is NOT = 30 is NOT a peak a peak
f( c)
f g [i]
f(c) * g(j+c) f g [j]
g( 0+c)
f( c)
g(30+c)
What is happening when there is no overlap….the signal ends…one option is to multiple by 0.
Signal Similarity with Signal Similarity with CrosscorrelationCrosscorrelation
We will see this later when we look atWe will see this later when we look atremoving blur in images to try to makeremoving blur in images to try to makeimage more similar to original.image more similar to original.
This will be the Wienner filter in our This will be the Wienner filter in our lecture on noise.lecture on noise.