Velocity Reviews > Calculation of snr

# Calculation of snr

Kennedy McEwen
Guest
Posts: n/a

 05-25-2008
In article <(E-Mail Removed)>, Floyd L. Davidson
<(E-Mail Removed)> writes
>Kennedy McEwen <(E-Mail Removed)> wrote:
>>In article <(E-Mail Removed)>, Floyd L. Davidson
>><(E-Mail Removed)> writes
>>>Kennedy McEwen <(E-Mail Removed)> wrote:
>>>>In article <(E-Mail Removed)>, Floyd L. Davidson
>>>><(E-Mail Removed)> writes
>>>>>Kennedy McEwen <(E-Mail Removed)> wrote:
>>>>>>In article <(E-Mail Removed)>, Floyd L. Davidson
>>>>>><(E-Mail Removed)> writes
>>>>>>>ransley <(E-Mail Removed)> wrote:
>>>>>>>>On May 22, 5:28*am, Marc Wossner <(E-Mail Removed)> wrote:
>>>>>>>>>
>>>>>>>>> SNR = 20 log (Signal RMS / Noise RMS)
>>>>>>>
>>>>>>>dB has no particular attachment to sound, any more than
>>>>>>>it does to light. It's a ratio of two numbers, as shown
>>>>>>>in the formula above. The numbers represent signal
>>>>>>>power, regardless of what the signal actually is.
>>>>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>>
>>>Read what I wrote very carefully Kennedy; it should be
>>>very apparent that right from the start I know exactly
>>>what you are referring to.

>>
>>I have, and I think you will realise that, from the start I have
>>considered what you wrote to be ambiguous at best or indeed, if your
>>words are interpreted in a logical manner but not necessarily the manner
>>you meant, completely wrong.
>>
>>"Its a ratio of two numbers" followed by "the numbers" (ie. the SAME
>>numbers) "represent signal power, regardless..."
>>
>>That is completely wrong. "The numbers" do NOT represent signal power,
>>they are voltages. The ratio (signal / noise) is a VOLTAGE ratio.

>
>A decibel is a power ratio, by definition.
>

The DECIBEL is, but NOT the ratio of the numbers you referred to.

>>The ratio (signal^2 / noise^2) IS a power ratio,

>
>End of discussion.
>
>...
>
>>>It is a *power* ratio. That is true regardless of what
>>>the two numbers actually represent.

>>
>>No it isn't!

>
>It is a power ratio by definition.
>

Only if you follow the definition. If you don't, such as by using
numbers without regard to their meaning, exactly as you suggested, then
you are not following the definition and therefore end up with something
that is NOT a power ratio.
--
Kennedy
Yes, Socrates himself is particularly missed;
A lovely little thinker, but a bugger when he's ****ed.
Python Philosophers (replace 'nospam' with 'kennedym' when replying)

Marc Wossner
Guest
Posts: n/a

 05-25-2008
On 25 Mai, 18:04, Kennedy McEwen <(E-Mail Removed)> wrote:
> In article <(E-Mail Removed)>, Floyd L. Davidson
> <(E-Mail Removed)> writes
>
> >Kennedy McEwen <(E-Mail Removed)> wrote:
> >>In article <(E-Mail Removed)>, Floyd L. Davidson
> >><(E-Mail Removed)> writes
> >>>Kennedy McEwen <(E-Mail Removed)> wrote:
> >>>>In article <(E-Mail Removed)>, Floyd L. Davidson
> >>>><(E-Mail Removed)> writes
> >>>>>Kennedy McEwen <(E-Mail Removed)> wrote:
> >>>>>>In article <(E-Mail Removed)>, Floyd L. Davidson
> >>>>>><(E-Mail Removed)> writes
> >>>>>>>ransley <(E-Mail Removed)> wrote:
> >>>>>>>>On May 22, 5:28*am, Marc Wossner <(E-Mail Removed)> wrote:

>
> >>>>>>>>> SNR = 20 log (Signal RMS / Noise RMS)

>
> >>>>>>>dB has no particular attachment to sound, any more than
> >>>>>>>it does to light. *It's a ratio of two numbers, as shown
> >>>>>>>in the formula above. *The numbers represent signal
> >>>>>>>power, regardless of what the signal actually is.
> >>>>> * * * * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

>
> >>>Read what I wrote very carefully Kennedy; it should be
> >>>very apparent that right from the start I know exactly
> >>>what you are referring to.

