, but so far no real solution was found.
One idea there was to open the source with ffmpeg and pipe into vsrawsource, but that would not allow jumping inside the preview and is rather complicated to integrate into Hybrid.
Code:
import cv2
import muvsfunc_numpy as mufnp
import numpy as np
from PIL import Image
kelvin_table = {
1000: (255,56,0),
1500: (255,109,0),
2000: (255,137,18),
2500: (255,161,72),
3000: (255,180,107),
3500: (255,196,137),
4000: (255,209,163),
4500: (255,219,186),
5000: (255,228,206),
5500: (255,236,224),
6000: (255,243,239),
6500: (255,249,253),
7000: (245,243,255),
7500: (235,238,255),
8000: (227,233,255),
8500: (220,229,255),
9000: (214,225,255),
9500: (208,222,255),
10000: (204,219,255)}
def numpy2pil(np_array: np.ndarray) -> Image:
"""
Convert an HxWx3 numpy array into an RGB Image
"""
assert_msg = 'Input shall be a HxWx3 ndarray'
assert isinstance(np_array, np.ndarray), assert_msg
assert len(np_array.shape) == 3, assert_msg
assert np_array.shape[2] == 3, assert_msg
img = Image.fromarray(np_array, 'RGB')
return img
def pil2numpy(img: Image = None) -> np.ndarray:
"""
Convert an HxW pixels RGB Image into an HxWx3 numpy ndarray
"""
np_array = np.asarray(img)
return np_array
def convert_temp(image, temp):
r, g, b = kelvin_table[temp]
matrix = ( r / 255.0, 0.0, 0.0, 0.0,
0.0, g / 255.0, 0.0, 0.0,
0.0, 0.0, b / 255.0, 0.0 )
img = numpy2pil(image)
return pil2numpy(img.convert('RGB', matrix))
range = "full"
if core.text.FrameProps(clip,'_ColorRange'):
range = "limited"
clip = core.resize.Bicubic(clip=clip, format=vs.RGB24, range_s=range)
clip = mufnp.numpy_process(clip, convert_temp, temp=6500, input_per_plane=False, output_per_plane=False)
a. Hybrid atm. only supports this when the torch-Addon is used.
b. I'm not really sure how 'good' this is.