def rgb2val(rgb, minval, maxval):
"""
This function converts a rgb of value into its original value with reference to the minimum and maximum value.
Parameters
----------
rgb : tuple of floats
The rgb value to be converted.
minval : float
The minimum value of the falsecolour rgb.
maxval : float
The maximum value of the falsecolour rgb.
Returns
-------
original value : float
The orignal float value.
"""
hsv = colorsys.rgb_to_hsv(rgb[0],rgb[1],rgb[2])
y = hsv[0]*360
orig_val_part1 = ((-1*y) + 250)/250.0
orig_val_part2 = maxval-minval
orig_val = (orig_val_part1*orig_val_part2)+minval
return orig_val
#========================================================================================================
#OCCTOPOLOGY INPUTS
#========================================================================================================
评论列表
文章目录