|
Signal-to-noise ratio generically means the dimensionless ratio of the signal power to the noise power contained in a recording. Abbreviated SNR by engineers and scientists, the signal-to-noise ratio parameterizes the performance of optimal signal processing systems when the noise is Gaussian.
The signal s(t) may or may not have a stochastic description; the noise N(t) always does. When the signal is deterministic, its power Ps is defined to be
Ps=(integral of s(t)^2 from T0 to T1)/T
where T=T1-T0, is the duration of an observation interval, which could be infinite.
Special terminology is used for periodic signals. In this case, the interval T equals the signal's period and the signal's root mean squared (RMS) value equals the square-root of its power. For example, the sinusoid f(x)=Asin(2pi*f*x) has an RMS value equal to A/sqrt(2) and power A^2/2 (It is easy to proof this by integration)
The signal-to-noise ratio is typically written as SNR and equals
SNR= Ps/Pn or 10*log10(Ps/Pn) (db)
Signal-to-noise ratio is also defined for random variables in one of two ways.
X=s+N , where s , the signal, is a constant and N is a random variable having an expected value equal to zero. The SNR equals s^2/var(N) with var(N) of the variance of N
X=s+N, where both S and N are random variables.
A random variable's power equals its mean-squared (MS) value: the signal power thus equals E(s^2). Usually, the noise has zero mean, which makes its power equal to its variance. Thus, the SNR equals E(s^2)/var(N)
In image processing, signal-to-noise ratio is defined differently. Here, the numerator is the square of the peak value the signal could have and the denominator equals the noise power (noise variance). For example, an 8-bit image has values ranging between 0 and 255. For PSNR calculations, the numerator is 2552 in all cases.
Example: add noise with prescribed SNR
SNR = 10log10[var(image)/var(noise)] %% var(image) is not equal to numel(:)*(Norm(image(:)))^2
var(noise) = var(image)/10SNR/10 = var(image)/sqrt(10) %% SNR=5 dB
where m is the mean noise and v is its variance. It is also important to note that imnoise assumes that the intensities in image I range from 0 to 1
let's translate all of this into MATLAB code. To add white Gaussian noise to an image (denote it I) using the imnoise command:
I = imread('eight.tif');I =double(I);%// Adjust intensities in image I to range from 0 to 1
I = I - min(I(:));I = I / max(I(:));%// Add noise to image
v =var(I(:))/ sqrt(10);
I_noisy = imnoise(I,'gaussian',0, v);%// Show imagesfiguresubplot(1,2,1),
imshow(I), title('Original image')
subplot(1,2,2), imshow(I_noisy),
title('Noisy image, SNR=5db')
Reference:
http://www.ece.rice.edu/~dhj/
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-12-5 11:04
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社