ColorSpace.h 1.7 KB

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