ColorSpace.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /**
  2. * @file ColorSpace.h
  3. * @brief color space conversion routines
  4. * @author Michael Koch
  5. * @date 07/28/2008
  6. */
  7. #ifndef COLORSPACEINCLUDE
  8. #define COLORSPACEINCLUDE
  9. #include "core/image/ImageT.h"
  10. #include "core/vector/VectorT.h"
  11. #include "core/vector/MatrixT.h"
  12. #include "core/image/MultiChannelImageT.h"
  13. namespace OBJREC {
  14. /** @brief color space conversion routines */
  15. class ColorSpace
  16. {
  17. protected:
  18. public:
  19. enum {
  20. COLORSPACE_RGB = 0,
  21. COLORSPACE_HSL,
  22. COLORSPACE_LAB,
  23. COLORSPACE_LMS,
  24. COLORSPACE_OPP,
  25. NUM_COLORSPACES
  26. };
  27. //bad position choose better one
  28. static void ColorImagetoMultiChannelImage(const NICE::ColorImage &imgrgb,NICE::MultiChannelImageT<double> &genimg);
  29. #if 0 //entfernt, da Probleme mit Wertebereich, bitte GenericImage und generisches convert benutzen
  30. /** convert RGB to hsl*/
  31. static NICE::ColorImage rgbtohsl(const NICE::ColorImage &imgrgb);
  32. /** convert hsl to RGB*/
  33. static NICE::ColorImage hsltorgb(const NICE::ColorImage &imghsl);
  34. /** convert RGB to LAB*/
  35. static NICE::ColorImage rgbtolab(const NICE::ColorImage &imgrgb);
  36. /** convert LAB to RGB*/
  37. static NICE::ColorImage labtorgb(const NICE::ColorImage &imglab);
  38. /** convert RGB to LMS*/
  39. static NICE::ColorImage rgbtolms(const NICE::ColorImage &imgrgb);*/
  40. #endif
  41. template<class SrcPixelType,class DstPixelType>
  42. static void convert ( NICE::MultiChannelImageT<DstPixelType> & dst,
  43. const NICE::MultiChannelImageT<SrcPixelType> & src,
  44. int dstColorSpace = COLORSPACE_HSL,
  45. int srcColorSpace = COLORSPACE_RGB,
  46. double dstM = 255.0,
  47. double srcM = 255.0);
  48. };
  49. } // namespace
  50. #include "ColorSpace.tcc"
  51. #endif