colorex.cex_numpy : numpy version of keras color transforms

colorex numpy

colorex.cex_numpy.gamma_correct(values, gamma)[source]

apply a gamma power curve

colorex.cex_numpy.point_or_points_or_image_wrapper(func)[source]
a decorated function will be called with reshaped input and output to support

a single 3d point: pt.shape = (3,) an array of 3d points: pts.shape = (N,3) an image of 3d points: pts.shape = (H,W,3)

wrapped functions should internally support the array of 3d points case (N,3)

colorex.cex_numpy.rgb_to_luminance(rgb, luma_weights=(0.2126, 0.7152, 0.0722))[source]

luminance of a color array, or higher dim color images

colorex.cex_numpy.rgb_to_srgb(rgb)[source]

convert from linear rgb to a gamma 2.4 color space this code can be directly adapted to keras or another autodiff framework

colorex.cex_numpy.rgb_to_srgb_aprox_gamma_22(rgb_img)[source]

approximate inverse srgb conversion using a gamma correct with power 1.0/2.2 this approach is very common in vfx where srgb is used rarely

colorex.cex_numpy.srgb_to_rgb(srgb)[source]

convert from a gamma 2.4 color space to linear rgb this code can be directly adapted to keras or another autodiff framework

colorex.cex_numpy.srgb_to_rgb2(srgb_img)[source]

2.4 gamma and linear below .04045 very close to the approach taken internally to skimagewhen when converting:

srgb > rgb > xyz

skimage does not expose the srgb > rgb transform

colorex.cex_numpy.srgb_to_rgb_aprox_gamma_22(srgb_img)[source]

approximate srgb conversion using a gamma correct with power 2.2 this approach is very common in vfx where srgb is used rarely

colorex.cex_numpy.xyy_to_xyz(xyY)[source]
convert from xyY color space to XYZ

xyY: normalized chromaticity with xy in 0-1, Y in 0-inf XYZ: consistent units for each component

https://en.wikipedia.org/wiki/CIE_1931_color_space http://www.brucelindbloom.com/index.html?Eqn_xyY_to_XYZ.html

colorex.cex_numpy.xyz_to_xyy(XYZ)[source]
convert from XYZ color space to xyY

XYZ: consistent units for each component xyY: normalized chromaticity with xy in 0-1, Y in 0-inf

https://en.wikipedia.org/wiki/CIE_1931_color_space http://www.brucelindbloom.com/index.html?Eqn_XYZ_to_xyY.html