Parcourir la source

Debuggage ycurve

Rémi Synave il y a 2 ans
Parent
commit
72c24eaba3
3 fichiers modifiés avec 29 ajouts et 2 suppressions
  1. 24 2
      HDRip/ImageHDR.cpp
  2. 1 0
      HDRip/ImageHDR.hpp
  3. 4 0
      HDRip/all_processings.cpp

+ 24 - 2
HDRip/ImageHDR.cpp

@@ -67,7 +67,10 @@ void ImageHDR::display_pixel(unsigned int i) const
   else
     std::cout << "NON LINEAIRE - ";
 
-  std::cout << "Pixel : ( " << data[i * 3] << "   " << data[i * 3 + 1] << "   " << data[i * 3 + 2] << " )" << std::endl;
+  int x = i%width;
+  int y = i/width;
+  
+  std::cout << "Pixel ( " << x << " , " << y << " ) : [ " << data[i * 3] << " " << data[i * 3 + 1] << " " << data[i * 3 + 2] << " ]" << std::endl;
 }
 
 
@@ -76,6 +79,21 @@ void ImageHDR::display_pixel(unsigned int i, unsigned int j) const
   display_pixel(j * width + i);
 }
 
+void ImageHDR::display_debug() const
+{
+  std::cout << "---------------------------------" << std::endl;
+  display_pixel(0,0);
+  display_pixel(width-1,0);
+  display_pixel(width/4,height/4);
+  display_pixel(width*3/4,height/4);
+  display_pixel(width/2,height/2);
+  display_pixel(width/4,height*3/4);
+  display_pixel(width*3/4,height*3/4);
+  display_pixel(0,height-1);
+  display_pixel(width-1,height-1);
+  std::cout << "---------------------------------" << std::endl;
+}
+
 
 
 /****************************************/
@@ -339,7 +357,9 @@ void ImageHDR::ycurve_histogram_regularization(float* colorDataY, float* colorDa
 
 void ImageHDR::yCurve(float s, float b, float m, float w, float h)
 {
-
+  
+  std::cout << data[0] << std::endl;
+  
   if (linear)
   {
     linear_to_non_linear();
@@ -349,6 +369,8 @@ void ImageHDR::yCurve(float s, float b, float m, float w, float h)
 
   float* colorDataY = Conversion::sRGB_to_Y_of_XYZ(data, width * height);
 
+  std::cout << colorDataY[0] << std::endl;
+
   YCurve yc(s, b, m, w, h, 200);
 
 

+ 1 - 0
HDRip/ImageHDR.hpp

@@ -55,6 +55,7 @@ public:
 
   void display_pixel(unsigned int i) const;
   void display_pixel(unsigned int i, unsigned int j) const;
+  void display_debug() const;
 
 
   // image processing

+ 4 - 0
HDRip/all_processings.cpp

@@ -71,9 +71,13 @@ float* yCurve(float* data, unsigned int width, unsigned int height, float yCs, f
 
   img.non_linear_to_linear();
 
+  img.linear=true;
+
   float* ret = new float[width * height * 3];
   memcpy(ret, img.data, width * height * 3 * sizeof(float));
 
+  img.display_debug();
+
   return ret;
 }