コード例 #1
0
"""
Showcases reflectance recovery computations using *Jakob et al. (2019)* method.
"""

import numpy as np

import colour
from colour.utilities import message_box

message_box('"Jakob et al. (2019)" - Reflectance Recovery Computations')

illuminant = colour.SDS_ILLUMINANTS['D65']

XYZ = np.array([0.20654008, 0.12197225, 0.05136952])
message_box('Recovering reflectance using "Jakob et al. (2019)" method from '
            'given "XYZ" tristimulus values:\n'
            '\n\tXYZ: {0}'.format(XYZ))
sd = colour.XYZ_to_sd(XYZ, method='Jakob 2019')
print(sd)
print(colour.recovery.XYZ_to_sd_Jakob2019(XYZ))
print(colour.sd_to_XYZ(sd, illuminant=illuminant) / 100)

print('\n')

message_box('Generating a LUT according to "Jakob et al. (2019)" method '
            'for "sRGB" colourspace:')
LUT = colour.recovery.LUT3D_Jakob2019()
LUT.generate(colour.models.RGB_COLOURSPACE_sRGB, size=5)
RGB = np.array([0.70573936, 0.19248266, 0.22354169])
print(LUT.RGB_to_sd(RGB))
コード例 #2
0
# -*- coding: utf-8 -*-
"""
Showcases reflectance recovery computations using *Meng et al. (2015)* method.
"""

import numpy as np

import colour
from colour.utilities import message_box

message_box('"Meng et al. (2015)" - Reflectance Recovery Computations')

illuminant = colour.SDS_ILLUMINANTS['D65']

XYZ = np.array([0.20654008, 0.12197225, 0.05136952])
message_box('Recovering reflectance using "Meng et al. (2015)" method from '
            'given "XYZ" tristimulus values:\n'
            '\n\tXYZ: {0}'.format(XYZ))
sd = colour.XYZ_to_sd(XYZ, method='Meng 2015')
print(sd)
print(colour.recovery.XYZ_to_sd_Meng2015(XYZ))
print(colour.sd_to_XYZ(sd, illuminant=illuminant) / 100)
コード例 #3
0
# -*- coding: utf-8 -*-
"""
Showcases reflectance recovery computations using *Smits (1999)* method.
"""

import numpy as np

import colour
from colour.recovery.smits1999 import XYZ_to_RGB_Smits1999
from colour.utilities import message_box

message_box('"Smits (1999)" - Reflectance Recovery Computations')

XYZ = np.array([1.14176346, 1.00000000, 0.49815206])
RGB = XYZ_to_RGB_Smits1999(XYZ)
message_box(('Recovering reflectance using "Smits (1999)" method from '
             'given "RGB" colourspace array:\n'
             '\n\tRGB: {0}'.format(RGB)))
print(colour.XYZ_to_sd(XYZ, method='Smits 1999'))
print(colour.recovery.RGB_to_sd_Smits1999(RGB))

print('\n')

message_box(
    ('An analysis of "Smits (1999)" method is available at the '
     'following url : '
     'http://nbviewer.jupyter.org/github/colour-science/colour-website/'
     'blob/master/ipython/about_reflectance_recovery.ipynb'))
コード例 #4
0
ファイル: examples_mallet2019.py プロジェクト: wenh06/colour
import numpy as np

import colour
from colour.utilities import message_box

message_box('"Mallett et al. (2019)" - Reflectance Recovery Computations')

illuminant = colour.SDS_ILLUMINANTS['D65']

XYZ = np.array([0.20654008, 0.12197225, 0.05136952])
RGB = colour.XYZ_to_sRGB(XYZ, apply_cctf_encoding=False)
message_box('Recovering reflectance using "Mallett et al. (2019)" method '
            'from given "XYZ" tristimulus values:\n'
            '\n\tXYZ: {0}'.format(XYZ))
sd = colour.XYZ_to_sd(XYZ, method='Mallett 2019')
print(sd)
print(colour.recovery.RGB_to_sd_Mallett2019(RGB))
print(colour.sd_to_XYZ(sd, illuminant=illuminant) / 100)

print('\n')

message_box('Generating the "Mallett et al. (2019)" basis functions for the '
            '*Pal/Secam* colourspace:')
