Go to Post Even our greatest idols make mistakes. The good ones, move on and continue to do great things. - Al Skierkiewicz [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 25-01-2017, 22:37
Jayd009's Avatar
Jayd009 Jayd009 is offline
Registered User
AKA: Jonathan
FRC #4468 (Fernbank LINKS)
Team Role: Programmer
 
Join Date: Jan 2016
Rookie Year: 2016
Location: Atlanta, Georgia
Posts: 32
Jayd009 is on a distinguished road
OpenCV VideoWriter Raspberry Pi

Hello everyone,

My team is trying to run vision tracking on our Raspberry Pi for the lifts. We wanted to record the video output so we could debug in real time just in case something went wrong during a match, but OpenCV doesn't run the commands related to the VideoWriter class. There aren't any errors that come from the shell, but the program literally skips over those lines of code. Has anyone else had any problems similar to this on the pi? Do you know how to fix this error?

Thanks,

Jonathan Daniel
Head Programmer
Fernbank LINKS Robotics
__________________
2016: District Event Winner @ Columbus District Qualifier (PCH)
2016: Engineering Inspiration Award @ Peachtree District State Championship
2016: Tesla Subdivision Playoffs Appearance @ FIRST Championship


Reply With Quote
  #2   Spotlight this post!  
Unread 25-01-2017, 22:57
Thad House Thad House is offline
Volunteer, WPILib Contributor
no team (Waiting for 2021)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2010
Location: Thousand Oaks, California
Posts: 1,107
Thad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond repute
Re: OpenCV VideoWriter Raspberry Pi

The wpilib opencv artifacts are not compiled with non-free codec support. Because of this, both VideoWriter and VideoCapture do not support reading or writing from encoded streams such as Avi or mpeg-4. You will need to write individual frames as jpegs using imwrite if you want to write frames.
__________________
All statements made are my own and not the feelings of any of my affiliated teams.
Teams 1510 and 2898 - Student 2010-2012
Team 4488 - Mentor 2013-2016
Co-developer of RobotDotNet, a .NET port of the WPILib.
Reply With Quote
  #3   Spotlight this post!  
Unread 25-01-2017, 23:04
Jayd009's Avatar
Jayd009 Jayd009 is offline
Registered User
AKA: Jonathan
FRC #4468 (Fernbank LINKS)
Team Role: Programmer
 
Join Date: Jan 2016
Rookie Year: 2016
Location: Atlanta, Georgia
Posts: 32
Jayd009 is on a distinguished road
Re: OpenCV VideoWriter Raspberry Pi

OK, thanks!
__________________
2016: District Event Winner @ Columbus District Qualifier (PCH)
2016: Engineering Inspiration Award @ Peachtree District State Championship
2016: Tesla Subdivision Playoffs Appearance @ FIRST Championship


Reply With Quote
  #4   Spotlight this post!  
Unread 26-01-2017, 11:08
KJaget's Avatar
KJaget KJaget is offline
Zebravision Labs
FRC #0900
Team Role: Mentor
 
Join Date: Dec 2014
Rookie Year: 2015
Location: Cary, NC
Posts: 51
KJaget has much to be proud ofKJaget has much to be proud ofKJaget has much to be proud ofKJaget has much to be proud ofKJaget has much to be proud ofKJaget has much to be proud ofKJaget has much to be proud ofKJaget has much to be proud ofKJaget has much to be proud of
Re: OpenCV VideoWriter Raspberry Pi

Quote:
Originally Posted by Thad House View Post
The wpilib opencv artifacts are not compiled with non-free codec support. Because of this, both VideoWriter and VideoCapture do not support reading or writing from encoded streams such as Avi or mpeg-4. You will need to write individual frames as jpegs using imwrite if you want to write frames.
Does it work using MPJEG as the codec type for VideoWriter? We've done that before as an alternative to tying up CPU cycles trying to do H264 or whatever encoding on the fly.
Reply With Quote
  #5   Spotlight this post!  
Unread 26-01-2017, 13:48
Thad House Thad House is offline
Volunteer, WPILib Contributor
no team (Waiting for 2021)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2010
Location: Thousand Oaks, California
Posts: 1,107
Thad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond repute
Re: OpenCV VideoWriter Raspberry Pi

Quote:
Originally Posted by KJaget View Post
Does it work using MPJEG as the codec type for VideoWriter? We've done that before as an alternative to tying up CPU cycles trying to do H264 or whatever encoding on the fly.
Yes, it should be able to do mjpeg, since it does support jpeg images. I have not explicitly tested this however.
__________________
All statements made are my own and not the feelings of any of my affiliated teams.
Teams 1510 and 2898 - Student 2010-2012
Team 4488 - Mentor 2013-2016
Co-developer of RobotDotNet, a .NET port of the WPILib.
Reply With Quote
  #6   Spotlight this post!  
Unread 27-01-2017, 15:11
sparkytwd's Avatar
sparkytwd sparkytwd is offline
Registered User
FRC #3574
Team Role: Mentor
 
Join Date: Feb 2012
Rookie Year: 2012
Location: Seattle
Posts: 102
sparkytwd will become famous soon enough
Re: OpenCV VideoWriter Raspberry Pi

Be careful with MJPEG for recording on an embedded arm device. MJPEG is bitrate hungry and ranges anywhere from 10x to 20x larger than something like h264 or v8. This can easily saturate your SD card's throughput.

WebM might be an option. Another possibility is to use the v4l2-loopback and gstreamer to record locally with x264 in a separate thread, while having your vision processing run on a forked stream.
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 12:58.

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