title: Change OpenCV video file resolution
body: <p>I'm creating a program in OpenCV (2.4.8) which should read video files and do some calculations on them. For these calculations I don't need the high-res frames, I'm perfectly fine with 640*360 as resolution. </p>
  
  <p>In early tests I had my webcam attached and I used:</p>
  
  <pre><code>VideoCapture cap(0);
  cap.set(CV_CAP_PROP_FRAME_WIDTH, 640);
  cap.set(CV_CAP_PROP_FRAME_HEIGHT, 360);
  Mat image;
  cap.read(image);
  namedWindow("firstframe", 1);
  imshow("firstframe", image);
  waitKey(0);
  </code></pre>
  
  <p>Which resized the image perfectly. Now I'm getting to the next step where I want to use my program for stored video instead of a live feed (which I used for testing). 
  When I change the '0' with the source file path (string), the file is loaded, but the resolution remains 1920*1080.</p>
  
  <p>Did I do anything wrong? Is there a way to load the video at a lower resolution 'on the fly'?</p>
  
  <p>I've read the OpenCV documentation. Some of the settings are labeled 'cameras only' but this setting isn't:
  <a href="http://docs.opencv.org/modules/highgui/doc/reading_and_writing_images_and_video.html#videocapture-videocapture">http://docs.opencv.org/modules/highgui/doc/reading_and_writing_images_and_video.html#videocapture-videocapture</a></p>
  
  <p>I'm using OpenCV on a mac, and installed it with MacPorts.</p>
  
  <p>Let me know if any more details are needed.</p>
  
  <p>Thanks ahead for your help</p>
  
  <p><strong>edit:</strong>
  I've realised that the cap.set(...) functions return a boolean, so I've tried printing them out and they both return 0. This of course confirms that the frame isn't resized. Still no clue as to why...</p>
  
  <p><strong>edit 2 :</strong>
  So now, for a temporary solution I use the following line after read(image):</p>
  
  <pre><code>resize(image, image, Size(640, 360), 0, 0, INTER_CUBIC);
  </code></pre>
  
  <p>And this works. But I'm guessing this isn't really the most optimal solution.</p>