Merge branch 'master' into add-hsv

This commit is contained in:
John Cupitt 2015-06-22 09:35:41 +01:00
commit bdc96844bd
3 changed files with 197 additions and 145 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View File

@ -1,24 +1,25 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://web.resource.org/cc/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://inkscape.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="744.09448819"
height="1052.3622047"
id="svg1431"
sodipodi:version="0.32"
inkscape:version="0.43"
sodipodi:docbase="/home/john/CVS_DEVEL/vips-7.11/doc/src/figs"
inkscape:version="0.91 r13725"
sodipodi:docname="interconvert.svg"
inkscape:export-filename="/home/john/CVS_DEVEL/vips-7.11/doc/src/figs/interconvert.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90">
inkscape:export-ydpi="90"
version="1.1">
<defs
id="defs1433">
<marker
@ -99,7 +100,7 @@
xlink:href="#linearGradient3766"
id="linearGradient1533"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.849266,0,0,0.598685,247.81,161.7982)"
gradientTransform="matrix(0.849266,0,0,0.598685,270.69186,166.87573)"
x1="158.72054"
y1="0.55397713"
x2="158.86745"
@ -174,6 +175,26 @@
y1="0.55397713"
x2="158.86745"
y2="185.72389" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3766"
id="linearGradient3418"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.849266,0,0,0.598685,348.69186,166.87573)"
x1="158.72054"
y1="0.55397713"
x2="158.86745"
y2="185.72389" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3766"
id="linearGradient3436"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.849266,0,0,0.598685,408.69186,166.87573)"
x1="158.72054"
y1="0.55397713"
x2="158.86745"
y2="185.72389" />
</defs>
<sodipodi:namedview
id="base"
@ -182,15 +203,17 @@
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1.3548828"
inkscape:cx="276.197"
inkscape:cy="811.45446"
inkscape:zoom="1.900852"
inkscape:cx="224.42228"
inkscape:cy="860.87629"
inkscape:document-units="px"
inkscape:current-layer="layer1"
inkscape:window-width="917"
inkscape:window-height="766"
inkscape:window-x="721"
inkscape:window-y="190" />
inkscape:window-width="1920"
inkscape:window-height="1052"
inkscape:window-x="0"
inkscape:window-y="0"
showgrid="false"
inkscape:window-maximized="1" />
<metadata
id="metadata1436">
<rdf:RDF>
@ -279,28 +302,27 @@
style="fill:#ffffff;fill-opacity:1;stroke:none">LCh</tspan></text>
</g>
<g
transform="translate(22.88186,5.077526)"
id="g1525">
id="g3405">
<rect
style="fill:url(#linearGradient1533);fill-opacity:1;stroke:#000000;stroke-width:2.30000234;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect1527"
width="43.156143"
height="41.603222"
x="328.2677"
y="195.32306"
x="351.14957"
y="200.40059"
ry="20.801611"
rx="21.578072" />
<text
xml:space="preserve"
style="font-size:12px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
x="349.58502"
y="220.5983"
style="font-style:normal;font-weight:normal;font-size:12px;font-family:'Bitstream Vera Sans';text-align:center;text-anchor:middle;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="372.46689"
y="225.67583"
id="text1529"><tspan
style="fill:#ffffff;fill-opacity:1;stroke:none"
id="tspan1531"
sodipodi:role="line"
x="349.58502"
y="220.5983">disp</tspan></text>
x="372.46689"
y="225.67583">scRGB</tspan></text>
</g>
<g
id="g1535"
@ -422,70 +444,68 @@
style="fill:#ffffff;fill-opacity:1;stroke:none">ICC</tspan></text>
</g>
<path
style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:0.9;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-start:url(#Arrow1Mstart);marker-end:url(#Arrow1Mend);stroke-miterlimit:4;stroke-dasharray:none"
d="M 141.55754,198.25776 L 181.4801,198.25776"
style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:0.89999998;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#Arrow1Mstart);marker-end:url(#Arrow1Mend)"
d="m 140.40754,198.25776 42.22256,0"
id="path1639"
inkscape:connector-type="polyline"
inkscape:connection-start="#g1495"
inkscape:connection-end="#g1468" />
inkscape:connection-end="#g1468"
inkscape:connector-curvature="0" />
<path
style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:0.9;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-start:url(#Arrow1Mstart);marker-mid:none;marker-end:url(#Arrow1Mend);stroke-miterlimit:4;stroke-dasharray:none"
d="M 181.76199,220.20937 L 141.27566,259.80364"
style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:0.89999998;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#Arrow1Mstart);marker-mid:none;marker-end:url(#Arrow1Mend)"
d="m 189.04639,213.08547 -55.05513,53.84207"
id="path1645"
inkscape:connector-type="polyline"
inkscape:connection-start="#g1468"
inkscape:connection-end="#g1555" />
inkscape:connection-end="#g1555"
inkscape:connector-curvature="0" />
<path
style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:0.9;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-start:url(#Arrow1Mstart);marker-end:url(#Arrow1Mend);stroke-miterlimit:4;stroke-dasharray:none"
d="M 181.76199,176.30615 L 141.27566,136.71188"
style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:0.89999998;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#Arrow1Mstart);marker-end:url(#Arrow1Mend)"
d="M 189.04639,183.43005 135.50974,127.78401"
id="path1647"
inkscape:connector-type="polyline"
inkscape:connection-start="#g1468" />
inkscape:connection-start="#g1468"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<path
style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:0.9;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-start:url(#Arrow1Mstart);marker-end:url(#Arrow1Mend);stroke-miterlimit:4;stroke-dasharray:none"
d="M 226.93624,216.42658 L 265.73981,247.44614"
style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:0.89999998;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#Arrow1Mstart);marker-end:url(#Arrow1Mend)"
d="m 220.83339,211.54796 51.00927,40.7768"
id="path1685"
inkscape:connector-type="polyline"
inkscape:connection-start="#g1468"
inkscape:connection-end="#g1475" />
inkscape:connection-end="#g1475"
inkscape:connector-curvature="0" />
<path
style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:0.9;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-start:url(#Arrow1Mstart);marker-end:url(#Arrow1Mend);stroke-miterlimit:4;stroke-dasharray:none"
d="M 226.93624,180.08894 L 265.73981,149.06938"
style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:0.89999998;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#Arrow1Mstart);marker-end:url(#Arrow1Mend)"
d="m 220.83339,184.96756 51.00927,-40.7768"
id="path1687"
inkscape:connector-type="polyline"
inkscape:connection-start="#g1468"
inkscape:connection-end="#g1505" />
inkscape:connection-end="#g1505"
inkscape:connector-curvature="0" />
<path
style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:0.9;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-start:url(#Arrow1Mstart);marker-mid:none;marker-end:url(#Arrow1Mend);stroke-miterlimit:4;stroke-dasharray:none"
d="M 311.19595,130.90056 L 349.99956,130.90056"
style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:0.89999998;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#Arrow1Mstart);marker-mid:none;marker-end:url(#Arrow1Mend)"
d="m 310.04595,130.90056 41.10361,0"
id="path1689"
inkscape:connector-type="polyline"
inkscape:connection-start="#g1505"
inkscape:connection-end="#g1545" />
inkscape:connection-end="#g1545"
inkscape:connector-curvature="0" />
<path
style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:0.9;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-start:url(#Arrow1Mstart);marker-end:url(#Arrow1Mend);stroke-miterlimit:4;stroke-dasharray:none"
d="M 311.19595,253.63514 L 349.99956,233.18201"
style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:0.89999998;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#Arrow1Mstart);marker-end:url(#Arrow1Mend)"
d="m 307.41698,255.62702 45.97721,-24.95538"
id="path1691"
inkscape:connector-type="polyline"
inkscape:connection-start="#g1475"
inkscape:connection-end="#g1525" />
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<path
style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:0.9;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-start:url(#Arrow1Mstart);marker-end:url(#Arrow1Mend);marker-mid:none;stroke-miterlimit:4;stroke-dasharray:none"
d="M 311.19595,277.99294 L 349.99956,299.12585"
style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:0.89999998;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#Arrow1Mstart);marker-mid:none;marker-end:url(#Arrow1Mend)"
d="m 307.27147,275.85562 46.65257,25.40755"
id="path1693"
inkscape:connector-type="polyline"
inkscape:connection-start="#g1475"
inkscape:connection-end="#g1535" />
<text
xml:space="preserve"
style="font-size:12px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
x="408.81937"
y="224.40727"
id="text2764"><tspan
sodipodi:role="line"
id="tspan2766"
x="408.81937"
y="224.40727">Any VIPS RGB space</tspan></text>
inkscape:connection-end="#g1535"
inkscape:connector-curvature="0" />
<text
id="text2768"
y="326.40729"
@ -501,5 +521,65 @@
x="94.858322"
sodipodi:role="line"
id="tspan2772">an ICC profile</tspan></text>
<g
id="g3423"
transform="translate(6,0)">
<rect
rx="21.578072"
ry="20.801611"
y="200.40059"
x="429.14957"
height="41.603222"
width="43.156143"
id="rect3412"
style="fill:url(#linearGradient3418);fill-opacity:1;stroke:#000000;stroke-width:2.30000234;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<text
id="text3414"
y="225.67583"
x="450.46689"
style="font-style:normal;font-weight:normal;font-size:12px;font-family:'Bitstream Vera Sans';text-align:center;text-anchor:middle;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
xml:space="preserve"><tspan
y="225.67583"
x="450.46689"
sodipodi:role="line"
id="tspan3416"
style="fill:#ffffff;fill-opacity:1;stroke:none">sRGB</tspan></text>
</g>
<g
id="g3441"
transform="translate(30,0)">
<rect
style="fill:url(#linearGradient3436);fill-opacity:1;stroke:#000000;stroke-width:2.30000234;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect3430"
width="43.156143"
height="41.603222"
x="489.14957"
y="200.40059"
ry="20.801611"
rx="21.578072" />
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:12px;font-family:'Bitstream Vera Sans';text-align:center;text-anchor:middle;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="510.46689"
y="225.67583"
id="text3432"><tspan
style="fill:#ffffff;fill-opacity:1;stroke:none"
id="tspan3434"
sodipodi:role="line"
x="510.46689"
y="225.67583">HSV</tspan></text>
</g>
<path
inkscape:connector-curvature="0"
inkscape:connector-type="polyline"
id="path3446"
d="m 394.40754,222.25776 42.22256,0"
style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:0.89999998;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#Arrow1Mstart);marker-end:url(#Arrow1Mend)" />
<path
style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:0.89999998;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#Arrow1Mstart);marker-end:url(#Arrow1Mend)"
d="m 478.40754,222.25776 42.22256,0"
id="path3448"
inkscape:connector-type="polyline"
inkscape:connector-curvature="0" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

@ -57,19 +57,33 @@
* spaces, calculate colour differences, and move
* to and from device spaces.
*
* All operations process colour from the first few bands and pass other bands
* through unaltered. This means you can operate on images with alpha channels
* safely. If you move to or from 16-bit RGB, any alpha channels are rescaled
* for you.
*
* 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: <emphasis>RGB</emphasis>, <emphasis>sRGB</emphasis>,
* <emphasis>XYZ</emphasis>, <emphasis>Yxy</emphasis>,
* <emphasis>Lab</emphasis>, <emphasis>LabQ</emphasis>,
* <emphasis>LabS</emphasis>, <emphasis>LCh</emphasis> and
* <emphasis>CMC</emphasis>). Use vips_colourspace() to move an image to a
* by VIPS: #VIPS_INTERPRETATION_sRGB, #VIPS_INTERPRETATION_scRGB,
* #VIPS_INTERPRETATION_B_W,
* #VIPS_INTERPRETATION_XYZ, #VIPS_INTERPRETATION_YXY,
* #VIPS_INTERPRETATION_LAB,
* #VIPS_INTERPRETATION_LCH, and
* #VIPS_INTERPRETATION_CMC.
*
* There are also a set of minor colourspaces which are one of the above in a
* slightly different format:
* #VIPS_INTERPRETATION_LAB, #VIPS_INTERPRETATION_LABQ,
* #VIPS_INTERPRETATION_LABS, #VIPS_INTERPRETATION_LCH,
* #VIPS_INTERPRETATION_RGB16, and #VIPS_INTERPRETATION_GREY16.
*
* 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
@ -77,93 +91,53 @@
*
* This figure shows how the VIPS colour spaces interconvert:
*
* <para>
* <inlinegraphic fileref="interconvert.png" format="PNG" />
* </para>
*
* The colour spaces supported by VIPS are:
*
* <itemizedlist>
* <listitem>
* <para>
* <emphasis><code>LabQ</code></emphasis>
* * #VIPS_INTERPRETATION_LAB -- CIELAB '76 colourspace with a D65 white. This
* uses three floats for each band, and bands have the obvious range.
*
* 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.
* There are two
* variants, #VIPS_INTERPRETATION_LABQ and #VIPS_INTERPRETATION_LABS, which
* use ints to store values. These are less precise, but can be quicker to
* store and process.
*
* You cannot perform calculations on <code>LabQ</code> images (they are
* tagged with %VIPS_CODING_LABQ), though a few operations such as
* vips_extract_area() will work directly with them.
* </para>
* </listitem>
* <listitem>
* <para>
* <emphasis><code>LabS</code></emphasis>
* #VIPS_INTERPRETATION_LCH is the same, but with a*b* as polar coordinates.
* Hue is expressed in degrees.
*
* 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.
* </para>
* </listitem>
* <listitem>
* <para>
* <emphasis><code>Lab</code></emphasis>
* * #VIPS_INTERPRETATION_XYZ -- CIE XYZ. This uses three floats.
* See #VIPS_D75_X0 and friends for values for the ranges
* under various illuminants.
*
* 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_INTERPRETATION_YXY is the same, but with little x and y.
*
* VIPS uses D65 LAB, but you can use other colour temperatures with a
* little effort, see vips_XYZ2Lab().
* </para>
* </listitem>
* <listitem>
* <para>
* <emphasis><code>XYZ</code></emphasis>
* * #VIPS_INTERPRETATION_scRGB -- a linear colourspace with the sRGB
* primaries. This is useful if you need linear light and don't care
* much what the primaries are.
*
* CIE XYZ colour space represented as a three-band #VIPS_FORMAT_FLOAT
* image.
* </para>
* </listitem>
* <listitem>
* <para>
* <emphasis><code>Yxy</code></emphasis>
* Linearization is performed with the usual sRGB equations, see below.
*
* CIE Yxy colour space represented as a three-band #VIPS_FORMAT_FLOAT
* image.
* </para>
* </listitem>
* <listitem>
* <para>
* <emphasis><code>RGB</code> / <code>sRGB</code></emphasis>
* * #VIPS_INTERPRETATION_sRGB -- the standard sRGB colourspace, see:
* [wikipedia sRGB](http://en.wikipedia.org/wiki/SRGB).
*
* VIPS converts XYZ to and from sRGB using the usual formula:
* This uses three 8-bit values for each of RGB.
*
* http://en.wikipedia.org/wiki/SRGB
* #VIPS_INTERPRETATION_RGB16 is the same, but using three 16-bit values for
* RGB.
*
* You can also use vips_icc_transform() and friends to go to and from
* device space with a generic profile.
* </para>
* </listitem>
* <listitem>
* <para>
* <emphasis><code>LCh</code></emphasis>
* * #VIPS_INTERPRETATION_B_W -- a monochrome image, roughly G from sRGB.
* The grey value is
* calculated in #VIPS_INTERPRETATION_scRGB space with the usual 0.2, 0.7, 0.1
* RGB ratios.
*
* Like <code>Lab</code>, but rectangular <code>ab</code> coordinates
* are replaced with
* polar <code>Ch</code> (Chroma and hue) coordinates.
* Hue angles are expressed in degrees.
* </para>
* </listitem>
* <listitem>
* <para>
* <emphasis><code>CMC</code></emphasis>
* #VIPS_INTERPRETATION_GREY16 is the same, but using 16-bits.
*
* 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.
* * #VIPS_INTERPRETATION_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.
*
* The CMC colourspace is described in "Uniform Colour Space Based on the
* CMC(l:c) Colour-difference Formula", M R Luo and B Rigg, Journal of the
@ -173,9 +147,7 @@
*
* You can calculate metrics like CMC(2:1) by scaling the spaces before
* finding differences.
* </para>
* </listitem>
* </itemizedlist>
*
*/
/* Areas under curves for Dxx. 2 degree observer.