当前位置: 首页>>代码示例>>Java>>正文


Java UsbCamera.setFPS方法代码示例

本文整理汇总了Java中edu.wpi.cscore.UsbCamera.setFPS方法的典型用法代码示例。如果您正苦于以下问题:Java UsbCamera.setFPS方法的具体用法?Java UsbCamera.setFPS怎么用?Java UsbCamera.setFPS使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在edu.wpi.cscore.UsbCamera的用法示例。


在下文中一共展示了UsbCamera.setFPS方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: robotInit

import edu.wpi.cscore.UsbCamera; //导入方法依赖的package包/类
/**
 * This function is run when the robot is first started up and should be
 * used for any initialization code.
 */
@Override
public void robotInit() {
    chooser.addDefault("gear", new HangGear());
    chooser.addObject("baseline", new BaseLine());
    SmartDashboard.putData("Auto", chooser);

    oi = new OI();

    UsbCamera cam = CameraServer.getInstance().startAutomaticCapture(0);
    cam.setResolution(640, 480);
    cam.setFPS(60);
    UsbCamera cam1 = CameraServer.getInstance().startAutomaticCapture(1);
    cam1.setResolution(640, 480);
    cam1.setFPS(60);
    SmartDashboard.putString("Robot State:", "started");
    System.out.println("Robot init");
    chassis.startMonitor();
    intaker.startMonitor();

    shooter.setSleepTime(100);
    shooter.startMonitor();

    stirrer.setSleepTime(300);
    stirrer.startMonitor();

    uSensor.setSleepTime(100);
    uSensor.startMonitor();
}
 
开发者ID:FRCteam6414,项目名称:FRC6414program,代码行数:33,代码来源:Robot.java

示例2: cameraInit

import edu.wpi.cscore.UsbCamera; //导入方法依赖的package包/类
/**
 * Camera switcher initialization
 */
private void cameraInit() {

    // camera switching code
    Thread t = new Thread(() -> {
		
		boolean allowCam1 = false;
		
		UsbCamera camera1 = CameraServer.getInstance().startAutomaticCapture(0);
        camera1.setResolution(320, 240);
        camera1.setFPS(30);
        UsbCamera camera2 = CameraServer.getInstance().startAutomaticCapture(1);
        camera2.setResolution(320, 240);
        camera2.setFPS(30);
        
        CvSink cvSink1 = CameraServer.getInstance().getVideo(camera1);
        CvSink cvSink2 = CameraServer.getInstance().getVideo(camera2);
        CvSource outputStream = CameraServer.getInstance().putVideo("Switcher", 320, 240);
        
        Mat image = new Mat();            
        Mat grey = new Mat();
        
        while(!Thread.interrupted()) {
        	
        	if (Robot.oi.getPrimaryJoystick().getRawButton(4)) { allowCam1 = !allowCam1; }
        	
            if(allowCam1){
              cvSink2.setEnabled(false);
              cvSink1.setEnabled(true);
              cvSink1.grabFrame(image);
            } else{
              cvSink1.setEnabled(false);
              cvSink2.setEnabled(true);
              cvSink2.grabFrame(image);     
            }
            
            Imgproc.cvtColor(image, grey, Imgproc.COLOR_BGR2GRAY);
            
            outputStream.putFrame(grey);
        }
        
    });
    t.start();
}
 
开发者ID:Team4914,项目名称:2017-emmet,代码行数:47,代码来源:Robot.java

示例3: cameraInit

import edu.wpi.cscore.UsbCamera; //导入方法依赖的package包/类
/**
 * Camera switcher initialization
 */
private void cameraInit() {

    // camera switching code
    Thread t = new Thread(() -> {
		
		boolean allowCam1 = false;
		
		UsbCamera camera1 = CameraServer.getInstance().startAutomaticCapture(0);
        camera1.setResolution(320, 240);
        camera1.setFPS(30);
        UsbCamera camera2 = CameraServer.getInstance().startAutomaticCapture(1);
        camera2.setResolution(320, 240);
        camera2.setFPS(30);
        
        CvSink cvSink1 = CameraServer.getInstance().getVideo(camera1);
        CvSink cvSink2 = CameraServer.getInstance().getVideo(camera2);
        CvSource outputStream = CameraServer.getInstance().putVideo("Switcher", 320, 240);
        
        Mat image = new Mat();            
        Mat grey = new Mat();
        
        while(!Thread.interrupted()) {
        	
        	if (Robot.oi.getPrimaryJoystick().getRawButton(4)) { allowCam1 = !allowCam1; }
        	
            if(allowCam1){
              cvSink2.setEnabled(false);
              cvSink1.setEnabled(true);
              cvSink1.grabFrame(image);
            } else{
              cvSink1.setEnabled(false);
              cvSink2.setEnabled(true);
              cvSink2.grabFrame(image);     
            }
            
            // Imgproc.cvtColor(image, grey, Imgproc.COLOR_BGR2GRAY);
            
            // outputStream.putFrame(grey);
            outputStream.putFrame(image);
        }
        
    });
    t.start();
}
 
开发者ID:Team4914,项目名称:2017-emmet,代码行数:48,代码来源:Robot.java


注:本文中的edu.wpi.cscore.UsbCamera.setFPS方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。