title: Wavelet transform in openCV
body: <p>did someone tried to implement DWT in opencv or in C++?
  I saw older posts on this subject and i didn't find them useful for me, because I need a approximation coefficient and details as a result of wavelet transformation.</p>
  <p>I tried to add <a href="http://wavelet2d.sourceforge.net/" rel="nofollow noreferrer">this</a> to my project but it's not working as well as planned.</p>
  <p>And this is to simple, because as a result parameters i need approximation coefficient and details:</p>
  <pre><code>void haar1(float *vec, int n, int w)
  {
  int i=0;
  float *vecp = new float[n];
  for(i=0;i&lt;n;i++)
      vecp[i] = 0;
  
      w/=2;
      for(i=0;i&lt;w;i++)
      {
          vecp[i] = (vec[2*i] + vec[2*i+1])/sqrt(2.0);
          vecp[i+w] = (vec[2*i] - vec[2*i+1])/sqrt(2.0);
      }
      
      for(i=0;i&lt;(w*2);i++)
              vec[i] = vecp[i];
  
          delete [] vecp;
  }
  void haar2(float **matrix, int rows, int cols)
  {
      float *temp_row = new float[cols];
      float *temp_col = new float[rows];
  
      int i=0,j=0;
      int w = cols, h=rows;
  while(w&gt;1 || h&gt;1)
  {
      if(w&gt;1)
      {
          for(i=0;i&lt;h;i++)
          {
              for(j=0;j&lt;cols;j++)
                  temp_row[j] = matrix[i][j];
  
              haar1(temp_row,cols,w);
              
              for(j=0;j&lt;cols;j++)
                  matrix[i][j] = temp_row[j];
          }
      }
  
      if(h&gt;1)
      {
          for(i=0;i&lt;w;i++)
          {
              for(j=0;j&lt;rows;j++)
                  temp_col[j] = matrix[j][i];
              haar1(temp_col, rows, h);
              for(j=0;j&lt;rows;j++)
                  matrix[j][i] = temp_col[j];
          }
      }
  
      if(w&gt;1)
          w/=2;
      if(h&gt;1)
          h/=2;
  }
  
      delete [] temp_row;
      delete [] temp_col;
  }
  </code></pre>
  <p>So can someone help me find dwt implemented in C++ or point me how to extract from above code coefficients. Thanks</p>