utility.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:py4design 作者: chenkianwee 项目源码 文件源码
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
#========================================================================================================
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号