>
> >>I have, and I think you will realise that, from the start I have
> >>considered what you wrote to be ambiguous at best or indeed, if your
> >>words are interpreted in a logical manner but not necessarily the manner
> >>you meant, completely wrong.

>
> >>"Its a ratio of two numbers" followed by "the numbers" (ie. the SAME
> >>numbers) "represent signal power, regardless..."

>
> >>That is completely wrong. *"The numbers" do NOT represent signal power,
> >>they are voltages. *The ratio (signal / noise) is a VOLTAGE ratio.

>
> >A decibel is a power ratio, by definition.

>
> The DECIBEL is, but NOT the ratio of the numbers you referred to.
>
> >>The ratio (signal^2 / noise^2) IS a power ratio,

>
> >End of discussion.

>
> >...

>
> >>>It is a *power* ratio. *That is true regardless of what
> >>>the two numbers actually represent.

>
> >>No it isn't!

>
> >It is a power ratio by definition.

>
> Only if you follow the definition. *If you don't, such as by using
> numbers without regard to their meaning, exactly as you suggested, then
> you are not following the definition and therefore end up with something
> that is NOT a power ratio.
> --
> Kennedy
> Yes, Socrates himself is particularly missed;
> A lovely little thinker, but a bugger when he's ****ed.
> Python Philosophers * * * * (replace 'nospam' with 'kennedym' when replying)

As this highly theoretical discussion is not so easy to follow for me,
IŽd like to bring it back to something that I can work with: If I
chose the numerator of snr to be the range available in the image
file -256 for 8-bit or 4096 for 12-bit - and the denominator to be
the standard deviation as the equivalent to RMS noise, is the form SNR
= 20 log (Signal RMS / Noise RMS) correct or should it be SNR = 10 log
(Signal RMS / Noise RMS)?

Best regards!
Marc Wossner

David J Taylor
Guest
Posts: n/a

 05-25-2008
Floyd L. Davidson wrote:
[]
> David, you still don't get it: a decibel is a power
> ratio EVERY TIME. That is by definition.
>
> You continue to use the term carelessly.

I'm not saying that I use the term that way, simply that it is common
practice.

David

Ilya Zakharevich
Guest
Posts: n/a

 05-26-2008
[A complimentary Cc of this posting was sent to
Marc Wossner
<(E-Mail Removed)>], who wrote in article <(E-Mail Removed)>:
> As this highly theoretical discussion is not so easy to follow for me,

As it is not for everybody. The recipe is very simple: DO NOT USE dB
in non-linear context; and, more specific, DO NOT USE dB in context of
light intensity.

