/**
* @file ColorSpace.h
* @brief color space conversion routines
* @author Michael Koch
* @date 07/28/2008

*/
#ifndef COLORSPACEINCLUDE
#define COLORSPACEINCLUDE


#include "core/image/ImageT.h"
#include "core/vector/VectorT.h"
#include "core/vector/MatrixT.h"

#include "core/image/MultiChannelImageT.h"


namespace OBJREC {

/** @brief color space conversion routines */
class ColorSpace
{

protected:

public:
  enum {
    COLORSPACE_RGB = 0,
    COLORSPACE_HSL,
    COLORSPACE_LAB,
    COLORSPACE_LMS,
    COLORSPACE_OPP,
    NUM_COLORSPACES
  };
//bad position choose better one
  static void ColorImagetoMultiChannelImage( const NICE::ColorImage &imgrgb, NICE::MultiChannelImageT<double> &genimg );

  /** convert RGB to hsl*/
  static NICE::MultiChannelImageT<double> rgbtohsl( const NICE::MultiChannelImageT<double> &imgrgb );
  /** convert hsl to RGB*/
  static NICE::MultiChannelImageT<double> hsltorgb( const NICE::MultiChannelImageT<double> &imghsl );

  /** convert RGB to LAB*/
  static NICE::MultiChannelImageT<double> rgbtolab( const NICE::MultiChannelImageT<double> &imgrgb );

  /** convert LAB to RGB*/
  static NICE::MultiChannelImageT<double> labtorgb( const NICE::MultiChannelImageT<double> &imglab );

  /** convert RGB to LMS*/
  static NICE::MultiChannelImageT<double> rgbtolms( const NICE::MultiChannelImageT<double> &imgrgb );

  template<class SrcPixelType, class DstPixelType>
  static void convert( NICE::MultiChannelImageT<DstPixelType> & dst,
                       const NICE::MultiChannelImageT<SrcPixelType> & src,
                       int dstColorSpace = COLORSPACE_HSL,
                       int srcColorSpace = COLORSPACE_RGB,
                       double dstM = 255.0,
                       double srcM = 255.0 );
};

} // namespace

#include "ColorSpace.tcc"

#endif
