title: how to process image with opencv in python?
body: <p>I want to use edge detection algorithms from opencv library.
  Here is a piece of python code:</p>
  
  <pre><code>from opencv.cv import *
  from opencv.highgui import *
  
  img = cvLoadImage ('xxx.jpg')
  cvNamedWindow ('img')
  cvShowImage ('img', img)
  cvWaitKey ()
  
  canny = cvCreateImage (cvSize (img.width, img.height), 8, 3)
  cvCanny (img, canny, 50, 200)
  
  harris = cvCreateImage (cvSize (img.width, img.height), 8, 3)
  cvCornerHarris (img, harris, 5, 5, 0.1)
  </code></pre>
  
  <p>Loading and showing image works fine, but canny and harris transformations fail.<br>
  <code>cvCanny</code> fails with:</p>
  
  <pre><code>RuntimeError:  openCV Error:
      Status=Unsupported format or combination of formats
      function name=cvCanny
      error message=
      file_name=cv/cvcanny.cpp
      line=72
  </code></pre>
  
  <p>and <code>cvCornerHarris</code> fails with this error:</p>
  
  <pre><code>RuntimeError:  openCV Error:
      Status=Assertion failed
      function name=cvCornerHarris
      error message=src.size() == dst.size() &amp;&amp; dst.type() == CV_32FC1
      file_name=cv/cvcorner.cpp
      line=370
  </code></pre>
  
  <p>From this messages I can infer that loaded image has invalid format. But I don't understand how to convert it.<br>
  Here are values of some <code>img</code> fields:</p>
  
  <pre><code>img.type = 1111638032
  img.nChannels = 3
  img.depth = 8
  </code></pre>