Go to Post I put the encrypted manual file onto a 5-1/4" floppy disk, so I'll have it with me when I go to the kickoff event and pick up the kit. - MrForbes [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
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 04-10-2016, 12:56 PM
ProfessorAlekM ProfessorAlekM is offline
Registered User
FRC #6190
 
Join Date: Jan 2016
Location: Canton, Michigan
Posts: 29
ProfessorAlekM has a little shameless behaviour in the past
How to eliminate lag on USB Webcam Java

Hello!

Our team was using the simple camera server code on our robot during our last competition. It worked, but it always had a 1-2 second lag. Is there anyway to just lower the resolution and frame rate of the video (preferable 160x120px) so that the video feed is at least real-time?

(We are using USB webcams)
Reply With Quote
  #2   Spotlight this post!  
Unread 04-10-2016, 01:03 PM
IndySam's Avatar
IndySam IndySam is offline
Registered User
FRC #0829 (Digital Goats)
Team Role: Mentor
 
Join Date: Nov 2005
Rookie Year: 2004
Location: Indy
Posts: 3,346
IndySam has a reputation beyond reputeIndySam has a reputation beyond reputeIndySam has a reputation beyond reputeIndySam has a reputation beyond reputeIndySam has a reputation beyond reputeIndySam has a reputation beyond reputeIndySam has a reputation beyond reputeIndySam has a reputation beyond reputeIndySam has a reputation beyond reputeIndySam has a reputation beyond reputeIndySam has a reputation beyond repute
Re: How to eliminate lag on USB Webcam Java

Right click on the camera on the smart dashboard and you can change the resolution. You can also resize the window.
__________________
"Champions are champions not because they do anything extraordinary but because they do the ordinary things better than anyone else." —Chuck Knoll


2015 Indianapolis District Winner
2014 Boilermaker Regional Industrial Design Award
2013 Smoky Mountain Regional Industrial Design Award
2012 Boilermaker Engineering Excellence Award
2010 Boilermaker Rockwell Innovation in Control Award.
2009 Buckeye J&J Gracious Professionalism Award
2009 Boilermaker J&J Gracious Professionalism Award
2008 Boilermaker J&J Gracious Professionalism Award
2007 St Louis Regional Winners
Reply With Quote
  #3   Spotlight this post!  
Unread 04-10-2016, 01:07 PM
stundt1's Avatar
stundt1 stundt1 is offline
Steve
FRC #4930 (Electric Mayhem)
Team Role: Programmer
 
Join Date: Dec 2010
Rookie Year: 2009
Location: Buffalo,NY
Posts: 363
stundt1 will become famous soon enoughstundt1 will become famous soon enough
Re: How to eliminate lag on USB Webcam Java

Inside the CameraServer Class there is a setQuality() Method.


You can use this to change the quality of the image sent to the Driverstation which should decrease the Lag.


Checkout the WPI Documentation on the CameraServer Class for more information.
__________________
Steve
-Programming Mentor
- Team 578 Alumni
Reply With Quote
  #4   Spotlight this post!  
Unread 04-10-2016, 02:54 PM
ProfessorAlekM ProfessorAlekM is offline
Registered User
FRC #6190
 
Join Date: Jan 2016
Location: Canton, Michigan
Posts: 29
ProfessorAlekM has a little shameless behaviour in the past
Re: How to eliminate lag on USB Webcam Java

We heard from another team that you can preset the resolution of the HD-3000 Camera with the life-cam software, but we tried changing the size of the video in the LifeCam software, but all that does is change the resolution for that recording session, and doesn't transfer when we plug it into the roborio.

Last edited by ProfessorAlekM : 04-10-2016 at 03:05 PM.
Reply With Quote
  #5   Spotlight this post!  
Unread 04-13-2016, 07:45 PM
abigailthefox's Avatar
abigailthefox abigailthefox is offline
Registered User
FRC #1711 (Raptors)
Team Role: Programmer
 
Join Date: Feb 2015
Rookie Year: 2015
Location: Traverse City
Posts: 48
abigailthefox is an unknown quantity at this point
Re: How to eliminate lag on USB Webcam Java

Try running the camera in its own thread during operator control.
Write the vision code like you usually would, and then during the operator control loop, call it in its own thread, separate from other functions of the robot.
We had major camera lag problems, and this fixed it for us.

Here's a bit of example code
Code:
    public void operatorControl() 
    {
    	isDone = false;
    	//Begin vision processing on a new thread
    	Thread thread = new Thread() 
    	{
    		public void run() 
    		{
    			while (!isDone) 
    			{
    				if(RobotMap.visionSystemEnable != -1)
    				{
        				vision.vision();
    				}
    			}
    		}
    	};
    	thread.start();
Reply With Quote
  #6   Spotlight this post!  
Unread 04-13-2016, 09:23 PM
MrRoboSteve MrRoboSteve is offline
Mentor
AKA: Steve Peterson
FRC #3081 (Kennedy RoboEagles)
Team Role: Mentor
 
Join Date: Mar 2012
Rookie Year: 2011
Location: Bloomington, MN
Posts: 566
MrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond repute
Re: How to eliminate lag on USB Webcam Java

Use Resource Monitor to verify that you're not exceeding the 7mbps rate limit on robot <--> operator console communications. We had to set quality on the stream to 30 to do so.
__________________
2016-17 events: 10000 Lakes Regional, Northern Lights Regional, FTC Burnsville Qualifying Tournament

2011 - present · FRC 3081 Kennedy RoboEagles mentor
2013 - present · event volunteer at 10000 Lakes Regional, Northern Lights Regional, North Star Regional, Lake Superior Regional, Minnesota State Tournament, PNW District 4 Glacier Peak, MN FTC, CMP
http://twitter.com/MrRoboSteve · www.linkedin.com/in/speterson
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 07:38 AM.

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