Skip to content

Instantly share code, notes, and snippets.

@oscardelama
Last active August 29, 2015 14:14
Show Gist options
  • Save oscardelama/2340a92e91bcf3de6fd6 to your computer and use it in GitHub Desktop.
Save oscardelama/2340a92e91bcf3de6fd6 to your computer and use it in GitHub Desktop.
rgb-noise: Checking the selected good samples
# Read the selected 'good' image sample file names
sel.pics <- read.csv('sel-pict.csv')
vvm.sel <- vvm$new(has.RGGB.pattern = TRUE)
# 'Digest' the samples computing noise related statistics
vvm.sel$digest(
file.name.from = sel.pics$pict,
file.path = 'ISO100/Selection/crops'
)
# Fit the usual model
vvm.sel$fit.model(model.name = 'weighted', model.family = 'lmrob', weights=1/mean^2)
# Plot the var vs mean data
vvm.sel$plot(with = ~ channel != 'Green Avg',
tlab = "VVM Selected samples",
slab = "Nikon D7000 - ISO 100")
# Plot the SNR vs gray scale (log) in dB
imgnoiser.option('plot.point.opacity',0.3)
add.snr.ref.limits(
vvm.sel$plot(model.name = 'weighted',
x = log10(mean/157.79), y = 20*log10(mean/sqrt(var)),
tlab = "SNR Selected samples",
slab = "Nikon D7000 - ISO 100",
xlab = 'Gray scale (log)', ylab = 'SNR (dB)', print = FALSE,
with = ~ channel != 'Green Avg') +
scale_x_continuous(breaks=-1:2, labels=c('0.1%', '1%', '10%', '100%')) +
scale_y_continuous(breaks=seq(0, 48, 4))
)
# Plot the SNR vs gray scale in dB
add.snr.ref.limits(
vvm.sel$plot(model.name = 'weighted',
x = (mean/157.79), y = 20*log10(mean/sqrt(var)),
tlab = "SNR Selected samples",
slab = "Nikon D7000 - ISO 100",
xlab = 'Gray scale', ylab = 'SNR (dB)', print = FALSE,
with = ~ channel != 'Green Avg') +
scale_x_continuous(breaks = seq(0, 100, 20),
labels=c('0%', '20%', '40%', '60%', '80%', '100%')) +
scale_y_continuous(breaks=seq(0, 48, 4))
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment