wonkey_monkey
27th November 2019, 22:06
https://i.imgur.com/jaDv0fr.png
ColourWarp v0.1 (http://horman.net/avisynth/)
ColourWarp is a filter I've quickly knocked up to remap the colours of YUV video. It's not highly optimised or anything and may have bugs (although I haven't found any yet).
It only works on 8-bit YUV video at the moment, and it only remaps the UV channels. If there's any interest, I might update it to full YUV remapping but I'm not sure how useful that would be.
Colours are remapped by specifying control point pairs of UV values:
ColourWarp(clip, 0,0, -64,-64)
# a single pair will shift the colours
ColourWarp(clip, 0,0, 0,0, 64,64, 32,32)
# two pairs will scale/rotate (this example will reduce saturation of all colours - it fixes grey to grey and then scales 64,64 down to 32,32)
ColourWarp(clip, 0,0, 0,0, 0,128, 0,0, -128,-128, -128,-128, 128,-128, 128,-128, -128,128, -128,128, 128,128, 128,128)
# this example fixes all the corners, and center, of the UV square, but remaps U=0,V=128 to U=0,V=0 (grey)
This image hopefully demonstrates the idea: https://i.imgur.com/q6tI4xq.jpg
You can also specify up to two additional clips (if only one clip is specified, the input clip is assumed to the first "extra" clip). These two clips act as sources for you to pick specific pixels (any number parameters that come after the pixel source clips) to be remapped:
ColourWarp(clip, 0,0, 0,0, clip1, clip2, 0,100,150, 10,200,250)
# this example fixes grey to grey (the first four numbers),
# then maps the colour of pixel [100,150] from clip1, frame 0 to
# the colour of pixel [200,250] from clip2, frame 10)
Noisy clips should be blurred (why not use FastBlur (https://forum.doom9.org/showthread.php?t=176564)?) before using them as sources for pixels in this way. The example at the top of this post was done this way, specifying corresponding pixels from the two clips to remap the first clip to roughly the same colours as the middle clip.
I hate writing documentation and to be honest I'm already pretty bored of writing this post, but I'm better at answering questions, so ask away.
ColourWarp v0.1 (http://horman.net/avisynth/)
ColourWarp is a filter I've quickly knocked up to remap the colours of YUV video. It's not highly optimised or anything and may have bugs (although I haven't found any yet).
It only works on 8-bit YUV video at the moment, and it only remaps the UV channels. If there's any interest, I might update it to full YUV remapping but I'm not sure how useful that would be.
Colours are remapped by specifying control point pairs of UV values:
ColourWarp(clip, 0,0, -64,-64)
# a single pair will shift the colours
ColourWarp(clip, 0,0, 0,0, 64,64, 32,32)
# two pairs will scale/rotate (this example will reduce saturation of all colours - it fixes grey to grey and then scales 64,64 down to 32,32)
ColourWarp(clip, 0,0, 0,0, 0,128, 0,0, -128,-128, -128,-128, 128,-128, 128,-128, -128,128, -128,128, 128,128, 128,128)
# this example fixes all the corners, and center, of the UV square, but remaps U=0,V=128 to U=0,V=0 (grey)
This image hopefully demonstrates the idea: https://i.imgur.com/q6tI4xq.jpg
You can also specify up to two additional clips (if only one clip is specified, the input clip is assumed to the first "extra" clip). These two clips act as sources for you to pick specific pixels (any number parameters that come after the pixel source clips) to be remapped:
ColourWarp(clip, 0,0, 0,0, clip1, clip2, 0,100,150, 10,200,250)
# this example fixes grey to grey (the first four numbers),
# then maps the colour of pixel [100,150] from clip1, frame 0 to
# the colour of pixel [200,250] from clip2, frame 10)
Noisy clips should be blurred (why not use FastBlur (https://forum.doom9.org/showthread.php?t=176564)?) before using them as sources for pixels in this way. The example at the top of this post was done this way, specifying corresponding pixels from the two clips to remap the first clip to roughly the same colours as the middle clip.
I hate writing documentation and to be honest I'm already pretty bored of writing this post, but I'm better at answering questions, so ask away.