Takahiro Onodera > Color-Model-Munsell-Util-0.03 > Color::Model::Munsell::Util

Download:
Color-Model-Munsell-Util-0.03.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.03   Source  

NAME ^

Color::Model::Munsell::Util - Utility functions for Color::Model::Munsell

SYNOPSIS ^

    use Color::Model::Munsell;
    use Color::Model::Munsell::Util;
    use Color::Model::RGB;

    my $m = Color::Model::Munsell->new("5R 4.5/14");
    printf("Munsell: %s = RGB: #%s\n", $m, Munsell2RGB($m));

DESCRIPTION ^

Color::Model::Munsell::Util gives some utility functions for color conversion from Munsell to CIE xyY, XYZ or RGB, etc.

EXPORT SUBROUTINES ^

Only subroutine Munsell2RGB is exported by defalut.

huedegree()

    $n = huedegree( "5R" );

Return degree number of Hue; considered 10.0RP is 0, 10R to be 10, 10YR 20, ..., and ends 9.9RP as 99.9. If bad formatted hue given, this returns undef.

Munsell2xyY()

Munsell2xyY() returns an array of CIE x, y and Y which are calculated with linear interpolation from Munsell-xyY table.

    use Color::Model::Munsell::Util qw(Munsell2xyY);

    $m = Color::Model::Munsell->new("2.5G 5.5/10");
    ($x, $y, $Y) = Munsell2xyY($m);

This Munsell-xyY table is from MCSL, R.I.T. which condition is using illuminant C and the CIE 1931 2 degree observer.

Munsell2XYZ()

Munsell2XYZD65()

    Munsell2XYZ( $m )
    Munsell2XYZD65( $m [, "ChromaticAdaptType" ] )

Munsell2XYZ() and Munsell2XYZD65() returns an array of CIE X,Y and Z.

    $m = Color::Model::Munsell->new("7.5B 6/10");
    printf("%s -> CIE XYZ (%.f, %.f, %.f)", $m, Munsell2XYZ($m));

    # perform cromatic adaptation from C to D65
    printf("%s -> CIE XYZ (%.f, %.f, %.f) via Chromatic Adaptation", $m, Munsell2XYZD65($m));

Munsell2XYZ() simply calculates XYZ from xyY. And Munsell2XYZD65() calculates them with chromatic adaptatation to illuminant D65. Adaptation type must be "XYZ", "vonKries", "Bradford" or "None". If Omitted, "Bradford" is used. Specifying "None" is same as calling Munsell2XYZ().

Munsell2rgb()

Munsell2RGB()

    Munsell2rgb( $m [, "RGBModel" [, "ChromaticAdaptType" ]] )
    Munsell2RGB( $m [, "RGBModel" [, "ChromaticAdaptType" [, $gamma ]]] )

Munsell2rgb() returns an array of R, G and B values which calculated from XYZ with transformation matrix. And Munsell2RGB() returns RGB values with Color::Model::RGB object which applied gamma value.

    $m = Color::Model::Munsell->new("7PB 2.5/3");
    printf("%s -> RGB %s of sRGB", $m, Munsell2RGB($m));
    printf("%s -> RGB %s of AdobeRGB(1998)", $m, Munsell2RGB($m,"AdobeRGB"), 2.2);

RGBModel must be "sRGB", "AdobeRGB" that means Adobe RGB(1998), "AppleRGB" or "NTSC". A gamma value will be used when RGB model is not sRGB.

calc_Yc()

    calc_Yc( $m )

calc_Yc() calculates Y value of illuminant C and 2 degree observer from Munsell value with approximate calculation. Argument must be a Color::Model::Munsell object or Munsell value.

    $m = Color::Model::Munsell->new("5R 4/14")
    printf "%.4f", calc_Yc( $m );
    printf "%.4f", calc_Yc( 7.5 );

AUTHOR ^

Takahiro Onodera, <cpan@garakuta.net>

BUGS ^

Please report any bugs or feature requests to bug-color-model-munsell-util at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Color-Model-Munsell-Util. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SEE ALSO ^

Color::Model::Munsell, Color::Model::RGB

REFERENCES ^

Munsell Color Science Laboratory, R.I.T - http://www.cis.rit.edu/mcsl - Munsell-xyY data are from this site.

BruceLindbloom.com - http://www.brucelindbloom.com - Chromatic adaptation matrixes, transformation matrixes and important knowledge are from this site.

Japanese Industrial Standards(JIS) JIS Z 8721(1993)

LICENSE AND COPYRIGHT ^

Copyright 2010 Takahiro Onodera.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

syntax highlighting: