Skip to content
This repository has been archived by the owner on Nov 22, 2019. It is now read-only.

Commit

Permalink
Add private colorspaces feature #8
Browse files Browse the repository at this point in the history
  • Loading branch information
mfe committed Jan 22, 2014
1 parent f60d1d6 commit 51a9654
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lutLab/rgb_to_xyz_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"""
from utils.colors_helper import xy_to_XYZ
from utils.colorspaces import REC709
from utils.colorspaces import COLORSPACES
from utils.private_colorspaces import PRIVATE_COLORSPACES
import numpy
import argparse

Expand Down Expand Up @@ -102,8 +103,10 @@ def display_matrix(colorspace, format):
"""
print "{0} to XYZ matrix ({1} output):\n".format(colorspace, format)
if colorspace == "REC709":
colorspace = REC709
try:
colorspace = COLORSPACES[colorspace]
except KeyError:
colorspace = PRIVATE_COLORSPACES[colorspace]
matrix = get_RGB_to_XYZ_matrix(colorspace.get_red_primaries(),
colorspace.get_green_primaries(),
colorspace.get_blue_primaries(),
Expand Down Expand Up @@ -142,7 +145,7 @@ def __get_options():
parser.add_argument("-c", "--colorspace",
help=("Input RGB Colorspace."),
type=str,
choices=['REC709'],
choices= COLORSPACES.keys()+PRIVATE_COLORSPACES.keys(),
default='REC709')
# Output format
parser.add_argument("-f", "--format",
Expand Down
4 changes: 4 additions & 0 deletions utils/colorspaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,7 @@ def gamma_to_lin(self, value):

REC709 = Rec709()
ALEXALOGCV3 = AlexaLogCV3()
COLORSPACES = {
'REC709': REC709,
'ALEXALOGCV3': ALEXALOGCV3
}
49 changes: 49 additions & 0 deletions utils/private_colorspaces.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
""" Private colorspace definitions
These colorspaces don't have public specifications.
To add a colorspace, see example below.
.. moduleauthor:: `Marie FETIVEAU <github.com/mfe>`_
"""
from utils.colorspaces import AbstractColorspace

# class DCI(AbstractColorspace):
# """DCI colorspace

# """
# def get_red_primaries(self):
# # See DCI specifications
# pass

# def get_green_primaries(self):
# # See DCI specifications
# pass

# def get_blue_primaries(self):
# # See DCI specifications
# pass

# def get_white_point(self):
# # See DCI specifications
# pass

# def lin_to_gamma(self, value):
# # See DCI specifications
# pass

# def gamma_to_lin(self, value):
# # See DCI specifications
# pass


# class DCID60(DCI):
# """DCI colorspace with D60 white point

# """
# def get_white_point(self):
# return 0.3217, 0.3378

PRIVATE_COLORSPACES = {
# 'DCI': DCI(),
# 'DCI_D60': DCID60()
}

0 comments on commit 51a9654

Please sign in to comment.