title: Is it possible to have a square resolution with a webcam video stream using OpenCV?
body: <p>I wrote a simple OpenCV program that recovers my webcam video stream and display it on a simple window. I wante to resize this window to the resolution 256x256 but it changed it to 320x240.</p>
  
  <p>Here's my source code :</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;opencv/cv.h&gt;
  #include &lt;opencv/highgui.h&gt;
  
  using namespace std;
  
  int main(int argc, char** argv)
  {
      char key;
      cvNamedWindow("Camera_Output", cv::WINDOW_NORMAL);
      CvCapture *capture = cvCaptureFromCAM(CV_CAP_ANY);
  
      cvSetCaptureProperty(capture, CV_CAP_PROP_FRAME_WIDTH, 256);
      cvSetCaptureProperty(capture, CV_CAP_PROP_FRAME_HEIGHT, 256);
  
      while(1){
  
          IplImage *frame = cvQueryFrame(capture);
  
          cvShowImage("Camera_Output", frame);
  
          key = cvWaitKey(10);
          if (key == 27){
              break;
          }
      }
      cvReleaseCapture(&amp;capture);
      cvDestroyWindow("Camera_Output");
  
      return 0;
  }
  </code></pre>
  
  <p>The output resolution is 320x240 and I want a 256x256 resolution. I think it's not possible because the camera manages its output video stream buffer and it has to keep the same ratio (width/height). What do you think about this idea ?</p>
  
  <p>Is there a function which can force the resolution as a square resolution using OpenCV ?</p>
  
  <p>Thanks a lot in advance for your help.</p>