Go to Post Imagine a time before alliances. A time when secrecy was rampid and the Delphi Forum was just in it's baby stage. - Andy Grady [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

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 12-11-2016, 13:06
team-4480's Avatar
team-4480 team-4480 is offline
Debug? What's that?
FRC #4480
 
Join Date: Jan 2015
Rookie Year: 2013
Location: Minnesooota
Posts: 216
team-4480 will become famous soon enoughteam-4480 will become famous soon enough
Sending OpenCV Output back to the Driver Laptop?

Hi,

We have a mini-PC on our testing robot and we are testing some different vision code. One problem is that in our OpenCV Python code, we simply cannot figure how to send the final image back to us. We have looked all other the internet with no avail.

We would like to be able to the output for not only testing but eventually, we might make a driver assist computer vision program that points out game pieces and such.

Ideally, we would like to be able to send it to an HTTP page, but we are open to other options. Also, being low latency is a big need in the solution.

Thanks a bunch in advance!
__________________
#Python4Life
Reply With Quote
  #2   Spotlight this post!  
Unread 12-11-2016, 13:47
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: 192
jreneew2 has a spectacular aura aboutjreneew2 has a spectacular aura aboutjreneew2 has a spectacular aura about
Re: Sending OpenCV Output back to the Driver Laptop?

Have you looked at mjpg-streamer?

https://github.com/robotpy/mjpg-streamer
Reply With Quote
  #3   Spotlight this post!  
Unread 12-11-2016, 15:16
euhlmann's Avatar
euhlmann euhlmann is offline
CTO, Programmer
AKA: Erik Uhlmann
FRC #2877 (LigerBots)
Team Role: Leadership
 
Join Date: Dec 2015
Rookie Year: 2015
Location: United States
Posts: 312
euhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud of
Re: Sending OpenCV Output back to the Driver Laptop?

You could reimplement the WPILib CameraServer protocol (which is pretty easy if you ignore the client to server side). Basically on a TCP connection on port 1735, repeatedly send the following in order:
- the bytes 1, 0, 0, 0
- a network-order 32-bit integer with the length in bytes of the frame data (JPEG format)
- the JPEG frame data

Then you can view the stream on SmartDashboard with the USB Camera widget.
__________________
Creator of SmartDashboard.js, an extensible nodejs/webkit replacement for SmartDashboard


https://ligerbots.org
Reply With Quote
  #4   Spotlight this post!  
Unread 12-11-2016, 22:00
team-4480's Avatar
team-4480 team-4480 is offline
Debug? What's that?
FRC #4480
 
Join Date: Jan 2015
Rookie Year: 2013
Location: Minnesooota
Posts: 216
team-4480 will become famous soon enoughteam-4480 will become famous soon enough
Re: Sending OpenCV Output back to the Driver Laptop?

Quote:
Originally Posted by jreneew2 View Post
Have you looked at mjpg-streamer?

https://github.com/robotpy/mjpg-streamer
How could I input the output stream of OpenCV with MJPG Streamer?
__________________
#Python4Life
Reply With Quote
  #5   Spotlight this post!  
Unread 13-11-2016, 00: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,041
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: Sending OpenCV Output back to the Driver Laptop?

Quote:
Originally Posted by team-4480 View Post
How could I input the output stream of OpenCV with MJPG Streamer?
There's an OpenCV input plugin that you can use. https://github.com/robotpy/mjpg-stre...s/input_opencv

And, it supports a python input plugin. https://github.com/robotpy/mjpg-stre...r_py/README.md
__________________
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
Reply With Quote
  #6   Spotlight this post!  
Unread 13-11-2016, 13:06
team-4480's Avatar
team-4480 team-4480 is offline
Debug? What's that?
FRC #4480
 
Join Date: Jan 2015
Rookie Year: 2013
Location: Minnesooota
Posts: 216
team-4480 will become famous soon enoughteam-4480 will become famous soon enough
Re: Sending OpenCV Output back to the Driver Laptop?

Quote:
Originally Posted by virtuald View Post
There's an OpenCV input plugin that you can use. https://github.com/robotpy/mjpg-stre...s/input_opencv

And, it supports a python input plugin. https://github.com/robotpy/mjpg-stre...r_py/README.md
This is exactly what I was looking for! However, I am clueless on how to add this plugin to my MJPG-streamer installation on my Linux PC.
__________________
#Python4Life
Reply With Quote
  #7   Spotlight this post!  
Unread 13-11-2016, 13: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,041
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: Sending OpenCV Output back to the Driver Laptop?

Quote:
Originally Posted by team-4480 View Post
This is exactly what I was looking for! However, I am clueless on how to add this plugin to my MJPG-streamer installation on my Linux PC.
If you have the right prerequistites installed (python-devel, numpy, and opencv-devel 3.1), then when you build mjpg-streamer using CMake it should just automatically detect the dependencies and build it.
__________________
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
Reply With Quote
  #8   Spotlight this post!  
Unread 13-11-2016, 19:18
AlexanderTheOK AlexanderTheOK is offline
Guy
no team
 
Join Date: Jan 2014
Rookie Year: 2012
Location: Los Angeles
Posts: 146
AlexanderTheOK is just really niceAlexanderTheOK is just really niceAlexanderTheOK is just really niceAlexanderTheOK is just really nice
Re: Sending OpenCV Output back to the Driver Laptop?

While I personally have used mjpg-streamer for some other projects, I've never used it to serve images from opencv. my preferred method has been this copy pasted and cut up to be used as it's own module. Might be interesting to see if there are any performance differences between doing it yourself and going through mjpg-streamer.
Reply With Quote
  #9   Spotlight this post!  
Unread 13-11-2016, 20: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,041
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: Sending OpenCV Output back to the Driver Laptop?

Quote:
Originally Posted by AlexanderTheOK View Post
While I personally have used mjpg-streamer for some other projects, I've never used it to serve images from opencv. my preferred method has been this copy pasted and cut up to be used as it's own module. Might be interesting to see if there are any performance differences between doing it yourself and going through mjpg-streamer.
The code you linked to is fairly inefficient in a couple of different ways (in particular, it doesn't reuse image buffers), so I'm sure out of the box the mjpg-streamer would beat the pants out of it, particularly if you ran it on a RoboRIO.

After optimization, I suspect the mjpg-streamer version would still end up winning.
__________________
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
Reply With Quote
Reply


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 10:42.

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