Created
December 21, 2023 04:55
-
-
Save cyfdecyf/f1daf4ead3e54c4b50d2e0a837860ece to your computer and use it in GitHub Desktop.
Generate 3D LUT
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
class Lut3DGenerator: | |
def __init__(self): | |
pass | |
def gen_identity_3dlut(self, lut_size, output_fname): | |
lut_size_f = float(lut_size) | |
# Generate an identity 3D LUT and write to output file. | |
with open(output_fname, 'w') as f: | |
f.write('TITLE "Identity 3D LUT"\n') | |
f.write('LUT_3D_SIZE {}\n\n'.format(lut_size)) | |
for b in range(lut_size): | |
for g in range(lut_size): | |
for r in range(lut_size): | |
f.write('{} {} {}\n'.format(r / lut_size_f, g / lut_size_f, b / lut_size_f)) | |
if __name__ == '__main__': | |
Lut3DGenerator().gen_identity_3dlut(33, 'identity_33.cube') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment