MATLAB Answers

## -log(SNR) does it make any difference?

Asked by Alex

### Alex (view profile)

on 4 Apr 2013
Accepted Answer by Ahmed A. Selman

### Ahmed A. Selman (view profile)

Dear All,

please, let me know if you know what happens to Signal to Noise ratio (SNR) of an image after we take -log(SNR)? What happens to Signal and Noise components (please, formulas)?

Thanks!

## Products

No products are associated with this question.

## 1 Answer

### Ahmed A. Selman (view profile)

Answer by Ahmed A. Selman

### Ahmed A. Selman (view profile)

on 4 Apr 2013
Accepted answer

Easily decompose the log argument! For any (ratio) R=S/N, then (please note that I highlighted the math formulas like codes, yet they are NOT codes):

`   A = Log( R)  = Log(S/N) = Log(S) - Log(N)`

leading simply to

`   -A = -Log( R) = Log(N) - Log (S) = Log(N/S) = Log(1/R)`

Now, the definition of a logarithmic decibel scale for R (RdB) as,

`    RdB = 10A = 10 Log( R) = 10 Log (.. etc. `

Or, converting between Amplitude (Am) and power of signal S (or noise N) using

`   AmS=S^2   and AmN=N^2 --> R=S/N = (AmS/AmN)^2 `

AmS (AmN) is the amplitude of signal (noise), again using basic math

`   RdB = 10 A = 10 Log ( R) = 10 Log ( (AmS / AmN)^2 ) = 2 * 10 * Log(AmS/AmN) = 20 Log (AmS/AmN)`

So,

```RbD = 10 Log(S) - 10 Log (R) = SdB - NdB
```

SdB and NdB are the signal and noise, in the logarithmic decibel scale. Equivalent to:

`    RbB= 20 ( Log (AmS) - Log(AmN) ) = 2 AmSdB - 2 AmNdB`

AmSdB and AmNdB are the signal and noise amplitudes, in a logarithmic, decibel scale.

In image processing it's more appropriate to define R as

`   R=M/D `

M is the mean of the image pixels, and D is the standard deviation of the noise (calculated in few different ways, depending on the type of the imaging conditions usually). The rest is straightforward (parallel to the simple relations above).

You'll find that, taking ( -log( R) ) for an image reduces to only subtracting image noise from it's mean. If the noise was a fixed-type, the process means subtracting a constant from the entire image, leading to a homogenous intensity reduction.

Alex

### Alex (view profile)

on 4 Apr 2013

Thank you for your detailed answer but I am not sure that it is correct. If after -log(image) S/N(image)=log(N1)-log(S1) then it results in negative S/N, which is not possible. Is not it?

lol, it is getting very interesting...

Newberry, "Signal-to-noise considerations for sky-subtracted CCD data", Publications of the Astronomical Society of the Pacific 103:122-130, Jan 1991

from the paper above I finally managed to figure out how to calculate SNR after any math operation. Let's try to take -log(image)

S1/N1 - old signal/noise, S/N - new signal/noise

S=-logS1 differential dS=d(-logS1)=-dS1/(S1*ln10), where dS=N and dS1=N1

S/N=logS1*ln10*(S1/N1) but wait that means that if one takes -log(image) one actually increases S/N! Is that really possible? I thought that no matter what we do to an image (subtraction, normalization) we always reduce S/N?

Please, correct me if I am mistaken.

Ahmed A. Selman

### Ahmed A. Selman (view profile)

on 5 Apr 2013

Hello, thank you for the nice interpretation of what I said.

First, yes, -Log(S/N) is negative, and it is absolutely possible for true images. No need to derive a thing to prove that, since (S >> N, S/N > 1, Log(S/N) is +ve). But what does that mean?

Now, what does it mean: ((S/N=logS1*ln10*(S1/N1) but wait that means that if one takes -log(image) one actually increases S/N! )) ?

Does it refer to: taking log (X) means increasing X? Or taking Log(X) means increasing (Y), where (Y) is a part or (X)? Both are not logical, sorry. Second,

if S = - Log(S1) then dS = - dS1/(S1*ln(10) ).

Integrating,

```let S1 ln(10) = F,
dS1= dF/ln(10),
so integral ( dS = - dS1/(S1 ln(10)) ) gives
```
```S = - integral( dF/ln(10) / F) is that was  (1/ln(10)*Log(F) as given, then it will be
```
```   S = - 1/ln(10) Log(S1*(ln(10))
= - 1/ln(10) * (Log (S1) + Log(ln(10))```
` not equaling -Log(S1), where we started. `

Finally, taking Log(image) is a thing.. and taking Log(S/N) of an image, is another, entirely different thing, because:

```    Log(A/B) equals NOT  Log(A)/Log(B).
Log(A+B) equals NOT  { Log(A/B), Log(A)/Log(B), Log(A)-Log(B)..etc }.```

But you are right, it is getting interesting.

Alex

### Alex (view profile)

on 5 Apr 2013

Thank you so much for your helping hand. I am quite new to image processing and I do appreciate your time and help. I am writing a software to study SNR propagation through different steps of image processing on X-ray microscope (theoretical approach based on input parameters to compare with the experimentally determined S/N). Image subtraction, then division (normalization) is fine but I got stuck when taking -log(S/N) because the final plot is -log((data-noise)/(data-reference)) as as function of energy. I would have to plot final S/N as a function of energy and the idea of negative S/N did not agree with me. I will try to do simulation today using the information above and keep you updated. Thanks!

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

### Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

### MATLAB Academy

New to MATLAB?

Learn MATLAB today!