ImageHDR.hpp 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #ifndef IMAGEHDR__HPP
  2. #define IMAGEHDR__HPP
  3. #include <cstring>
  4. #include <iostream>
  5. #include "Eigen/Core"
  6. #include "Colorspace.hpp"
  7. class ImageHDR {
  8. public:
  9. bool linear;
  10. unsigned int width, height;
  11. float* data; //3 float per pixel. data size should be width*height*3
  12. float min_intensity, max_intensity;
  13. unsigned int colorspace;
  14. public:
  15. // Constructors/Loading
  16. ImageHDR(float* d = NULL, unsigned int w = 0, unsigned int h = 0);
  17. // Destructor
  18. ~ImageHDR() {delete[] data;};// devrait être delete[] data;
  19. // save - getter/setter
  20. float getR(const unsigned int i, const unsigned j) const { return data[(j * width + i) * 3]; };
  21. float getG(const unsigned int i, const unsigned j) const { return data[(j * width + i) * 3 + 1]; };
  22. float getB(const unsigned int i, const unsigned j) const { return data[(j * width + i) * 3 + 2]; };
  23. void setR(const unsigned int i, const unsigned j, float r) { data[(j * width + i) * 3] = r; };
  24. void setG(const unsigned int i, const unsigned j, float g) { data[(j * width + i) * 3 + 1] = g; };
  25. void setB(const unsigned int i, const unsigned j, float b) { data[(j * width + i) * 3 + 2] = b; };
  26. void display_pixel(unsigned int i) const;
  27. void display_pixel(unsigned int i, unsigned int j) const;
  28. // image processing
  29. void linear_to_non_linear();
  30. void non_linear_to_linear();
  31. void exposure(const float ev);
  32. void contrast(const float c);
  33. void ycurve_histogram_regularization(float* colorDataY, float* colorDataFY);
  34. void yCurve(float s, float b, float m, float w, float h);
  35. void lightnessMask(bool s, bool b, bool m, bool w, bool h);
  36. void saturation(float s);
  37. void colorEditor(float* selection_lightness, float* selection_chroma, float* selection_hue, float tolerance, float edit_hue, float edit_exposure, float edit_contrast, float edit_saturation, bool mask);
  38. private:
  39. // Conversions
  40. Eigen::VectorXf to_EigenVector() const;
  41. };
  42. #endif