title: OpenCV (via python) on Linux: Set frame width/height?
body: <p>I'm using openCV via python on linux (ubuntu 12.04), and I have a logitech c920 from which I'd like to grab images. Cheese is able to grab frames up to really high resolutions, but whenever I try to use openCV, I only get 640x480 images. I have tried:</p>
  
  <pre><code>import cv
  cam = cv.CaptureFromCAM(-1)
  cv.SetCaptureProperty(cam,cv.CV_CAP_PROP_FRAME_WIDTH,1920)
  cv.SetCaptureProperty(cam,cv.CV_CAP_PROP_FRAME_WIDTH,1080)
  </code></pre>
  
  <p>but this yields output of "0" after each of the last two lines, and when I subsequently grab a frame via:</p>
  
  <pre><code>image = cv.QueryFrame(cam)
  </code></pre>
  
  <p>The resulting image is still 640x480.</p>
  
  <p>I've tried installing what seemed to be related tools via (outside of python):</p>
  
  <pre><code>sudo apt-get install libv4l-dev v4l-utils qv4l2 v4l2ucp
  </code></pre>
  
  <p>and I can indeed apparently manipulate the camera's settings (again, outside of python) via:</p>
  
  <pre><code>v4l2-ctl --set-fmt-video=width=1920,height=1080,pixelformat=1
  v4l2-ctl --set-parm=30
  </code></pre>
  
  <p>and observe that:</p>
  
  <pre><code>v4l2-ctl -V
  </code></pre>
  
  <p>indeed suggests that something has been changed:</p>
  
  <pre><code>Format Video Capture:
      Width/Height   : 1920/1080
      Pixel Format   : 'H264'
      Field          : None
      Bytes per Line : 3840
      Size Image     : 4147200
      Colorspace     : sRGB
  </code></pre>
  
  <p>But when I pop into the python shell, the above code behaves exactly the same as before (printing zeros when trying to set the properties and obtaining an image that is 640x480).</p>
  
  <p>Being able to bump up the resolution of the capture is pretty mission critical for me, so I'd greatly appreciate any pointers anyone can provide.</p>