Go to Post When a team is a team, anything is possible - Bharat Nain [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
  #1   Spotlight this post!  
Unread 10-03-2013, 03:34
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
OpenCV + ffmpeg hangs at low resolutions and low framerate

In case anyone is using OpenCV + ffmpeg to do their image processing, I found a bug in OpenCV that causes ffmpeg to hang for up to 30 seconds or so when trying to connect to the AXIS M1011 camera. I'm surprised the SmartDashboard doesn't run into this problem, since it appears to use ffmpeg underneath the hood for capturing with camera extension widgets (but not for the default camera widget that comes with it).

If you're interested in more details, check out the bug reports at OpenCV and FFMpeg.
__________________
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
  #2   Spotlight this post!  
Unread 10-03-2013, 23:26
gluxon's Avatar
gluxon gluxon is offline
\n
AKA: Brandon Cheng
FRC #0178 (The 2nd Law Enforcers)
Team Role: Leadership
 
Join Date: Apr 2012
Rookie Year: 2011
Location: Connecticut
Posts: 65
gluxon has a spectacular aura aboutgluxon has a spectacular aura aboutgluxon has a spectacular aura about
Re: OpenCV + ffmpeg hangs at low resolutions and low framerate

Around the start of this year's build season, I contacted Spectrum 3847 about using OpenCV on an onboard Raspberry Pi for vision processing. They replied describing a problem with ffmpeg and OpenCV causing significant lag. It is probably the same issue you found above.

Well, a few months later and here I am. I created a fully working Node.js based OpenCV processing server. I'm using the Axis VAPIX Video Streaming API (which is just MJPG over HTTP) and it's giving me 25 processed target images (640x480) per second. I created node-vapix to implement this and interface with the camera and I'm using node-opencv for OpenCV bindings.

This entire time, I never even had to introduce FFmpeg into my project. So I'm asking, why even use OpenCV's VideoCapture instead of directly providing images?

oculus.js: https://github.com/team178/oculus.js
node-vapix: https://github.com/gluxon/node-vapix
node-opencv: https://github.com/peterbraden/node-opencv

Last edited by gluxon : 10-03-2013 at 23:39.
  #3   Spotlight this post!  
Unread 11-03-2013, 22:17
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: OpenCV + ffmpeg hangs at low resolutions and low framerate

Quote:
Originally Posted by gluxon View Post
This entire time, I never even had to introduce FFmpeg into my project. So I'm asking, why even use OpenCV's VideoCapture instead of directly providing images?
Cool stuff. Of course, I've already put in the effort to fix the problem with FFMpeg (and it is fixed, after changing the source code a bit), so I'll stick with that for now until it bites me again.
__________________
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
  #4   Spotlight this post!  
Unread 13-03-2013, 04:06
faust1706's Avatar
faust1706 faust1706 is offline
Registered User
FRC #1706 (Ratchet Rockers)
Team Role: College Student
 
Join Date: Apr 2012
Rookie Year: 2011
Location: St Louis
Posts: 498
faust1706 is infamous around these partsfaust1706 is infamous around these parts
Re: OpenCV + ffmpeg hangs at low resolutions and low framerate

Im so glad to hear 1706 isnt the only team using OpenCV. We use the microsoft kinect though with illuminators (as of this year). Good luck!
__________________
"You're a gentleman," they used to say to him. "You shouldn't have gone murdering people with a hatchet; that's no occupation for a gentleman."
  #5   Spotlight this post!  
Unread 20-03-2013, 19:39
billbo911's Avatar
billbo911 billbo911 is offline
I prefer you give a perfect effort.
AKA: That's "Mr. Bill"
FRC #2073 (EagleForce)
Team Role: Mentor
 
Join Date: Mar 2005
Rookie Year: 2005
Location: Elk Grove, Ca.
Posts: 2,384
billbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond repute
Re: OpenCV + ffmpeg hangs at low resolutions and low framerate

Quote:
Originally Posted by virtuald View Post
Cool stuff. Of course, I've already put in the effort to fix the problem with FFMpeg (and it is fixed, after changing the source code a bit), so I'll stick with that for now until it bites me again.
I am just starting down the road to learning how to use OpenCV with a webcam through Linux. I HAVE NO CLUE right now what I will be facing. So, can you possibly provide tips on what to look out for, gotcha's to avoid, things that worked and things that didn't? I would hate to reinvent the wheel when the work has already been done.

So, what caused the OpenCV + ffmpeg issues and how did you resolve it?
__________________
CalGames 2009 Autonomous Champion Award winner
Sacramento 2010 Creativity in Design winner, Sacramento 2010 Quarter finalist
2011 Sacramento Finalist, 2011 Madtown Engineering Inspiration Award.
2012 Sacramento Semi-Finals, 2012 Sacramento Innovation in Control Award, 2012 SVR Judges Award.
2012 CalGames Autonomous Challenge Award winner ($$$).
2014 2X Rockwell Automation: Innovation in Control Award (CVR and SAC). Curie Division Gracious Professionalism Award.
2014 Capital City Classic Winner AND Runner Up. Madtown Throwdown: Runner up.
2015 Innovation in Control Award, Sacramento.
2016 Chezy Champs Finalist, 2016 MTTD Finalist
  #6   Spotlight this post!  
Unread 20-03-2013, 19:43
faust1706's Avatar
faust1706 faust1706 is offline
Registered User
FRC #1706 (Ratchet Rockers)
Team Role: College Student
 
Join Date: Apr 2012
Rookie Year: 2011
Location: St Louis
Posts: 498
faust1706 is infamous around these partsfaust1706 is infamous around these parts
Re: OpenCV + ffmpeg hangs at low resolutions and low framerate

Just make sure whenever you call functions such as cvCreateWindow and cvCreateMemStorage, you get rid of them too at the end.
__________________
"You're a gentleman," they used to say to him. "You shouldn't have gone murdering people with a hatchet; that's no occupation for a gentleman."
  #7   Spotlight this post!  
Unread 05-04-2013, 11:39
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: OpenCV + ffmpeg hangs at low resolutions and low framerate

Quote:
Originally Posted by billbo911 View Post
So, what caused the OpenCV + ffmpeg issues and how did you resolve it?
To fix it, you have to add a line to the OpenCV source code and rebuild it. Check out the bug reports referenced above for more information.
__________________
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
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