Search code examples
pythonopencvsimplecv

SimpleCv - IOError("cannot identify image file") - from JpegStreamCamera() - IP Webcam for Android


I'm trying to use my Android 2.3 phone with IP Webcam app to display using SimpleCV. The following seems fine.

from SimpleCV import *
import time

cam = JpegStreamCamera("http://192.168.1.3:1025/videofeed") 
img = cam.getImage() 
img.show() 

But, on running I get the following error. The app on phone detects the connection though.

Traceback (most recent call last):
  File "D:\cam.py", line 5, in <module>
    img = cam.getImage()
  File "build\bdist.win32\egg\SimpleCV\Camera.py", line 540, in getImage
    return Image(pil.open(StringIO(self.camthread.currentframe)), self)
  File "C:\Python27\lib\site-packages\pil-1.1.7-py2.7-win32.egg\Image.py", line 1980, in open
    raise IOError("cannot identify image file")
IOError: cannot identify image file

Is there any way to detect the format of webcam stream and convert this stream to jpeg? Any other suggestions? Thanks in advance!


Solution

  • This was a bug and is now actually fixed up in the master branch at: https://github.com/ingenuitas/SimpleCV