latest version v1.9 - last update 10 Apr 2010 |
00001 /* 00002 * Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 00003 * Lehrstuhl fuer Technische Informatik, RWTH-Aachen, Germany 00004 * 00005 * This file is part of the LTI-Computer Vision Library (LTI-Lib) 00006 * 00007 * The LTI-Lib is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU Lesser General Public License (LGPL) 00009 * as published by the Free Software Foundation; either version 2.1 of 00010 * the License, or (at your option) any later version. 00011 * 00012 * The LTI-Lib is distributed in the hope that it will be 00013 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 00014 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU Lesser General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Lesser General Public 00018 * License along with the LTI-Lib; see the file LICENSE. If 00019 * not, write to the Free Software Foundation, Inc., 59 Temple Place - 00020 * Suite 330, Boston, MA 02111-1307, USA. 00021 */ 00022 00023 00024 /*---------------------------------------------------------------- 00025 * project ....: LTI Digital Image/Signal Processing Library 00026 * file .......: ltiSplitImageToXYZ.h 00027 * authors ....: Pablo Alvarado, Stefan Syberichs, Thomas Rusert 00028 * organization: LTI, RWTH Aachen 00029 * creation ...: 19.04.99 00030 * revisions ..: $Id: ltiSplitImageToXYZ.h,v 1.4 2006/02/08 11:54:32 ltilib Exp $ 00031 */ 00032 00033 #ifndef _LTI_SPLIT_IMAGE_TO_XYZ_H_ 00034 #define _LTI_SPLIT_IMAGE_TO_XYZ_H_ 00035 00036 #include "ltiSplitImage.h" 00037 00038 namespace lti { 00039 00040 /** 00041 * Split image in its XYZ norm channels 00042 * 00043 * The following is an excerpt of 00044 * <a href="http://www.cs.rit.edu/~ncs/color/t_convert.html">this page</a> 00045 * 00046 * RGB values in a particular set of primaries can be transformed to 00047 * and from CIE XYZ via a 3x3 matrix transform. These transforms 00048 * involve tristimulus values, that is a set of three linear-light 00049 * components that conform to the CIE color-matching functions. CIE 00050 * XYZ is a special set of tristimulus values. In XYZ, any color is 00051 * represented as a set of positive values. 00052 * 00053 * To transform from XYZ to RGB (with D65 white point), the matrix 00054 * transform used is [3]: 00055 * 00056 * [ R ] [ 3.240479 -1.537150 -0.498535 ] [ X ]<br> 00057 * [ G ] = [ -0.969256 1.875992 0.041556 ] * [ Y ]<br> 00058 * [ B ] [ 0.055648 -0.204043 1.057311 ] [ Z ]<br> 00059 * 00060 * The range for valid R, G, B values is [0,1]. Note, this matrix 00061 * has negative coefficients. Some XYZ color may be transformed to 00062 * RGB values that are negative or greater than one. This means that 00063 * not all visible colors can be produced using the RGB system. 00064 * 00065 * The inverse transformation matrix is as follows: 00066 * 00067 * [ X ] [ 0.412453 0.357580 0.180423 ] [ R ]<br> 00068 * [ Y ] = [ 0.212671 0.715160 0.072169 ] * [ G ]<br> 00069 * [ Z ] [ 0.019334 0.119193 0.950227 ] [ B ]<br> 00070 * 00071 * 00072 * @ingroup gColor 00073 */ 00074 class splitImageToXYZ : public splitImage { 00075 public: 00076 /** 00077 * returns the name of this type 00078 */ 00079 virtual const char* getTypename() const; 00080 00081 /** 00082 * returns a pointer to a clone of the functor 00083 */ 00084 virtual functor* clone() const; 00085 00086 /** 00087 * on-copy 00088 */ 00089 virtual bool apply(const image& img, 00090 channel& c1, 00091 channel& c2, 00092 channel& c3) const; 00093 /** 00094 * on-copy 00095 */ 00096 virtual bool apply(const image& img, 00097 channel8& c1, 00098 channel8& c2, 00099 channel8& c3) const; 00100 00101 /** 00102 * on-copy 00103 */ 00104 virtual bool apply(const rgbPixel& pixel, 00105 float& c1, 00106 float& c2, 00107 float& c3) const; 00108 /** 00109 * on-copy 00110 */ 00111 virtual bool apply(const rgbPixel& pixel, 00112 ubyte& c1, 00113 ubyte& c2, 00114 ubyte& c3) const; 00115 00116 }; 00117 00118 } // namespace lti 00119 #endif