title: Getting black and white intensity values from a histogram
body: <p>I am trying to get black and white histogram data from a  color image. However the current setup I have with my histogram only shows me color data I'm sure that it's something that I have to modify in my current math setup.</p>
  
  <pre><code>// Current setup on how to render histogram data to the screen with hist being the calculated histogram
  histimg = Mat::zeros(200, 320, CV_8UC3)
  int binW = histimg.cols / 16;
  Mat buf(1, 16, CV_8UC3);
  for( int i = 0; i &lt; 16; i++ )
  {
      buf.at&lt;Vec3b&gt;(i) = Vec3b(saturate_cast&lt;uchar&gt;(i*180./16), 255, 255);
  }
  cvtColor(buf, buf, CV_HSV2BGR);
  
  for( int i = 0; i &lt; 16; i++ )
  {
      int val = saturate_cast&lt;int&gt;(hist.at&lt;float&gt;(i)*histimg.rows/255);
      rectangle( histimg, Point(i*binW,histimg.rows),
          Point((i+1)*binW,histimg.rows - val),
          Scalar(buf.at&lt;Vec3b&gt;(i)), -1, 8 );
  }
  </code></pre>
  
  <p>Thanks in advance for any advice.</p>