![]() |
![]() |
![]() |
VIPS Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy | Properties |
#include <vips/vips.h> VipsColour; VipsColourClass; VipsColourCode; VipsColourCodeClass; VipsColourDifference; VipsColourDifferenceClass; void (*VipsColourProcessFn) (struct _VipsColour *colour
,VipsPel *out
,VipsPel **in
,int width
); VipsColourSpace; VipsColourSpaceClass; void vips__pythagoras_line (VipsColour *colour
,VipsPel *out
,VipsPel **in
,int width
);
GObject +----VipsObject +----VipsOperation +----VipsColour +----VipsColourCode +----VipsColourDifference +----VipsColourSpace
GObject +----VipsObject +----VipsOperation +----VipsColour +----VipsColourCode
GObject +----VipsObject +----VipsOperation +----VipsColour +----VipsColourDifference
GObject +----VipsObject +----VipsOperation +----VipsColour +----VipsColourSpace
"out" VipsImage* : Read / Write "in" VipsImage* : Read / Write "left" VipsImage* : Read / Write "right" VipsImage* : Read / Write "in" VipsImage* : Read / Write
These operators let you transform coordinates and images between colour spaces, calculate colour differences, and move to and from device spaces.
Radiance images have four 8-bits bands and store 8 bits of R, G and B and another 8 bits of exponent, common to all channels. They are widely used in the HDR imaging community.
The colour functions can be divided into three main groups. First,
functions to transform images between the different colour spaces supported
by VIPS: RGB, sRGB,
XYZ, Yxy,
Lab, LabQ,
LabS, LCh and
CMC). Use vips_colourspace()
to move an image to a
target colourspace using the best sequence of colour transform operations.
Secondly, there are a set of operations for
calculating colour difference metrics. Finally, VIPS wraps LittleCMS and
uses it to provide a set of operations for reading and writing images with
ICC profiles.
This figure shows how the VIPS colour spaces interconvert:
The colour spaces supported by VIPS are:
LabQ
This is the principal VIPS colorimetric storage format. LabQ images have four 8-bit bands and store 10 bits of L and 11 bits of a and b.
You cannot perform calculations on LabQ
images (they are
tagged with VIPS_CODING_LABQ
), though a few operations such as
vips_extract_area()
will work directly with them.
LabS
This format represents coordinates in CIELAB space as a three-band VIPS_FORMAT_SHORT image, scaled to fit the full range of bits. It is the best format for computation, being relatively compact, quick, and accurate. Colour values expressed in this way are hard to visualise.
Lab
Lab colourspace represents CIELAB colour values with a three-band VIPS_FORMAT_FLOAT image. This is the simplest format for general work: adding the constant 50 to the L channel, for example, has the expected result.
VIPS uses D65 LAB, but you can use other colour temperatures with a
little effort, see vips_XYZ2Lab()
.
XYZ
CIE XYZ colour space represented as a three-band VIPS_FORMAT_FLOAT image.
Yxy
CIE Yxy colour space represented as a three-band VIPS_FORMAT_FLOAT image.
RGB
/ sRGB
VIPS converts XYZ to and from sRGB using the usual formula:
http://en.wikipedia.org/wiki/SRGB
You can also use vips_icc_transform()
and friends to go to and from
device space with a generic profile.
LCh
Like Lab
, but rectangular ab
coordinates
are replaced with
polar Ch
(Chroma and hue) coordinates.
Hue angles are expressed in degrees.
CMC
A colour space based on the CMC(1:1) colour difference measurement. This is a highly uniform colour space, much better than CIELAB for expressing small differences.
You can calculate metrics like CMC(2:1) by scaling the spaces before finding differences.
typedef struct { VipsOperationClass parent_class; /* The buffer processor. */ VipsColourProcessFn process_line; } VipsColourClass;
typedef struct { VipsColourClass parent_class; } VipsColourDifferenceClass;
void (*VipsColourProcessFn) (struct _VipsColour *colour
,VipsPel *out
,VipsPel **in
,int width
);
void vips__pythagoras_line (VipsColour *colour
,VipsPel *out
,VipsPel **in
,int width
);