#line 1 "/user/cvsspst/ees1cg/RAVL/RAVL-0.7/Image/Base/ByteRGBValue.hh" // This file is part of RAVL, Recognition And Vision Library // Copyright (C) 2001, University of Surrey // This code may be redistributed under the terms of the GNU Lesser // General Public License (LGPL). See the lgpl.licence file for details or // see http://www.gnu.org/copyleft/lesser.html // file-header-ends-here #ifndef RAVL_BYTERGBVALUE_HEADER #define RAVL_BYTERGBVALUE_HEADER 1 ///////////////////////////////////////////////////// //! rcsid="$Id: ByteRGBValue.hh,v 1.11 2002/08/02 12:25:04 jonstarck Exp $" //! file="Ravl/Image/Base/ByteRGBValue.hh" //! lib=RavlImage //! userlevel=Normal //! author="Charles Galambos" //! date="24/01/2001" //! docentry="Ravl.Images.Pixel Types" #include "Ravl/Image/RGBValue.hh" namespace RavlImageN { using namespace RavlN; //: Byte RGB value class. class ByteRGBValueC : public RGBValueC { public: ByteRGBValueC() {} //: Default constructor. // creates an undefined RGB pixel. ByteRGBValueC(ByteT r,ByteT g, ByteT b) : RGBValueC(r,g,b) {} //: Construct from components. ByteRGBValueC(const RGBValueC &vals) : RGBValueC((ByteT)vals[0],(ByteT)vals[1],(ByteT)vals[2]) {} //: Convert from RealT's. ByteRGBValueC(const RGBValueC &oth) : RGBValueC(oth) {} //: Base class constructor. ByteRGBValueC(const TFVectorC &v) : RGBValueC(v) {} //: Base class constructor. ByteT Y() const { return (ByteT)( ((int) data[0] + (int)data[1] + (int)data[2])/3); } //: Calculate intensity of the pixel. // This returns the average of the red, green // and blue components. RGBValueC operator*(RealT val) const { RGBValueC ret; ret[0] = ((RealT)(*this)[0] * val); ret[1] = ((RealT)(*this)[1] * val); ret[2] = ((RealT)(*this)[2] * val); return ret; } //: Multiply by a real. }; } #endif