All problems
Image SNR Estimate
Problem
Estimate the signal-to-noise ratio in decibels.
Let signal energy be sum(clean^2) and noise energy be sum((clean - noisy)^2); return 10 * log10(signal / noise) rounded to 4 decimal places. Return 0.0 when the noise energy is 0.
Hint
Noise energy comes from the difference between the clean and noisy images.
Test cases
case 1
in: [[[2,0]],[[1,0]]]
expected: 6.0206
case 2
in: [[[1,1]],[[2,1]]]
expected: 3.0103
case 3
in: [[[3]],[[3]]]
expected: 0
case 4
in: [[[0,0]],[[0,0]]]
expected: 0
Starter codePython
def snr_estimate(clean, noisy):
# Your code here
pass4 test cases · run your code against them in the editor