CVD 0.8
cvd/colourspace_convert.h
00001 /*                       
00002     This file is part of the CVD Library.
00003 
00004     Copyright (C) 2005 The Authors
00005 
00006     This library is free software; you can redistribute it and/or
00007     modify it under the terms of the GNU Lesser General Public
00008     License as published by the Free Software Foundation; either
00009     version 2.1 of the License, or (at your option) any later version.
00010 
00011     This library is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014     Lesser General Public License for more details.
00015 
00016     You should have received a copy of the GNU Lesser General Public
00017     License along with this library; if not, write to the Free Software
00018     Foundation, Inc., 
00019     51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00020 */
00021 #ifndef CVD_INCLUDE_COLOURSPACE_CONVERT_H
00022 #define CVD_INCLUDE_COLOURSPACE_CONVERT_H
00023 #include <cvd/image_convert_fwd.h>
00024 #include <cvd/colourspaces.h>
00025 #include <cvd/byte.h>
00026 #include <cvd/rgb.h>
00027 #include <cvd/image_convert.h>
00028 
00029 
00030 namespace CVD
00031 {
00032         
00037     template<> void convert_image(const BasicImage<bayer_bggr>& from, BasicImage<byte>& to);
00038     template<> void convert_image(const BasicImage<bayer_grbg>& from, BasicImage<byte>& to);
00039     template<> void convert_image(const BasicImage<bayer_gbrg>& from, BasicImage<byte>& to);
00040     template<> void convert_image(const BasicImage<bayer_rggb>& from, BasicImage<byte>& to);
00041     
00046     template<> void convert_image(const BasicImage<bayer_bggr>& from, BasicImage<Rgb<byte> >& to);
00047     template<> void convert_image(const BasicImage<bayer_grbg>& from, BasicImage<Rgb<byte> >& to);
00048     template<> void convert_image(const BasicImage<bayer_gbrg>& from, BasicImage<Rgb<byte> >& to);
00049     template<> void convert_image(const BasicImage<bayer_rggb>& from, BasicImage<Rgb<byte> >& to);
00050 
00055     template<> void convert_image(const BasicImage<bayer_bggr16>& from, BasicImage<unsigned short>& to);
00056     template<> void convert_image(const BasicImage<bayer_grbg16>& from, BasicImage<unsigned short>& to);
00057     template<> void convert_image(const BasicImage<bayer_gbrg16>& from, BasicImage<unsigned short>& to);
00058     template<> void convert_image(const BasicImage<bayer_rggb16>& from, BasicImage<unsigned short>& to);
00059 
00064     template<> void convert_image(const BasicImage<bayer_bggr16>& from, BasicImage<Rgb<unsigned short> >& to);
00065     template<> void convert_image(const BasicImage<bayer_grbg16>& from, BasicImage<Rgb<unsigned short> >& to);
00066     template<> void convert_image(const BasicImage<bayer_gbrg16>& from, BasicImage<Rgb<unsigned short> >& to);
00067     template<> void convert_image(const BasicImage<bayer_rggb16>& from, BasicImage<Rgb<unsigned short> >& to);
00068 
00073     template<> void convert_image(const BasicImage<bayer_bggr16be>& from, BasicImage<unsigned short>& to);
00074     template<> void convert_image(const BasicImage<bayer_grbg16be>& from, BasicImage<unsigned short>& to);
00075     template<> void convert_image(const BasicImage<bayer_gbrg16be>& from, BasicImage<unsigned short>& to);
00076     template<> void convert_image(const BasicImage<bayer_rggb16be>& from, BasicImage<unsigned short>& to);
00077 
00082     template<> void convert_image(const BasicImage<bayer_bggr16be>& from, BasicImage<Rgb<unsigned short> >& to);
00083     template<> void convert_image(const BasicImage<bayer_grbg16be>& from, BasicImage<Rgb<unsigned short> >& to);
00084     template<> void convert_image(const BasicImage<bayer_gbrg16be>& from, BasicImage<Rgb<unsigned short> >& to);
00085     template<> void convert_image(const BasicImage<bayer_rggb16be>& from, BasicImage<Rgb<unsigned short> >& to);
00086 
00091     template<> void convert_image(const BasicImage<yuv411>& from, BasicImage<Rgb<byte> >& to);
00092 
00093 
00098     template<> void convert_image(const BasicImage<yuv411>& from, BasicImage<byte>& to);
00099     
00104     template<> void convert_image(const BasicImage<yuv422>& from, BasicImage<Rgb<byte> >& to);
00105       
00106 
00111     template<> void convert_image(const BasicImage<yuv422>& from, BasicImage<byte>& to);
00112 
00113     // Name changed from 'convert_image' to prevent conflict with previous convert_image
00114     // with same method signature.
00115 
00119     template<> std::pair<Image<byte>,Image<Rgb<byte> > > convert_image_pair(const BasicImage<yuv411>& from);
00120     
00121     
00126     template<> void convert_image(const BasicImage<vuy422>& from, BasicImage<Rgb<byte> >& to);
00127     
00132     template<> void convert_image(const BasicImage<vuy422>& from, BasicImage<byte>& to);    
00133 
00134 
00135     template<> struct IsConvertible<yuv411,      Rgb<byte> > { static const bool is=1; };
00136     template<> struct IsConvertible<yuv411,      byte>       { static const bool is=1; };
00137     template<> struct IsConvertible<yuv422,      Rgb<byte> > { static const bool is=1; };
00138     template<> struct IsConvertible<yuv422,      byte>       { static const bool is=1; };
00139     template<> struct IsConvertible<bayer_bggr,  byte>       { static const bool is=1; };
00140     template<> struct IsConvertible<bayer_grbg,  byte>       { static const bool is=1; };
00141     template<> struct IsConvertible<bayer_gbrg,  byte>       { static const bool is=1; };
00142     template<> struct IsConvertible<bayer_rggb,  byte>       { static const bool is=1; };
00143     template<> struct IsConvertible<bayer_bggr,  Rgb<byte> > { static const bool is=1; };
00144     template<> struct IsConvertible<bayer_grbg,  Rgb<byte> > { static const bool is=1; };
00145     template<> struct IsConvertible<bayer_gbrg,  Rgb<byte> > { static const bool is=1; };
00146     template<> struct IsConvertible<bayer_rggb,  Rgb<byte> > { static const bool is=1; };
00147     template<> struct IsConvertible<bayer_bggr16  ,unsigned short>       { static const bool is=1; };
00148     template<> struct IsConvertible<bayer_grbg16  ,unsigned short>       { static const bool is=1; };
00149     template<> struct IsConvertible<bayer_gbrg16  ,unsigned short>       { static const bool is=1; };
00150     template<> struct IsConvertible<bayer_rggb16  ,unsigned short>       { static const bool is=1; };
00151     template<> struct IsConvertible<bayer_bggr16  ,Rgb<unsigned short> > { static const bool is=1; };
00152     template<> struct IsConvertible<bayer_grbg16  ,Rgb<unsigned short> > { static const bool is=1; };
00153     template<> struct IsConvertible<bayer_gbrg16  ,Rgb<unsigned short> > { static const bool is=1; };
00154     template<> struct IsConvertible<bayer_rggb16  ,Rgb<unsigned short> > { static const bool is=1; };
00155     template<> struct IsConvertible<bayer_bggr16be,unsigned short>       { static const bool is=1; };
00156     template<> struct IsConvertible<bayer_grbg16be,unsigned short>       { static const bool is=1; };
00157     template<> struct IsConvertible<bayer_gbrg16be,unsigned short>       { static const bool is=1; };
00158     template<> struct IsConvertible<bayer_rggb16be,unsigned short>       { static const bool is=1; };
00159     template<> struct IsConvertible<bayer_bggr16be,Rgb<unsigned short> > { static const bool is=1; };
00160     template<> struct IsConvertible<bayer_grbg16be,Rgb<unsigned short> > { static const bool is=1; };
00161     template<> struct IsConvertible<bayer_gbrg16be,Rgb<unsigned short> > { static const bool is=1; };
00162     template<> struct IsConvertible<bayer_rggb16be,Rgb<unsigned short> > { static const bool is=1; };
00163 }
00164 
00165 #endif