Initializes the internal colour object with one of
the enumerated colour spaces identified by
space. It is illegal to call this function unless there
is an internal object (
exists must return true) and that object has not yet been
initialized.
To specify a
JP2_CIELab_SPACE or
JP2_CIEJab_SPACE with anything other than the default parameters, use
the second form of this overloaded function.
To specify a colour space via an embedded ICC profile,
use the third form of this overloaded function.
To specify a vendor-specific colour space, use the
fourth form of this overloaded function.
space [jp2_colour_space]
Must be one of the following (JP2/JPX enumerated colour
space codes are also given to resolve any possible
lack of clarity for those who have copies of the standards
documents):
-
JP2_bilevel1_SPACE (EnumCS=0) — used to indicate a bi-level image
in which 0 means white and 1 means black.
-
JP2_YCbCr1_SPACE (EnumCS=1) — commonly used for data that originated
from a video signal. (*) The primaries are based on
ITU-R Rec. BT709-4, having chromaticities (Rx,Ry)=(0.640,0.330),
(Gx,Gy)=(0.300,0.600) and (Bx,By)=(0.150,0.060), with
a whitepoint of (Wx,Wy)=(0.3127,0.3290) under CIE illuminant
D65, and a gamma function with parameters gamma=1/0.45
and beta=0.099. (*) The opponent transform which maps
gamma-corrected RGB to Y1, Cb1 and Cr1 is identical
to the ICT (irreversible colour transform) defined
by JPEG2000 Part 1, except that the Y1, Cb1 and Cr1
channels have been scaled so as to occupy less than
the full nominal dynamic range. In particular, writing
Y, Cb and Cr for the values which would be produced
by the ICT, with Y in the range 0 to 1, and Cb and
Cr in the range -0.5 to +0.5, we have Y1 = (219*Y'+16)
/ 256; Cb1 = Cb' * 224/256; and Cr1 = Cr' * 224/256.
As an example, to express Y1, Cb1 and Cr1 as 8-bit
unsigned numbers, the normalized quantities are multiplied
by 256, and the chrominance quantities are then offset
by 128.
-
JP2_YCbCr2_SPACE (EnumCS=3) — commmonly used for data that originated
as RGB, but has been converted to luminance and chrominance
samples. (*) The primaries are based on ITU-R Rec.
BT601-5, having chromaticities (Rx,Ry)=(0.630,0.340),
(Gx,Gy)=(0.310,0.595) and (Bx,By)=(0.155,0.070), with
a whitepoint of (Wx,Wy)=(0.3127,0.3290) under CIE illuminant
D65, and with a gamma function governed by parameters
gamma=1/0.45 and beta=0.099. Note that this is the
same gamma as the colour space above, but with different
RGB primaries. (*) The opponent colour transform used
to map RGB to Y2, Cb2 and Cr2 values is identical to
the ICT (irreversible colour transform) defined by
JPEG2000 Part 1, without any additional scaling.
-
JP2_YCbCr3_SPACE (EnumCS=4) — commonly used for data that originated
from a video signal. (*) The primaries are based on
ITU-R Rec. BT601-5, having exactly the same chromaticities,
whitepoint and gamma as
JP2_YCbCr2_SPACE. (*) The opponent colour transform used to map RGB
to Y3, Cb3 and Cr3 values is identical to the ICT (irreversible
colour transform) defined by JPEG2000 Part 1, except
that it includes the additional scaling factors described
above for the
JP2_YCbCr1_SPACE.
-
JP2_PhotoYCC_SPACE (EnumCS=9) — this is the colour encoding method
used in the Photo CD system. (*) The primaries are
based on ITU-R Rec. BT.709, having exactly the same
chromaticities, whitepoint and gamma as
JP2_YCbCr1_SPACE. (*) The opponent colour transform used to map RGB
to Y, C1 and C2 values is identical to the ICT (irreversible
colour transform) defined by JPEG2000 Part 1, but the
coefficients are scaled and offset in an unusual manner.
In particular, treating the Y component as an unsigned
quantity in the range 0 to 1, and the Cb and Cr components
as signed quantities in the range -0.5 to +0.5, the
Y component is scaled by 0.7133, while the Cb and Cr
components are both scaled and offset. The Cb component
is scaled by 0.7711 and then offset by the addition
of +0.1094, while the Cr component is scaled by 0.7428
and offset by the addition of +0.0352.
-
JP2_CMY_SPACE (EnumCS=11) — A Cyan-Magenta-Yellow colour space
suitable for printing. Not formally defined —
device dependent. Values of 0 mean zero ink coverage,
while the maximum nominal value corresponds to an ink
coverage of 100% for the relevant colourant.
-
JP2_CMYK_SPACE (EnumCS=12) — Same as
JP2_CMY_SPACE but with an extra channel for black ink.
-
JP2_YCCK_SPACE (EnumCS=13) — This is an opponent representation
for the
JP2_CMYK_SPACE. The first 3 components (C, M and Y) are first complemented
to form pseudo-RGB coordinates. Specifically, if C,
M and Y are regarded as numbers in the range 0 to 1,
complementing them forms R=1-C, G=1-M and B=1-Y. The
ICT (irreversible colour transform) defined by JPEG2000
Part 1 code-streams is then applied to the complemented
colour channels to form luminance and chrominance channels.
The black (K) channel is unaffected by the above transformations.
-
JP2_CIELab_SPACE (EnumCS=14) — This is the CIE Lab colour space.
If you choose to use this form of the
init function, you will get the default Lab parameters,
as described in the documentation provided with the
second form of the
init function.
-
JP2_bilevel2_SPACE (EnumCS=15) — Same as
JP2_bilevel1_SPACE, exept that a value of 1 means white and 0 means black.
-
JP2_sRGB_SPACE (EnumCS=16) — This is the standard RGB space
used by JP2 files. Try to use this colour space if
you have a choice, since that will encourage JP2-compatibility.
(*) The primaries are those of ITU-R Rec. BT709, having
the same chromaticities and whitepoint as
JP2_YCbCr1_SPACE, except that the gamma function uses parameters gamma=2.4
and beta=0.055, which are different from those defined
by Rec. BT709. These are defined in IEC 61966-2-1 (sRGB).
-
JP2_sLUM_SPACE (EnumCS=17) — This is the standard luminance
space used by JP2 files. Try to use this space if you
have a choice of luminance specifications, since that
will encourage JP2-compatibility. (*) Uses a gamma
function with gamma=2.4 and beta=0.055, which is the
same as that defined by IEC 61966-2-1 for the sRGB
space.
-
JP2_sYCC_SPACE (EnumCS=18) — This is the standard opponent
colour space used by JP2 files. Try to use this space
if you have a choice of opponent colour specifications,
since that will encourage JP2-compatibility. (*) The
primaries are those of ITU-R Rec. BT709, except that
the gamma function uses parameters gamma=2.4 and beta=0.055,
exactly as for
JP2_sRGB_SPACE. (*) The opponent colour transform used to map RGB
to Y, C1 and C2 values is identical to the ICT (irreversible
colour transform) defined by JPEG2000 Part 1, without
any additional scaling.
-
JP2_CIEJab_SPACE (EnumCS=19) — This colour space is based on
CIECAM97s (CIE Publication 131). If you choose to use
this form of the
init function, you will get the default Jab parameters,
as described in the documentation provided with the
second form of the
init function.
-
JP2_esRGB_SPACE (EnumCS=20) — This is an extended form of the
sRGB colour space, designed to allow colours with a
larger gamut than that of sRGB to be represented. The
specification may be found in PIMA 7667; however, the
extension is simple enough to understand: (*) The underlying
primaries and gamma function are the same as those
of
JP2_sRGB_SPACE (i.e., Rec. 709 primaries with a different gamma of
2.4 and beta=0.055). However, negative and abnormally
large values for the linear R, G and B primary intensities
are considered legal. The gamma function processes
negative channel values by processing their magnitude
in the usual fashion and passing the sign across the
gamma function — that is, the gamma function
is defined to be and odd (symmetric) function of its
input. (*) Regarding the gamma corrected channel intensities
as unsigned quantities with a nominal range of 0 to
1 (remember that negative and abnormally large values
are allowed, though), these values are scaled by 0.5
and then offset by adding exactly 0.375.
-
JP2_ROMMRGB_SPACE (EnumCS=21) — As defined in PIMA 7666.
-
JP2_YPbPr60_SPACE (EnumCS=22) — Opponent colour space used by
HDTV systems. (*) The primaries have chromaticities
(0.67,0.33), (0.21,0.71) and (0.15,0.06), with a D65
whitepoint (0.3127,0.3290), and gamma=1/0.45, with
beta=0.099. (*) The opponent colour transform used
to map RGB to Y, Pb and Pr values yields: Y'=0.2122*R+0.7013*G+0.0865*B;
Pb'=-0.1162*R-0.3838*G+0.5*B; Pr'=0.5*R-0.4451*G-0.0549*B,
where Y, Pb and Pr are obtained by scaling and offsetting
Y', Pb' and Pr'. Exactly as for the
JP2_YCbCr1_SPACE, if R, G and B lie in the nominal range 0 to 1, so
that Y' has the same range and Pb' and Pr' lie in the
range -0.5 to +0.5, the actual opponent channels are
scaled such that Y = (219*Y'+16) / 256, Pb = Pb' *
224/256 and Pr = Pr' * 224/256. This ensures that when
these quantities are represented as unsigned 8-bit
numbers, they will lie in the range 16 to 235 (for
Y) and 16 to 240 (for Pb and Pr).
-
JP2_YPbPr50_SPACE (EnumCS=23) — The standard indicates that this
space has a slightly different opponent colour transform
than
JP2_YPbPr60_SPACE; however, I have been unable to confirm this. All
information I have been able to lay my hands on concerning
YPbPr provides the definition given above; it may be
that the text in the standard was borrowed from the
SPIFF documentation, and that this had become outdated.
-
JP2_esYCC_SPACE (EnumCS=24) — This is an extended form of sYCC,
whose definition may be found in Annex B of PIMA 7667.
Although the basic principles are similar to those
associated with esRGB, this colour space is NOT obtained
simply by applying the irreversible colour transform
to the esRGB coordinates. Instead, the following procedure
is used to obtain esYCC coordinates. (*) The colour
space is based on the same primaries and gamma function
as sRGB and esRGB (i.e., Rec. 709 primaries, with the
different gamma of 2.4, with beta=0.055). As with esRGB,
the linear primary RGB coordinates are allowed to take
on negative and abnormally large values. (*) The opponent
transform is obtained by first applying the ICT (irreversible
colour transform) defined by JPEG2000 Part 1 to the
above-mentioned primaries, and then scaling the Cb
and Cr coordinates by 0.5. Once this is done, negative
or abnormally large values for the luminance coordinate
are clipped so that the extended gamut information
is retained only in the chrominance channels.