Skip to content

Instantly share code, notes, and snippets.

@oscardelama
Last active August 29, 2015 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oscardelama/259b3e9715819a76be9f to your computer and use it in GitHub Desktop.
Save oscardelama/259b3e9715819a76be9f to your computer and use it in GitHub Desktop.
rgb-noise: vvm initial Analysis
library(imgnoiser)
vvm.all <- vvm$new(has.RGGB.pattern = TRUE)
vvm.all$digest(file.name.from = '_ODL0387s4',
file.name.to = '_ODL1671s6',
file.name.ext = '.pgm',
file.path = 'ISO100/crops',
min.raw = 4, # <= Raising this limit to avoid the funny red tail
max.raw = c(16379, 15776, 15776 ,16379))
# Fit a quadratic, weighted, robust model
vvm.all$fit.model(model.name = 'weighted', model.family = 'lmrob', weights=1/mean^2)
# Top-left) graph
vvm.all$plot(model.name = 'weighted',
with = ~ channel != 'Green Avg',
xlim = c(0,50), ylim = c(0, 30))
# Top-right) graph
vvm.all$plot(model.name = 'weighted',
with = ~ channel != 'Green Avg')
# Bottom-left) graph
vvm.all$plot(model.name = 'weighted',
x = (mean), y = (mean/sqrt(var)),
with = ~ channel != 'Green Avg')
# Bottom-right) graph
add.snr.ref.limits( # with SNR refernce limits
vvm.all$plot(model.name = 'weighted', obs = FALSE,
x = log10(mean/157.79), y = 20*log10(mean/sqrt(var)),
xlab = 'Gray scale (log)', ylab = '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))
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment