Skip to content

Instantly share code, notes, and snippets.

@oscardelama
oscardelama / gist:9f1a52e7017666011be6
Last active August 29, 2015 14:14
rgb-noise: Scale function from linear sRGB to Lightroom sRGB
# Get the LR tifs var data
tif.var.zero <- vvm.tif$var.df
# Rename 'mean' and 'var' columns to avoid later name colision in merging
names(tif.var.zero)[3:4] <- paste0('tif.', names(tif.var.zero)[3:4])
# Remove sample file name extension to make possible the merge by picture file name
tif.var.zero$pict <- substr(tif.var.zero$pict, 1, 8)
# Compute the linear sRGB values
vvm.rgb.lin <- convert.to.rgb(target.space = 'sRGB', use.camera.tc = FALSE, target.tc = 'linear')
# Get the sRGB linear wide var data
@oscardelama
oscardelama / gist:2340a92e91bcf3de6fd6
Last active August 29, 2015 14:14
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'
)
@oscardelama
oscardelama / gist:b6ef41fcadf53c1a971a
Last active August 29, 2015 14:14
rgb-noise: hvdvm initial analysis
hvm.all <- hvdvm$new(has.RGGB.pattern = TRUE)
hvm.all$digest(photo.conds.file = 'ISO100/crops/full-set.csv',
crop.files.path = 'ISO100/crops',
min.raw = 4,
max.raw = c(16379, 15774, 15774 ,16379))
# Fit a quadratic model
hvm.all$fit.model(model.name = 'weighted',
model.family = 'lmrob',
degree = 2,
@oscardelama
oscardelama / gist:773e45301580c7d9e6c3
Last active August 29, 2015 14:14
rgb-noise: digest as RGB each set
# Convert selected raw images to a given destinations space
# without demosaicing
convert.to.rgb <- function(target.space,
use.camera.tc,
target.tc,
cam.coldata = imgnoiser::nikon.d7000.ISO100.colmap,
dest.scale = 255
) {
library(imgnoiser)
@oscardelama
oscardelama / gist:259b3e9715819a76be9f
Last active August 29, 2015 14:14
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
@oscardelama
oscardelama / rgb-noise: selecting few samples.r
Last active August 29, 2015 14:14
rgb-noise: Select samples
# 1) Read and digest the channels with valid values
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,
max.raw = c(16379, 15774, 15774 ,16379))
MenuHandler.prototype.buildMenu = function(menuObj, MaxLevels, currLevel, basePath) {
var menu = "", menuItem, className, extraTitle;
for (var childMenuKey in menuObj) {
menuItem = '';
className = '';
extraTitle = "";
if ( !/[^\-—–\s]/.test( menuObj[childMenuKey].menu ) )
menuItem = '---';