title: IP camera Python error
body: <p>I am trying to access a video from an IP camera. I am using OpenCV and Python to do so. The code that I have tried is given below:</p>
  
  <pre><code>import numpy as np
  import cv2
  from cv2 import cv
  
  camera=cv.CaptureFromFile("http://root:root@192.168.0.90/axis-cgi/mjpg/video.cgi?resolution=640x480&amp;req_fps=30&amp;.mjpg")
  if camera is None:
      print 'Camera is null'
  else:
      print 'Camera is not null'
  cv.NamedWindow("win")
  
  while True:
      image=cv.QueryFrame(camera)
      cv.ShowImage("win", image)
      k=int(cv.WaitKey(10))
      if k is 27:
          break
  </code></pre>
  
  <p>On running this code the output that I am getting is:</p>
  
  <pre><code>Image not converted
  </code></pre>
  
  <p>On using another method, <code>CaptureFromCAM</code> instead of <code>CaptureFromFile</code> the code is:</p>
  
  <pre><code>import numpy as np
  import cv2
  from cv2 import cv
  
  camera=cv.CaptureFromCAM(0)
  if camera is None:
      print 'Camera is null'
  else:
      print 'Camera is not null'
  cv.NamedWindow("win")
  
  while True:
      image=cv.QueryFrame(camera)
      if image is None:
          print 'No conversion to IPL Image'
          break
      else:
          cv.ShowImage("win", image)
  </code></pre>
  
  <p>When I run this code the error I am getting is:</p>
  
  <pre><code>ERROR: SampleCB() - buffer sizes do not match
  No conversion to IPL Image
  </code></pre>
  
  <p>I read about it, and the <code>SampleCB()</code> error is in the case when the buffer size does not match the expected input size. I tried to change the streaming resolution, but nothing seems to work. I followed <a href="https://stackoverflow.com/questions/3374828/how-do-i-track-motion-using-opencv-in-python">this</a> thread and <a href="https://stackoverflow.com/questions/712998/opencv-with-network-cameras">this</a> thread. They are giving the C++ code and on conversion to Python (the code given above) it does not work. Or the thread gives the code for motion detection. I am using <strong>Windows&nbsp;7 and <a href="http://en.wikipedia.org/wiki/Eclipse_%28software%29" rel="nofollow noreferrer">Eclipse</a> with Pydev</strong> for development. What do I do?</p>