Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   2 Cameras Setup (Lifecam HD 3000) (http://www.chiefdelphi.com/forums/showthread.php?t=143688)

aweso_meme 02-12-2016 10:13 AM

2 Cameras Setup (Lifecam HD 3000)
 
Hello all,

With the game this year being hard to navigate through, I would like to set up two cameras on our robot (in Java of course). However, I was only able to figure out how to get one set up. When both are plugged into the roborio, we do get 2 different camera anmes ("cam0" and "cam1"), so I attempted to set up the second camera using a similar method as the first, however this did not work. We are attempting to use the SmartDashboard for Java, and only one of the cameras showed up (with a second USB camera module on the dashboard, the first camera was duplicated). As was mentioned in the title, we are using two Microsoft Lifecam HD 3000s, and we do not have an axis camera.

Does anyone know how to get this working? I'm open to all suggestions -- I'll update this information if you guys request it.

Thank you all,
--aweso_meme, Team 4687 programmer

ghead 02-12-2016 11:52 AM

Re: 2 Cameras Setup (Lifecam HD 3000)
 
The following post has some sample c++ code that handles 2 USB cameras. It might point you the right direction.

http://www.chiefdelphi.com/forums/sh...25&postcount=6

Andy Sheu 02-14-2016 09:45 AM

Re: 2 Cameras Setup (Lifecam HD 3000)
 
My team is using two USB Cameras and Java. However, we are swapping between them, rather than steaming both at the same time.

Our code can be found here: https://github.com/iron-claw-972/FRC...bot/Robot.java

Look at lines 182-194 and 409-480 (may change in later commits)

BenBernard 02-14-2016 07:52 PM

Re: 2 Cameras Setup (Lifecam HD 3000)
 
We are also streaming only one camera at a time. There are a couple of tricks to this:

1) In Robot.init, instantiate a USBCamera instance for each camera. Then when you call CameraServer.startAutomaticCapture, pass in the default camera.

2) You'll need a Command, probably triggered by a button, to switch cameras. The natural thing to want to do is to simply call startAutomaticCapture again, passing in the other USBCamera instance. That won't work, because of the way startAutomaticCapture is implemented. To solve this, you'll have to create your OWN version of CameraServer (copy, paste, rename), and change the startAutomaticCapture to stopCapture on the camera already in use, if any (m_camera), set the new camera, then startCapture on the new camera.

If you need more details, let me know.


All times are GMT -5. The time now is 02:38 AM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi