Go to Post My team heard another team describe the Championships as "10,000 kids jamming the Georgia Dome for 3 days…more nerds per square foot than a Star Trek convention…and more purposefully employed " Is this true?, Because I don't think there could possibly be a more wonderful place on earth - Emily3204 [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rating: Thread Rating: 3 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 14-12-2013, 10:34
Noam787 Noam787 is offline
Registered User
FRC #4590 (GreenBlitz)
Team Role: Programmer
 
Join Date: Feb 2013
Rookie Year: 2013
Location: Israel
Posts: 8
Noam787 is an unknown quantity at this point
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()
This code is rising an error in the line “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
If anyone can help us it will help us a lot,
GreenBlitz 4590
  #2   Spotlight this post!  
Unread 14-12-2013, 14:22
virtuald's Avatar
virtuald virtuald is offline
RobotPy Guy
AKA: Dustin Spicuzza
FRC #1418 (), FRC #1973, FRC #4796, FRC #6367 ()
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2003
Location: Boston, MA
Posts: 1,102
virtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant future
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
__________________
Maintainer of RobotPy - Python for FRC
Creator of pyfrc (Robot Simulator + utilities for Python) and pynetworktables/pynetworktables2js (NetworkTables for Python & Javascript)

2017 Season: Teams #1973, #4796, #6369
Team #1418 (remote mentor): Newton Quarterfinalists, 2016 Chesapeake District Champion, 2x Innovation in Control award, 2x district event winner
Team #1418: 2015 DC Regional Innovation In Control Award, #2 seed; 2014 VA Industrial Design Award; 2014 Finalists in DC & VA
Team #2423: 2012 & 2013 Boston Regional Innovation in Control Award


Resources: FIRSTWiki (relaunched!) | My Software Stuff
  #3   Spotlight this post!  
Unread 14-12-2013, 14:47
Noam787 Noam787 is offline
Registered User
FRC #4590 (GreenBlitz)
Team Role: Programmer
 
Join Date: Feb 2013
Rookie Year: 2013
Location: Israel
Posts: 8
Noam787 is an unknown quantity at this point
Re: vision with simpleCV problem

Quote:
Originally Posted by virtuald View Post
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
we tried this url too. I think the error occurs because of the stream format that the Axis camera is sending is Mjpeg and the camera object reads Jpeg stream. but, i'm not sure those are two different formats.
  #4   Spotlight this post!  
Unread 15-12-2013, 01:20
virtuald's Avatar
virtuald virtuald is offline
RobotPy Guy
AKA: Dustin Spicuzza
FRC #1418 (), FRC #1973, FRC #4796, FRC #6367 ()
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2003
Location: Boston, MA
Posts: 1,102
virtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant future
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...
Perhaps you could capture the images that way, and then create a SimpleCV image object from the numpy array found in img?
__________________
Maintainer of RobotPy - Python for FRC
Creator of pyfrc (Robot Simulator + utilities for Python) and pynetworktables/pynetworktables2js (NetworkTables for Python & Javascript)

2017 Season: Teams #1973, #4796, #6369
Team #1418 (remote mentor): Newton Quarterfinalists, 2016 Chesapeake District Champion, 2x Innovation in Control award, 2x district event winner
Team #1418: 2015 DC Regional Innovation In Control Award, #2 seed; 2014 VA Industrial Design Award; 2014 Finalists in DC & VA
Team #2423: 2012 & 2013 Boston Regional Innovation in Control Award


Resources: FIRSTWiki (relaunched!) | My Software Stuff
  #5   Spotlight this post!  
Unread 18-12-2013, 15:22
otherguy's Avatar
otherguy otherguy is offline
sparkE
AKA: James
FRC #2168 (The Aluminum Falcons)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: CT
Posts: 443
otherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to behold
Re: vision with simpleCV problem

Quote:
Originally Posted by Noam787 View Post
we tried this url too. I think the error occurs because of the stream format that the Axis camera is sending is Mjpeg and the camera object reads Jpeg stream. but, i'm not sure those are two different formats.
We used openCV running on a beaglebone last year with the Axis M1011. Didn't end up on the robot, but one of our students got everything working pretty well.

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
__________________
http://team2168.org
  #6   Spotlight this post!  
Unread 18-12-2013, 17:15
brennonbrimhall brennonbrimhall is offline
Free Agent
AKA: Brennon Brimhall
no team
Team Role: Alumni
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Clifton Park, NY
Posts: 222
brennonbrimhall is a name known to allbrennonbrimhall is a name known to allbrennonbrimhall is a name known to allbrennonbrimhall is a name known to allbrennonbrimhall is a name known to allbrennonbrimhall is a name known to all
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
.
  • Code:
    http://x.x.x.x/axis-cgi/mjpg/video.cgi
  • Code:
    http://x.x.x.x/axis-cgi/mjpg/video.cgi?camera=&resolution=352x240
  • Code:
    http://x.x.x.x/axis-cgi/mjpg/video.cgi?camera=&resolution=640x480
  • Code:
    http://x.x.x.x/axis-cgi/mjpg/video.cgi?compression=60&camera=1&des_fps=1
  • Code:
    http://x.x.x.x/axis-cgi/mjpg/video.cgi?camera=&resolution=640x480
  • Code:
    http://x.x.x.x/axis-cgi/mjpg/video.cgi?camera=1&resolution=352x288

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.
__________________
Team 20, 2012-2014: 4 blue banners, 5 medals, and 9 team awards.
Church of Jesus Christ of Latter-day Saints, 2014-2016: Missionary, Colorado Denver South Mission.
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 03:20.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi