Skip to content

Instantly share code, notes, and snippets.

View KelSolaar's full-sized avatar
🔅
Bending Light

Thomas Mansencal KelSolaar

🔅
Bending Light
View GitHub Profile
@KelSolaar
KelSolaar / figure_1.png
Last active August 13, 2016 20:57
Vishal - Plotting Spds
figure_1.png
@KelSolaar
KelSolaar / CCT_D_uv_computation_from_SPD.py
Created August 25, 2016 22:04
CCT & D_uv Computation from Spectral Power Distribution
import colour
colour.filter_warnings()
XYZ = colour.spectral_to_XYZ(colour.ILLUMINANTS_RELATIVE_SPDS['D65']) / 100.0
UCS = colour.XYZ_to_UCS(XYZ)
uv = colour.UCS_to_uv(UCS)
CCT, D_uv = colour.uv_to_CCT_Ohno2013(uv)
print(CCT, D_uv)
@KelSolaar
KelSolaar / absolute_luminance_calibration.nkp
Created September 1, 2016 09:41
Nuke - Absolute Luminance Calibration
set cut_paste_input [stack 0]
version 9.0 v4
push $cut_paste_input
Group {
name Absolute_Luminance_Calibration
tile_color 0xffbf00ff
selected true
xpos -40
ypos 39
addUserKnob {20 absolute_luminance_calibration_tab l "Absolute Luminance Calibration"}
<?
/////////////////////
// slack2html
// by @levelsio
/////////////////////
//
/////////////////////
// WHAT DOES THIS DO?
/////////////////////
//
@KelSolaar
KelSolaar / colour_rgb_colourspace_definition.py
Created December 31, 2016 04:40
Colour - RGB Colourspace Definition
import numpy as np
import colour
# Manual NPM Derivation
primaries=np.array([[0.1, 0.2],
[0.3, 0.4],
[0.5, 0.6]])
whitepoint=np.array([0.5, 0.5])
npm = colour.normalised_primary_matrix(
@KelSolaar
KelSolaar / rimm_romm_rgb_d65_to_aces_cg.py
Last active February 23, 2017 19:38
RIMM ROMM RGB D65 to ACEScg
# Using latest colour develop branch.
import colour
D65 = colour.ILLUMINANTS['cie_2_1931']['D65']
P = colour.ROMM_RGB_COLOURSPACE.primaries
W = colour.ROMM_RGB_COLOURSPACE.whitepoint
P_a = colour.chromatically_adapted_primaries(P, W, D65)
@KelSolaar
KelSolaar / rgb_to_hsv_roundtrips.py
Created March 7, 2017 04:29
RGB to HSV - Roundtrips
import numpy as np
import colour
RGB_i = [0.325683457522574, 0.094356847568351, 0.745367969845698]
RGB_o = np.ones(3)
for i in range(10000):
RGB_o = colour.HSV_to_RGB(colour.RGB_to_HSV(RGB_i))
@KelSolaar
KelSolaar / cie_e_no_k_factor_normalisation.py
Created March 17, 2017 19:45
CIE E - No k Factor Normalisation
import colour
# Normalisation factor k = 1 in colour.spectral_to_XYZ_integration:
# https://github.com/colour-science/colour/blob/535609305db468d1f7e96e2500c110dc6550803c/colour/colorimetry/tristimulus.py#L471
colour.spectral_to_XYZ_integration(colour.ILLUMINANTS_RELATIVE_SPDS['E']) / 100
# array([ 106.86546949, 106.8569171 , 106.89225128])
@KelSolaar
KelSolaar / fits_demosaicing.py
Created March 25, 2017 03:30
Fits - Demosaicing
import numpy as np
from astropy.io import fits
import colour
import colour_demosaicing
image = its.getdata('test.fits', ext=0).astype(np.float_) / 255.0
# image = colour.orient(image, '90 CW')
@KelSolaar
KelSolaar / eos_c700_primaries_derivation.py
Created March 28, 2017 04:47
EOS C700 - Primaries Derivation
# IDT.Canon.EOSC700_CanonLog_CinemaGamut_TypeC_D55.a1.v1.ctl
import numpy as np
import colour
EOSC700_CINEMAGAMUT_TO_ACES_2065_1 = np.array(
[[0.763064455, 0.149021161, 0.087914384],
[0.003657457, 1.10696038, -0.110617837],
[-0.009407794, - 0.218383305, 1.227791099]])