CVR-Lib last update 20 Sep 2009

cvrSplitImageToYIQ.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 1999
00003  * Lehrstuhl fuer Technische Informatik, RWTH-Aachen, Germany
00004  *
00005  *
00006  * This file is part of the Computer Vision and Robotics Library (CVR-Lib)
00007  *
00008  * The CVR-Lib is free software; you can redistribute it and/or
00009  * modify it under the terms of the BSD License.
00010  *
00011  * All rights reserved.
00012  *
00013  * Redistribution and use in source and binary forms, with or without
00014  * modification, are permitted provided that the following conditions are met:
00015  *
00016  * 1. Redistributions of source code must retain the above copyright notice,
00017  *    this list of conditions and the following disclaimer.
00018  *
00019  * 2. Redistributions in binary form must reproduce the above copyright notice,
00020  *    this list of conditions and the following disclaimer in the documentation
00021  *    and/or other materials provided with the distribution.
00022  *
00023  * 3. Neither the name of the authors nor the names of its contributors may be
00024  *    used to endorse or promote products derived from this software without
00025  *    specific prior written permission.
00026  *
00027  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00028  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00029  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00030  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
00031  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00032  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00033  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00034  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00035  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00036  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00037  * POSSIBILITY OF SUCH DAMAGE.
00038  */
00039 
00040 
00041 
00042 /**
00043  * \file   cvrSplitImageToYIQ.h
00044  *         Split color image to YIQ
00045  * \author Pablo Alvarado
00046  * \author Stefan Syberichs
00047  * \author Thomas Rusert
00048  * \date   19.04.1999
00049  *
00050  * $Id: cvrSplitImageToYIQ.h,v 1.1 2007/04/05 22:56:36 alvarado Exp $
00051  */
00052 
00053 
00054 #ifndef _CVR_SPLIT_IMAGE_TO_YIQ_H_
00055 #define _CVR_SPLIT_IMAGE_TO_YIQ_H_
00056 
00057 #include "cvrSplitImage.h"
00058 
00059 namespace cvr {
00060 
00061   /**
00062    * Split image in its Luminance Inphase Quadrature channels.
00063    *
00064    * The following is an excerpt of
00065    * <a href="http://www.cs.rit.edu/~ncs/color/t_convert.html">this page</a>
00066    *
00067    * The YIQ system is the color primary system adopted by National
00068    * Television System Committee (NTSC) for color TV broadcasting. The
00069    * YIQ color solid is made by a linear transformation of the RGB
00070    * cube. Its purpose is to exploit certain characteristics of the
00071    * human eye to maximize the utilization of a fixed bandwidth. The
00072    * human visual system is more sensitive to changes in luminance
00073    * than to changes in hue or saturation, and thus a wider bandwidth
00074    * should be dedicated to luminance than to color information. Y is
00075    * similar to perceived luminance, I and Q carry color information
00076    * and some luminance information. The Y signal usually has 4.2 MHz
00077    * bandwidth in a 525 line system. Originally, the I and Q had
00078    * different bandwidths (1.5 and 0.6 MHz), but now they commonly
00079    * have the same bandwidth of 1 MHz.
00080    *
00081    * Here is the RGB -> YIQ conversion:
00082    *
00083    * \code
00084    * [ Y ]     [ 0.299   0.587   0.114 ] [ R ]
00085    * [ I ]  =  [ 0.596  -0.275  -0.321 ] [ G ]
00086    * [ Q ]     [ 0.212  -0.523   0.311 ] [ B ]
00087    * \endcode
00088    * Here is the YIQ -> RGB conversion:
00089    * \code
00090    * [ R ]     [ 1   0.956   0.621 ] [ Y ]
00091    * [ G ]  =  [ 1  -0.272  -0.647 ] [ I ]
00092    * [ B ]     [ 1  -1.105   1.702 ] [ Q ]
00093    * \endcode
00094    *
00095    * This color space is not used anymore.  Modern systems use the YUV, YCbCr
00096    * or YPbPr spaces instead.
00097    *
00098    * @see cvr::splitImageToYUV, cvr::splitImageToYCbCr, cvr::splitImageToYPbPr
00099    *
00100    * @ingroup gColor
00101    */
00102   class splitImageToYIQ : public splitImage {
00103   public:
00104 
00105     /**
00106      * returns the name of this type
00107      */
00108     virtual const std::string& name() const;
00109 
00110     /**
00111      * returns a pointer to a clone of the functor
00112      */
00113     virtual splitImageToYIQ* clone() const;
00114 
00115     /**
00116      * Returns a pointer to a new instance of this functor.
00117      */
00118     virtual splitImageToYIQ* newInstance() const;
00119 
00120     /**
00121      * split the image in YIQ.
00122      * YIQ splitting produces unnormalized channels !
00123      * @param img the image to be splitted
00124      * @param Y the perceived luminance
00125      * @param I color information and some luminance
00126      * @param Q color information and some luminance
00127      */
00128     virtual bool apply(const matrix<rgbaPixel>& img,
00129                        matrix<float>& Y,
00130                        matrix<float>& I,
00131                        matrix<float>& Q) const;
00132 
00133     /**
00134      * split the image in YIQ.
00135      * YIQ splitting produces unnormalized channels !
00136      * @param img the image to be splitted
00137      * @param Y the perceived luminance
00138      * @param I color information and some luminance
00139      * @param Q color information and some luminance
00140      */
00141     virtual bool apply(const matrix<rgbaPixel>& img,
00142                        matrix<ubyte>& Y,
00143                        matrix<ubyte>& I,
00144                        matrix<ubyte>& Q) const;
00145 
00146     /**
00147      * split the pixel in YIQ.
00148      * YIQ splitting produces unnormalized values !
00149      * @param pixel the pixel to be splitted
00150      * @param Y the perceived luminance
00151      * @param I color information and some luminance
00152      * @param Q color information and some luminance
00153      */
00154     virtual bool apply(const rgbaPixel& pixel,
00155                        float& Y,
00156                        float& I,
00157                        float& Q) const;
00158 
00159     /**
00160      * split the pixel in YIQ.
00161      * YIQ splitting produces unnormalized values !
00162      * @param pixel the pixel to be splitted
00163      * @param Y the perceived luminance
00164      * @param I color information and some luminance
00165      * @param Q color information and some luminance
00166      */
00167     virtual bool apply(const rgbaPixel& pixel,
00168                        ubyte& Y,
00169                        ubyte& I,
00170                        ubyte& Q) const;
00171   };
00172 
00173 
00174 } // namespace cvr
00175 #endif

Generated on Sun Sep 20 22:08:00 2009 for CVR-Lib by Doxygen 1.5.8