title: Calculate Discrete Cosine Transformation of Image with OpenCV
body: <p>I'm trying to use the OpenCV 2.3 Python wrapper to calculate the DCT for an image. Supposedly, images == numpy arrays == CV matrices, so I thought this should work:</p>
  
  <pre><code>import cv2
  img1 = cv2.imread('myimage.jpg', cv2.CV_LOAD_IMAGE_GRAYSCALE)
  img2 = cv2.dct(img1)
  </code></pre>
  
  <p>However, this throws the error:</p>
  
  <pre><code>cv2.error: /usr/local/lib/OpenCV-2.3.1/modules/core/src/dxt.cpp:2247: error: (-215) type == CV_32FC1 || type == CV_64FC1 in function dct
  </code></pre>
  
  <p>I realize the error means the input should be either a 32-bit or 64-bit single-channel floating point matrix. However, I thought that's how my image should have loaded when specifying grayscale, or at least it should be close enough so that CV2 should be able to figure out the conversion.</p>
  
  <p>What's the appropriate way to convert an image for DCT using cv2?</p>