|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools |
Rating:
|
Display Modes |
|
|
|
#1
|
|||
|
|||
|
vision with simpleCV problem
So this year we are trying onboard vision using raspberryPI. For the image processing we are trying to use simpleCV lib but we got stuck when we tried to connect to the camera’s (Axis M1011) mjpeg stream with the code below:
Code:
import SimpleCV
cam = SimpleCV.JpegStreamCamera('http://10.45.90.11/axis-cgi/mjpg/video.cgi?resolution=320x240')
pic = cam.getImage()
Code:
File "<pyshell#5>", line 1, in <module>
pic =cam.getImage()
File "C:\Python27\lib\site-packages\SimpleCV\Camera.py", line 904, in getImage
return Image(pil.open(StringIO(self.camthread.currentframe)), self)
File "C:\Python27\lib\site-packages\PIL\Image.py", line 1980, in open
raise IOError("cannot identify image file")
IOError: cannot identify image file
GreenBlitz 4590 |
|
#2
|
||||
|
||||
|
Re: vision with simpleCV problem
From what I've seen of SimpleCV, it's not really that much simpler than the normal OpenCV python bindings.
Anyways, try the following URL instead: http://x.x.x.x/mjpg/video.mjpg |
|
#3
|
|||
|
|||
|
Re: vision with simpleCV problem
Quote:
|
|
#4
|
||||
|
||||
|
Re: vision with simpleCV problem
It's very strange to me that it's using PIL to open the images received from the camera... perhaps there's a different class you can use to receive images?
If you're using the OpenCV api, getting images from the camera is straightfoward. You can get images using that URL and the following code (note that error checking is not complete): Code:
import cv2
import sys
vc = cv2.VideoCapture()
if not vc.open('http://%s/mjpg/video.mjpg' % sys.argv[1]):
exit(1)
while True:
retval, img = vc.read()
if not retval:
break
# do something with img...
|
|
#5
|
||||
|
||||
|
Re: vision with simpleCV problem
Quote:
I'm not sure if it will help with your case as I'm not familiar with simpleCV, but we also had trouble with the mjpeg stream and ended up using the jpeg url for the camera: Code:
http://x.x.x.x/jpg/image.jpg |
|
#6
|
|||
|
|||
|
Re: vision with simpleCV problem
As per the SimpleCV wiki here, it looks like these are the list of known IP addresses and paths to the video stream. Make sure you are sending your camera's username and password via the form
Code:
http://username:pass@xxx.xxx.xxx.xxx/path/to/stream
Alternatively, you could find the URL that gives you the last picture taken and use that to make an image for processing, like the previous post suggests. Also, you may want to contact Katherine Scott (from SimpleCV, @kscottz) directly; she's involved with an FRC team and did some debugging with the Axis Camera before. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|