The common usage of dB [one imported from measuring voltage in the
formal definition in context of light intensity (which is 3db =
2x-change).

What is boils down is that dB in such a context are too confusing.
Use values with logs, or use log-base-2 ("steps").

> I=B4d like to bring it back to something that I can work with: If I
> chose the numerator of snr to be the range available in the image
> file -256 for 8-bit or 4096 for 12-bit - and the denominator to be
> the standard deviation as the equivalent to RMS noise, is the form SNR
> =3D 20 log (Signal RMS / Noise RMS) correct or should it be SNR =3D 10 log
> (Signal RMS / Noise RMS)?

Hope this helps,
Ilya

Ilya Zakharevich
Guest
Posts: n/a

 05-26-2008
[A complimentary Cc of this posting was NOT [per weedlist] sent to
Floyd L. Davidson
<(E-Mail Removed)>], who wrote in article <(E-Mail Removed)>:
> >As it is not for everybody. The recipe is very simple: DO NOT USE dB
> >in non-linear context; and, more specific, DO NOT USE dB in context of
> >light intensity.

>
> And do use it for the analog output of a light sensor!

No. Since "the analog output of a light sensor" reflects the light
intensity, so do not use dB in this context.

[Again: for this analog output, the power it corresponds to (one of
incoming light) is proportional to the voltage, which, apparently,
goes agains the ingrained habits of a lot of people.]

> >The common usage of dB [one imported from measuring voltage in the
> >formal definition in context of light intensity (which is 3db =
> >2x-change).

> >What is boils down is that dB in such a context are too confusing.
> >Use values with logs, or use log-base-2 ("steps").

^^^^ ^^^^
Oups! read: "Use values without logs"

> Such as dB!

Never.

> >> I=B4d like to bring it back to something that I can work with: If I
> >> chose the numerator of snr to be the range available in the image
> >> file -256 for 8-bit or 4096 for 12-bit - and the denominator to be
> >> the standard deviation as the equivalent to RMS noise, is the form SNR
> >> =3D 20 log (Signal RMS / Noise RMS) correct or should it be SNR =3D 10 log
> >> (Signal RMS / Noise RMS)?

> >

> The digital values are derived from the analog voltages
> generated by the sensor. To get a power ratio for dB
> one can either square the digital value, or multiply the
> resulting logarithm value by 2.

Wrong. [Just another indication why one should avoid dB altogether in
this context.]

> The basic formula is:
>
> dB = 10 log ( Signal_power / Noise_power )
>
> Given a voltage measurement the power can be derived with
> either of these methods:
>
> dB = 10 * log ( Signal_voltage ^ 2 / Noise_voltage ^ 2 )
> dB = 2 * 10 * log ( Signal_voltage / Noise_voltage )

These squares/twos are as much misplaced/wrong as "S" in "RMS power".

Hope this helps,
Ilya

David J Taylor
Guest
Posts: n/a

 05-26-2008
Floyd L. Davidson wrote:
[]
> David, you listed a number of what you thought were
> examples of it not being a power ratio (dBV and dBHz are
> two that I remember), and when that was pointed out as
> an error, you gave "examples" that did not mention
> decibels and that did not even apparently involve
> decibels!
>
> As I noted to start with, what we are discussing *is*
> the most common _error_ made in using the term. Keep
> trying all you like, but it is indeed in error if it is
> not a power ratio, and you are confused when you think it
> correct and not a power ratio.

It is you who appears to be out of touch with what happens in practice.

dBHz is a ratio, plain and simple. You may wish to rationalise it as
"power" by saying its the power ratio in two bandwidths, if that helps
you.

dBV is a measure of voltage, and is /only/ a power ratio if the impedances
are the same.

dB is commonly used as a measure of gain.

dBFS is used in digital systems purely as a ratio of signal compared to
full-scale - there are no actual powers being compared.

It is because of the wide range of situations where dB is used that I urge
care.

Certainly in TV applications, the sign-to-noise ratio of the camera
channel can be measured in dB. Here you need to be careful how you define
both signal and noise (peak or RMS signal, for example). As the display
is non-linear, the power of the light produced does /not/ linearly relate
to the voltage input. So from a perceptual measure is the electronic dB
or the optical dB more important? When you measure the noise, should you
apply a perceptual weighting as is done in audio measurements?

Just more examples of why I (continue to) say that care is needed. In
this new field, there is, perhaps, more need for people need to state
their assumptions and method explicitly.

David

ASAAR
Guest
Posts: n/a

 05-26-2008
On Mon, 26 May 2008 05:31:46 GMT, David J Taylor wrote:

>> Keep trying all you like, but it is indeed in error if it is
>> not a power ratio, and you are confused when you think it
>> correct and not a power ratio.

>
> It is you who appears to be out of touch with what happens in practice.

Being out of touch and confused are just some of the side effects
of seeing the world only through Uncle Floyd's personal lense!

David J Taylor
Guest
Posts: n/a

 05-26-2008
Floyd L. Davidson wrote:
[]
> I have just short of half a century of experience in
> using dB, you are indeed describing what happens in
> practice... when people get confused by results that do
> not add up, it is commonly because of the same confusion
> you are demonstrating so well.

Yes, your experience beats mine by some four years.

[]
>> this new field, there is, perhaps, more need for people need to state
>> their assumptions and method explicitly.

>
> New field? The use of decibels in signal analysis has
> been common practice since long before either of us were
> born.

But here it is /not/ as simple as you are making out, when applied to
digital cameras, and the image quality as perceived by the eye and brain,
with non-linear displays, gamma-correction, where light power does not
produce the equivalent changes in signal power, variations with spatial
frequency, the 2D aspect, and so on. Assumptions and methods are not yet
standardised, otherwise we would have a simply way of knowing from the
specifications precisely what the "image quality index" of a particular
camera was.

The "common practice" you speak of needs to be applied rather more
carefully.

My last word to you on this subject, as it will have now become tiresome

David

Kennedy McEwen
Guest
Posts: n/a

 05-26-2008
In article <(E-Mail Removed)>, Floyd L. Davidson
<(E-Mail Removed)> writes
>Kennedy McEwen <(E-Mail Removed)> wrote:
>>>It is a power ratio by definition.
>>>

>>Only if you follow the definition. If you don't, such as by using

>
>If you don't, you are not talking about decibels, but
>something else.
>

Correct.

>>numbers without regard to their meaning, exactly as you suggested, then

>
>I was talking about *decibels*, and was very precise.

You may have *thought* you were being very precise and talking about
decibels however your statement "regardless of what the signal actually
is" means that you could have been talking about anything and, more
specifically, in this case you were talking about volts!
>
>>you are not following the definition and therefore end up with something
>>that is NOT a power ratio.

>
>That is what you continue to boost. So does David J Taylor.
>

Not at all. David is discussing the misuse of the term decibel. I am
quite specifically addressing its miscalculation, and hence erroneous
determination of the power ratio. They are very different issues.

Your continued confusion of the two issues is barely matched by your
false assurance to readers that the same equation results in the power
ratio in decibels "regardless of what the signal actually is". Precisely
this false belief results in the misapplication of the originally quoted
equation not only in engineering examination papers but in practical
engineering.
--
Kennedy
Yes, Socrates himself is particularly missed;
A lovely little thinker, but a bugger when he's ****ed.
Python Philosophers (replace 'nospam' with 'kennedym' when replying)

Kennedy McEwen
Guest
Posts: n/a

 05-26-2008
In article
<(E-Mail Removed)>,
Marc Wossner <(E-Mail Removed)> writes
>
>As this highly theoretical discussion is not so easy to follow for me,
>IŽd like to bring it back to something that I can work with: If I
>chose the numerator of snr to be the range available in the image
>file -256 for 8-bit or 4096 for 12-bit - and the denominator to be
>the standard deviation as the equivalent to RMS noise, is the form SNR
>= 20 log (Signal RMS / Noise RMS) correct or should it be SNR = 10 log
>(Signal RMS / Noise RMS)?
>

Sadly, Mark, despite Floyds assurance that it doesn't matter what the
signal is, neither of these equations are generically suitable because
the image data has been processed from the sensor output according to a
response curve.

To estimate the SNR in dB you must use signals which can be converted to
power by a fixed formula - it doesn't have to be linear, there can be
exponential terms, but it must apply across all ranges. Typically the
response curve used to produce the image data is an "S-type" curve with
different responses used in the lower values from those in the peaks.
That means that your noise terms will be artificially high, while the
signal terms will be artificially low - and hence the estimated SNR will
be very low indeed.

What you really need is the raw data from the sensor. Some
manufacturers do provide this directly however others apply significant
processing to the raw data from some of their cameras. For example,
Nikon, are known to apply chroma noise reduction to many of their
camera's raw outputs.

If you can get hold of the raw data and convert it to a linear output
(free from response curves) then the first step is to baseline in. This
is necessary because "no light" does not necessarily result in "0" in
the raw data file - there may be significant dark current in the sensor,
more likely though, there can be significant voltage offsets between the
sensor output and the analogue to digital convertor.

At this point you can crudely approximate the SNR by using the 10xlog
version. The sensor converts individual photons to electrons with a
response known as the quantum efficiency. Each photon has an energy
which is determined by its wavelength (E = hc/w) and so the light power
can be determined from the number of monochromatic photons arriving at
the sensor over a period of time (P=E/t). Similarly the sensor outputs
a certain number of electrons per second to create a photocurrent, which
is then proportionally converted to volts by the load and hence into
numbers by the analogue to digital convertor.

The significant point here (actually the underlying reason for my
extended discussion with Floyd) is that the voltage output by the
sensor, and hence the corrected numbers in the raw data file, are
linearly proportional to the incident monochromatic light power on the
sensor. Consequently, even though the numbers represent voltages
directly, they are linearly proportional to power input to the camera
and that is what determines the correct formula to use. (Floyds
statement about disregarding what the signal represents is exceedingly

As Ilya says in his post however, the common usage in this context
actually contradicts the formal definition - primarily because it is so
common to make Floyd's error. Hence it is best to avoid this approach,
or at least be prepared to apply corrective factors of 2 to the data you
wish to compare your results with.
--
Kennedy
Yes, Socrates himself is particularly missed;
A lovely little thinker, but a bugger when he's ****ed.
Python Philosophers (replace 'nospam' with 'kennedym' when replying)