cmfs = (colour.MSDS_CMFS['CIE 1931 2 Degree Standard Observer'].copy().align(
    colour.SpectralShape(360, 780, 10)))
illuminant = colour.SDS_ILLUMINANTS['D65'].copy().align(cmfs.shape)

print(
    colour.recovery.spectral_primary_decomposition_Mallett2019(
        colour.models.RGB_COLOURSPACE_PAL_SECAM,
コード例 #5
0
# -*- coding: utf-8 -*-
"""
Showcases reflectance recovery computations using *Meng et al. (2015)* method.
"""

import numpy as np

import colour
from colour.utilities import message_box

message_box('"Meng et al. (2015)" - Reflectance Recovery Computations')

XYZ = np.array([1.14176346, 1.00000000, 0.49815206])
message_box(('Recovering reflectance using "Meng et al. (2015)" method from '
             'given "XYZ" tristimulus values:\n'
             '\n\tXYZ: {0}'.format(XYZ)))
print(colour.XYZ_to_sd(XYZ, method='Meng 2015'))
print(colour.recovery.XYZ_to_sd_Meng2015(XYZ))
コード例 #6
0
ファイル: examples_otsu2018.py プロジェクト: wenh06/colour
"""

import numpy as np

import colour
from colour.utilities import message_box

message_box('"Otsu et al. (2018)" - Reflectance Recovery Computations')

illuminant = colour.SDS_ILLUMINANTS['D65']

XYZ = np.array([0.20654008, 0.12197225, 0.05136952])
message_box('Recovering reflectance using "Otsu et al. (2018)" method from '
            'given "XYZ" tristimulus values:\n'
            '\n\tXYZ: {0}'.format(XYZ))
sd = colour.XYZ_to_sd(XYZ, method='Otsu 2018')
print(sd)
print(colour.recovery.XYZ_to_sd_Otsu2018(XYZ))
print(colour.sd_to_XYZ(sd, illuminant=illuminant) / 100)

print('\n')

message_box('Generating a spectral dataset according to "Otsu et al. (2018)"'
            'method :')
XYZ = np.array([0.20654008, 0.12197225, 0.05136952])
reflectances = [
    reflectance.copy().align(colour.recovery.SPECTRAL_SHAPE_OTSU2018).values
    for reflectance in
    colour.SDS_COLOURCHECKERS['ColorChecker N Ohta'].values()
]
node_tree = colour.recovery.NodeTree_Otsu2018(reflectances)
コード例 #7
0
"""Showcases reflectance recovery computations using *Jakob et al. (2019)* method."""

import numpy as np

import colour
from colour.utilities import message_box

message_box('"Jakob et al. (2019)" - Reflectance Recovery Computations')

illuminant = colour.SDS_ILLUMINANTS["D65"]

XYZ = np.array([0.20654008, 0.12197225, 0.05136952])
message_box(
    f'Recovering reflectance using "Jakob et al. (2019)" method from given '
    f'"XYZ" tristimulus values:\n\n\tXYZ: {XYZ}')
sd = colour.XYZ_to_sd(XYZ, method="Jakob 2019")
print(sd)
print(colour.recovery.XYZ_to_sd_Jakob2019(XYZ))
print(colour.sd_to_XYZ(sd, illuminant=illuminant) / 100)

print("\n")

message_box(
    'Generating a LUT according to the "Jakob et al. (2019)" method for the '
    '"sRGB" colourspace:')
LUT = colour.recovery.LUT3D_Jakob2019()
LUT.generate(colour.models.RGB_COLOURSPACE_sRGB, size=5)
RGB = np.array([0.70573936, 0.19248266, 0.22354169])
print(LUT.RGB_to_sd(RGB))
コード例 #8
0
"""Showcases reflectance recovery computations using *Smits (1999)* method."""

import numpy as np

import colour
from colour.recovery.smits1999 import XYZ_to_RGB_Smits1999
from colour.utilities import message_box

message_box('"Smits (1999)" - Reflectance Recovery Computations')

XYZ = np.array([0.20654008, 0.12197225, 0.05136952])
RGB = XYZ_to_RGB_Smits1999(XYZ)
message_box(
    f'Recovering reflectance using "Smits (1999)" method from given "RGB" '
    f"colourspace array:\n\n\tRGB: {RGB}")
sd = colour.XYZ_to_sd(XYZ, method="Smits 1999")
print(sd)
print(colour.recovery.RGB_to_sd_Smits1999(XYZ))
print(colour.sd_to_XYZ(sd.align(colour.SPECTRAL_SHAPE_DEFAULT)) / 100)

print("\n")

message_box('An analysis of "Smits (1999)" method is available at the '
            "following url : "
            "http://nbviewer.jupyter.org/github/colour-science/colour-website/"
            "blob/master/ipython/about_reflectance_recovery.ipynb")
コード例 #9
0
import numpy as np

import colour
from colour.utilities import message_box

message_box('"Mallett et al. (2019)" - Reflectance Recovery Computations')

illuminant = colour.SDS_ILLUMINANTS["D65"]

XYZ = np.array([0.20654008, 0.12197225, 0.05136952])
RGB = colour.XYZ_to_sRGB(XYZ, apply_cctf_encoding=False)
message_box(
    f'Recovering reflectance using "Mallett et al. (2019)" method from given '
    f'"XYZ" tristimulus values:\n\n\tXYZ: {XYZ}')
sd = colour.XYZ_to_sd(XYZ, method="Mallett 2019")
print(sd)
print(colour.recovery.RGB_to_sd_Mallett2019(RGB))
print(colour.sd_to_XYZ(sd, illuminant=illuminant) / 100)

print("\n")

message_box('Generating the "Mallett et al. (2019)" basis functions for the '
            "*Pal/Secam* colourspace:")
cmfs = (colour.MSDS_CMFS["CIE 1931 2 Degree Standard Observer"].copy().align(
    colour.SpectralShape(360, 780, 10)))
illuminant = colour.SDS_ILLUMINANTS["D65"].copy().align(cmfs.shape)

print(
    colour.recovery.spectral_primary_decomposition_Mallett2019(
        colour.models.RGB_COLOURSPACE_PAL_SECAM,
コード例 #10
0
"""Showcases reflectance recovery computations using *Meng et al. (2015)* method."""

import numpy as np

import colour
from colour.utilities import message_box

message_box('"Meng et al. (2015)" - Reflectance Recovery Computations')

illuminant = colour.SDS_ILLUMINANTS["D65"]

XYZ = np.array([0.20654008, 0.12197225, 0.05136952])
message_box(
    f'Recovering reflectance using "Meng et al. (2015)" method from given '
    f'"XYZ" tristimulus values:\n\n\tXYZ: {XYZ}')
sd = colour.XYZ_to_sd(XYZ, method="Meng 2015")
print(sd)
print(colour.recovery.XYZ_to_sd_Meng2015(XYZ))
print(colour.sd_to_XYZ(sd, illuminant=illuminant) / 100)
コード例 #11
0
ファイル: examples_smits1999.py プロジェクト: wenh06/colour
# -*- coding: utf-8 -*-
"""
Showcases reflectance recovery computations using *Smits (1999)* method.
"""

import numpy as np

import colour
from colour.recovery.smits1999 import XYZ_to_RGB_Smits1999
from colour.utilities import message_box

message_box('"Smits (1999)" - Reflectance Recovery Computations')

XYZ = np.array([0.20654008, 0.12197225, 0.05136952])
RGB = XYZ_to_RGB_Smits1999(XYZ)
message_box('Recovering reflectance using "Smits (1999)" method from '
            'given "RGB" colourspace array:\n'
            '\n\tRGB: {0}'.format(RGB))
sd = colour.XYZ_to_sd(XYZ, method='Smits 1999')
print(sd)
print(colour.recovery.RGB_to_sd_Smits1999(XYZ))
print(colour.sd_to_XYZ(sd.align(colour.SPECTRAL_SHAPE_DEFAULT)) / 100)

print('\n')

message_box(
    ('An analysis of "Smits (1999)" method is available at the '
     'following url : '
     'http://nbviewer.jupyter.org/github/colour-science/colour-website/'
     'blob/master/ipython/about_reflectance_recovery.ipynb'))