From cd88e2b92cf7ae6e43c3a1baf97048ddd72f8e49 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 5 Apr 2014 14:39:38 +0200 Subject: add interpolate_function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/interpolation.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src') diff --git a/src/interpolation.py b/src/interpolation.py index f5acba3..9039c11 100644 --- a/src/interpolation.py +++ b/src/interpolation.py @@ -17,6 +17,7 @@ # This module contains interpolation functions. +from aux import * from curve import * @@ -188,3 +189,21 @@ def eliminate_halos(r, g, b, R, G, B): # and replace the local partition with the linear interpolation. large[X1 : X2 + 1] = linear[ci][X1 : X2 + 1] + +def interpolate_function(function, interpolator): + ''' + Interpolate a function that applies adjustments from a lookup table + + @param function:()→void The function that applies the adjustments + @param interpolator:(list{3})?→[list{3}] Function that interpolates lookup tables + @return :()→void `function` interpolated + ''' + if interpolator is None: + return function + stored = store() + start_over() + function() + rc = functionise(interpolator(*store())) + restore(stored) + return rc + -- cgit v1.2.3-70-g09d2