summaryrefslogtreecommitdiffstats
path: root/examples/comprehensive
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-03-19 06:17:35 +0100
committerMattias Andrée <maandree@operamail.com>2014-03-19 06:17:35 +0100
commit54349b2ddd784b18a6f059a16554c70244c7e1c4 (patch)
tree08e037b34f559103a6b9c26daf5e9806221d5631 /examples/comprehensive
parentadd sigmoid to example (diff)
downloadblueshift-54349b2ddd784b18a6f059a16554c70244c7e1c4.tar.gz
blueshift-54349b2ddd784b18a6f059a16554c70244c7e1c4.tar.bz2
blueshift-54349b2ddd784b18a6f059a16554c70244c7e1c4.tar.xz
demo make_icc_interpolation
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'examples/comprehensive')
-rw-r--r--examples/comprehensive20
1 files changed, 9 insertions, 11 deletions
diff --git a/examples/comprehensive b/examples/comprehensive
index 54bb7ae..8c6b45d 100644
--- a/examples/comprehensive
+++ b/examples/comprehensive
@@ -171,7 +171,8 @@ sigmoid_blue = [...]
# Replace `None` with the pathname of the profile. It is assume that
# the calibration profile is already applied and that you want it to
# still be applied on exit.
-icc_video_filter_profile = [None]
+icc_video_filter_profile_day = [None]
+icc_video_filter_profile_night = [None]
icc_calibration_profile = [None]
@@ -252,6 +253,7 @@ doreset = parser.opts['--reset']
last_dayness = None
sigmoid_ = list(zip(sigmoid_red, sigmoid_green, sigmoid_blue))
+icc_video_filter_profile = [None] * len(icc_video_filter_profile_day)
def periodically(year, month, day, hour, minute, second, weekday, fade):
'''
:(int, int, int, int, int, int, int, float?)?→void Place holder for periodically invoked function
@@ -332,16 +334,12 @@ def periodically(year, month, day, hour, minute, second, weekday, fade):
# Apply ICC profile as a video filter.
i = m % len(icc_video_filter_profile)
- if icc_video_filter_profile[i] is not None:
- if isinstance(icc_video_filter_profile[i], str):
- icc_video_filter_profile[i] = load_icc(icc_video_filter_profile[i])
- icc_video_filter_profile[i]()
- # Fade in/out filter
- if fade is not None:
- alpha = abs(fade)
- for curve in (r_curve, g_curve, b_curve):
- for i in range(i_size):
- curve[i] = purify(curve[i], i / (i_size - 1))
+ if icc_video_filter_profile_day[i] is not None:
+ if icc_video_filter_profile[i] is None:
+ day = load_icc(icc_video_filter_profile_day[i])
+ night = load_icc(icc_video_filter_profile_night[i])
+ icc_video_filter_profile[i] = make_icc_interpolation([night, day])
+ icc_video_filter_profile[i](dayness, 1 if fade is None else abs(fade))
# Apply negative image.
f = negative_image[m % len(negative_image)]