title: Slanted video in openCV
body: <p>I am trying to make a movie with openCV.  I can put all the images into the avi and it works great, except that the image is slanted at a big angle.  It looks like it has been smeared across the image.</p>
  
  <p>The frames are perfectly square, so it cannot be a matter of getting the height and width confused.  The images are 24 bit.  The other thing that is weird is that it does not seem to be consistent when it happens.  sometimes it looks great, sometimes it is slanted.</p>
  
  <p>Here is an image from the movie:
  <a href="http://dl.dropbox.com/u/63600049/MIP.avi" rel="nofollow">http://dl.dropbox.com/u/63600049/MIP.avi</a></p>
  
  <p>Here is the code:</p>
  
  <p>PINVOKE Method</p>
  
  <pre><code>                IntPtr _ptr = CvInvoke.cvCreateVideoWriter(AVIFilename, CvInvoke.CV_FOURCC('M', 'J', 'P', 'G'), 15, size, 1);
  
                  int count = 0;
                  for (int n = 1; n &lt; Frames.Length; n++)
                  {
                      if (Frames[n].Trim().Length &gt; 0)
                      {
                          try
                          {
                              FileInfo file = new FileInfo(Frames[n]);
                              IntPtr ptr = CvInvoke.cvLoadImage(file.FullName, Emgu.CV.CvEnum.LOAD_IMAGE_TYPE.CV_LOAD_IMAGE_ANYCOLOR | Emgu.CV.CvEnum.LOAD_IMAGE_TYPE.CV_LOAD_IMAGE_ANYDEPTH);
                              if (ptr == IntPtr.Zero)
                                  throw new NullReferenceException(String.Format("Unable to load image from file \"{0}\".", file.FullName));
  
                              CvInvoke.cvWriteFrame(_ptr, ptr);
                              //VW.WriteFrame&lt;Bgr, byte&gt;(frame);
                              count++;
                          }
                          catch (Exception ex)
                          {
                              System.Diagnostics.Debug.Print(ex.Message);
                          }
                      }
                  }
                  CvInvoke.cvReleaseVideoWriter(ref _ptr);
  </code></pre>
  
  <p>EMGU Version</p>
  
  <pre><code> public static void CreateAVIVideoEMGU(string AVIFilename, string[] Frames)
      {
          Bitmap bitmap = new Bitmap(Frames[0]);
  
          VideoWriter VW = null;
  
          VW = new VideoWriter(AVIFilename, CvInvoke.CV_FOURCC('M', 'J', 'P', 'G'), 15, bitmap.Height, bitmap.Width, true);
  
          int count = 0;
          for (int n = 1; n &lt; Frames.Length; n++)
          {
              if (Frames[n].Trim().Length &gt; 0)
              {
                  var frame = new Emgu.CV.Image&lt;Bgr, byte&gt;(ConvertBitmapTo24(new Bitmap ( Frames[n])));
                  VW.WriteFrame&lt;Bgr, byte&gt;(frame);
                  count++;
              }
          }
  
          VW.Dispose();
      }
  </code></pre>
  
  <p>The images are all 24 bit jpg of the same dimensions</p>