title: Saving an image in OpenCV
body: <p>I am new to OpenCV, and trying to capture an image, and then save it to a file. I am posting the code for your reference, below.</p>
  
  <p>The jpg file is being saved, but it is black.</p>
  
  <pre><code>// Capture the Image from the webcam
  CvCapture *pCapturedImage = cvCreateCameraCapture(0);
  
  // Get the frame
  IplImage *pSaveImg = cvQueryFrame(pCapturedImage);
  
  // Save the frame into a file
  cvSaveImage("test.jpg". ,pSaveImg); // A JPG FILE IS BEING SAVED
                                      // OF 6KB , BUT IT IS BLACK
  </code></pre>
  
  <p>All of the functions are succesful. I have tried the above code in both XP and Vista - the result is a black image on both. Please let me know what I am missing out.</p>