Go to Post Your attribute of personal sacrifice is very noble, but FIRST needs YOU to be successful first. - DanKein [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 Rate Thread Display Modes
  #61   Spotlight this post!  
Unread 15-02-2016, 13:53
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,108
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: mjpg-streamer running on roboRIO

To connect to an mjpg stream with OpenCV's VideoCapture object, OpenCV needs to have libav/ffmpeg support compiled in. The version of OpenCV that I distribute does not currently have libav support (see issue #2). That's interesting that you were able to connect to an Axis camera, as that would also require libav.

When running the code on the RoboRIO, you should be able to use this URL: http://localhost:5800/?action=stream

EDIT: It's possible that OpenCV 3.x does not require libav to connect to an mjpg stream.. but I know OpenCV 2 did require it. If you're connecting to the stream separately then that's would work too.
__________________
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

Last edited by virtuald : 15-02-2016 at 13:57.
  #62   Spotlight this post!  
Unread 15-02-2016, 14:04
jreneew2's Avatar
jreneew2 jreneew2 is offline
Alumni of Team 2053 Tigertronics
AKA: Drew Williams
FRC #2053 (TigerTronics)
Team Role: Programmer
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Vestal, NY
Posts: 213
jreneew2 has a spectacular aura aboutjreneew2 has a spectacular aura aboutjreneew2 has a spectacular aura about
Re: mjpg-streamer running on roboRIO

Quote:
Originally Posted by virtuald View Post
To connect to an mjpg stream with OpenCV's VideoCapture object, OpenCV needs to have libav/ffmpeg support compiled in. The version of OpenCV that I distribute does not currently have libav support (see issue #2). That's interesting that you were able to connect to an Axis camera, as that would also require libav.

When running the code on the RoboRIO, you should be able to use this URL: http://localhost:5800/?action=stream

EDIT: It's possible that OpenCV 3.x does not require libav to connect to an mjpg stream.. but I know OpenCV 2 did require it. If you're connecting to the stream separately then that's would work too.
Alright, thanks. I'm not sure what you mean when you said "If you're connecting to the stream separately then that would work too". Are you saying that over a web browser?

EDIT: So, is there an issue with linking libav to opencv? Also, I had an axis camera working on opencv 2.4.10, not 3.0. Maybe this will help you?

So, running the vision code with mjpg streamer on the roboRIO is out of the question at the moment? If so, would the next logical step to have vision run on the driver station computer? If so, how would I go about doing that?

Thanks again,
Drew

Last edited by jreneew2 : 15-02-2016 at 14:16.
  #63   Spotlight this post!  
Unread 15-02-2016, 14:13
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,108
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: mjpg-streamer running on roboRIO

Quote:
Originally Posted by jreneew2 View Post
Alright, thanks. I'm not sure what you mean when you said "If you're connecting to the stream separately then that would work too". Are you saying that over a web browser?

So, running the vision code with mjpg streamer on the roboRIO is out of the question at the moment? If so, would the next logical step to have vision run on the driver station computer? If so, how would I go about doing that?

Thanks again,
Drew
Well, you said you could connect to an Axis stream? If you can connect to that, then the mjpg-streamer stream should work too, if you have the right URL.

When I say "separately", I mean roll your own code to make the HTTP connection. Like this python code. It's pretty easy in python because it's fairly easy to create http connections... I'm not sure what I would use in C++, it's been too long.

FWIW, the last time that I used OpenCV to connect to an mjpg stream (an Axis, actually) via ffmpeg, I ran into this bug: https://trac.ffmpeg.org/ticket/2343
__________________
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
  #64   Spotlight this post!  
Unread 15-02-2016, 14:18
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,108
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: mjpg-streamer running on roboRIO

Heh, mjpg-streamer has an HTTP input plugin which reads images from another mjpg-streamer instance. You could grab that code and use it to read from the stream, it seems to be pretty simple.. though, it is GPL so if you used it your code would automatically become GPL too.
__________________
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
  #65   Spotlight this post!  
Unread 15-02-2016, 14:31
hardcopi hardcopi is offline
Registered User
AKA: Rich Lester
FRC #2959 (The Robotarians)
Team Role: Mentor
 
Join Date: Apr 2013
Rookie Year: 2013
Location: Coloma, MI
Posts: 274
hardcopi has much to be proud ofhardcopi has much to be proud ofhardcopi has much to be proud ofhardcopi has much to be proud ofhardcopi has much to be proud ofhardcopi has much to be proud ofhardcopi has much to be proud ofhardcopi has much to be proud ofhardcopi has much to be proud of
Re: mjpg-streamer running on roboRIO

I was able to install the mjpg streamer without issue, works great. The issue (well not really issue more of question) is: Is there a good way to check overall bandwidth usage. I have camera 1 running through Labview for vision tracking and camera 2 running through the streamer. I can adjust the frame rate, resolution, etc, but I want as high as possible without getting into the danger zone. For what we have planned for the 2nd camera even 1 or 2 frames a second is sufficient but I'd prefer it as high res as I can get it.
  #66   Spotlight this post!  
Unread 15-02-2016, 17:18
NegaNexus NegaNexus is offline
Registered User
AKA: Thys Ballard
FRC #2130 (Alpha+)
Team Role: Programmer
 
Join Date: Oct 2012
Rookie Year: 2012
Location: Coeur d'Alene, Idaho
Posts: 16
NegaNexus is an unknown quantity at this point
Re: mjpg-streamer running on roboRIO

Quote:
Originally Posted by virtuald View Post
Sounds like you're going about it the hard way. Install the mjpg-streamer package from https://github.com/robotpy/roborio-packages and it'll automatically boot at startup.
So I did this, but I still have issues with connectivity. I have two cameras set up currently, if that helps.
  #67   Spotlight this post!  
Unread 15-02-2016, 17:28
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,108
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: mjpg-streamer running on roboRIO

Quote:
Originally Posted by NegaNexus View Post
So I did this, but I still have issues with connectivity. I have two cameras set up currently, if that helps.
Same issues? What kind of cameras are you using?

Are you trying to access the cameras from mjpg-streamer and another app (like the robot code)? That won't work, I think you can only access a camera from a single app at a time.
__________________
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
  #68   Spotlight this post!  
Unread 15-02-2016, 18:07
NegaNexus NegaNexus is offline
Registered User
AKA: Thys Ballard
FRC #2130 (Alpha+)
Team Role: Programmer
 
Join Date: Oct 2012
Rookie Year: 2012
Location: Coeur d'Alene, Idaho
Posts: 16
NegaNexus is an unknown quantity at this point
Re: mjpg-streamer running on roboRIO

Quote:
Originally Posted by virtuald View Post
Same issues? What kind of cameras are you using?

Are you trying to access the cameras from mjpg-streamer and another app (like the robot code)? That won't work, I think you can only access a camera from a single app at a time.
We're just accessing the cameras mjpg-streamer. The problem occurs intermittently.

UPDATE: It seems to be working fine now. I post again if we have problems

Last edited by NegaNexus : 15-02-2016 at 18:15. Reason: update on issues
  #69   Spotlight this post!  
Unread 21-02-2016, 17:36
imdunne8 imdunne8 is offline
Registered User
FRC #1736
 
Join Date: Jan 2008
Location: Peoria, IL
Posts: 15
imdunne8 has a spectacular aura aboutimdunne8 has a spectacular aura aboutimdunne8 has a spectacular aura about
Re: mjpg-streamer running on roboRIO

In case anyone is running 2 cameras and wants a convenient way to switch between them, I have a forked branch of the SmartDashboard plugin that allows it. It also has the ability to add a simple "crosshair" circle from SD.

https://github.com/RobotCasserole173...am_SDExtension
  #70   Spotlight this post!  
Unread 09-03-2016, 12:43
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,108
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: mjpg-streamer running on roboRIO

FYI, I created an OpenCV 3.x input plugin for mjpg-streamer that allows you to capture from OpenCV and filter the input via a separate plugin. More information on github. And of course, there's a filter plugin that comes with it that allows you to write a python 3 script and use that as a filter, or you can write your own in C++.

Haven't done much testing with it, but it seems to work on my desktop. I have not pushed a working build into roborio-packages yet... I have packaging setup for it, but want to test it on the RoboRIO first. Will do that tonight.
__________________
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
  #71   Spotlight this post!  
Unread 09-03-2016, 13:28
hardcopi hardcopi is offline
Registered User
AKA: Rich Lester
FRC #2959 (The Robotarians)
Team Role: Mentor
 
Join Date: Apr 2013
Rookie Year: 2013
Location: Coloma, MI
Posts: 274
hardcopi has much to be proud ofhardcopi has much to be proud ofhardcopi has much to be proud ofhardcopi has much to be proud ofhardcopi has much to be proud ofhardcopi has much to be proud ofhardcopi has much to be proud ofhardcopi has much to be proud ofhardcopi has much to be proud of
Re: mjpg-streamer running on roboRIO

What we ended up doing is running mjpg as well as an ip camera. 2 cameras at once just wasn't gonna happen no matter how much we throttled the fps and resolution. We ended up with a nice system of a single ip camera (Axis) and a generic 180 degree camera we got on Amazon. Pictures are excellent and we have a very good field of view. There is a 1/2 a second or so lag which the driver had to get used to though.
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 19:21.

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