本文整理汇总了Java中edu.wpi.cscore.UsbCamera.setResolution方法的典型用法代码示例。如果您正苦于以下问题:Java UsbCamera.setResolution方法的具体用法?Java UsbCamera.setResolution怎么用?Java UsbCamera.setResolution使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.wpi.cscore.UsbCamera
的用法示例。
在下文中一共展示了UsbCamera.setResolution方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: robotInit
import edu.wpi.cscore.UsbCamera; //导入方法依赖的package包/类
@Override
public void robotInit() {
RF = new RobotFunctions();
chooser.addDefault("Default Auto", defaultAuto);
chooser.addObject("My Auto", customAuto);
SmartDashboard.putData("Auto modes", chooser);
UsbCamera camera = CameraServer.getInstance().startAutomaticCapture();
camera.setResolution(IMG_WIDTH, IMG_HEIGHT);
visionThread = new VisionThread(camera, new Grip(), pipeline -> {
if (pipeline.equals(null)) {
Rect r = Imgproc.boundingRect(pipeline.filterContoursOutput().get(0));
synchronized (imgLock) {
centerX = r.x + (r.width / 2);//Find the centre of the X Value
centerY = r.y + (r.height / 2);
rw = r.width;
rh = r.height;
}
}
});
visionThread.start();
}
示例2: 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();
}
示例3: VisionTest
import edu.wpi.cscore.UsbCamera; //导入方法依赖的package包/类
public VisionTest() {
UsbCamera camera = CameraServer.getInstance().startAutomaticCapture(); // cam0 by default
camera.setResolution(IMG_WIDTH, IMG_HEIGHT);
camera.setBrightness(0);
// camera.setExposureManual(100);
camera.setExposureAuto();
CvSource cs= CameraServer.getInstance().putVideo("name", IMG_WIDTH, IMG_HEIGHT);
visionThread = new VisionThread(camera, new GripPipeline(), pipeline -> {
Mat IMG_MOD = pipeline.hslThresholdOutput();
if (!pipeline.filterContoursOutput().isEmpty()) {
//Rect recCombine = Imgproc.boundingRect(pipeline.filterContoursOutput().get(0));
Rect recCombine = computeBoundingRectangle(pipeline.filterContoursOutput());
if (recCombine == null) {
targetDetected = false;
return;
}
targetDetected = true;
computeCoords(recCombine);
synchronized (imgLock) {
centerX = recCombine.x + (recCombine.width / 2);
}
Imgproc.rectangle(IMG_MOD, new Point(recCombine.x, recCombine.y),new Point(recCombine.x + recCombine.width,recCombine.y + recCombine.height), new Scalar(255, 20, 0), 5);
} else {
targetDetected = false;
}
cs.putFrame(IMG_MOD);
});
visionThread.start();
Relay relay = new Relay(RobotMap.RELAY_CHANNEL, Direction.kForward);
relay.set(Relay.Value.kOn);
//this.processImage();
}
示例4: robotInit
import edu.wpi.cscore.UsbCamera; //导入方法依赖的package包/类
@Override
public void robotInit() {
chooser.addDefault("Default Auto", defaultAuto);
chooser.addObject("My Auto", customAuto);
SmartDashboard.putData("Auto modes", chooser);
UsbCamera camera = CameraServer.getInstance().startAutomaticCapture();
camera.setResolution(IMG_WIDTH, IMG_HEIGHT);
visionThread = new VisionThread(Camera, new mar4grip(), Pipeline -> {
if (Pipeline.filterContoursOutput().isEmpty()) {
Rect r = Imgproc.boundingRect(Pipeline.findContoursOutput().get(0));
centerX = r.x + (r.width / 2);
}
});
}
示例5: robotInit
import edu.wpi.cscore.UsbCamera; //导入方法依赖的package包/类
@Override
public void robotInit() {
chooser.addDefault("Default Auto", defaultAuto);
chooser.addObject("My Auto", customAuto);
SmartDashboard.putData("Auto modes", chooser);
UsbCamera camera = CameraServer.getInstance().startAutomaticCapture();
camera.setResolution(IMG_WIDTH, IMG_HEIGHT);
visionThread = new VisionThread(Camera, new Grippipeline(), pipeline -> {
if (!pipeline.filterContoursOutput().isEmpty()) {
Rect r = Imgproc.boundingRect(pipeline.findContoursOutput().get(0));
centerX = r.x + (r.width / 2);
}
});
}
示例6: Cameras
import edu.wpi.cscore.UsbCamera; //导入方法依赖的package包/类
/**
* Creates the default camera (cam0) and the cvSink
*/
public Cameras() {
// Define Variables
camNum = 0;
lastSwitched = 0;
source = new Mat();
output = new Mat();
// Setup default camera
cam0 = new UsbCamera("cam0", 0);
cam0.setResolution(320, 240);
CameraServer.getInstance().addCamera(cam0);
cvSink = CameraServer.getInstance().getVideo(cam0);
outputStream = CameraServer.getInstance().putVideo("cams", 320, 240);
}
示例7: 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();
}
示例8: 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();
}