edu.wpi.first.wpilibj.vision.VisionThread的实例源码

项目:liastem    文件Robot.java   
@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();
}
项目:FRC-2017-Command    文件Vision.java   
public void setUpCamera(){
    CameraServer.getInstance().startAutomaticCapture();
    camera = CameraServer.getInstance().startAutomaticCapture();
    //camera.setResolution(RobotMap.IMG_WIDTH,RobotMap.IMG_HEIGHT);
    //camera.setExposureManual(RobotMap.exposure);
    visionThread = new VisionThread(camera,new gripPipeline(),pipeline -> {
        if (!pipeline.filterContoursOutput().isEmpty()) {
            Rect r = Imgproc.boundingRect(pipeline.filterContoursOutput().get(0));
            synchronized (imgLock) {
                centerX = r.x + (r.width / 2);
            }
        }
    });
}
项目:STEAMworks    文件VisionTest.java   
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,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();
    }
项目:liastem    文件Robot.java   
@Override
public void robotinit() {
    chooser.addDefault("Default Auto",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);
        }
    });
}
项目:liastem    文件FinalRobot.java   
@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);
        }
    });
}
项目:turtleshell    文件BlastoiseShooterVision.java   
/**
 * Instantiates BlastoiseVision with a VideoSource object.
 * This method is not recommended to be used directly,use one of the others instead.
 * @param videoSource
 */
public BlastoiseShooterVision(VideoSource videoSource) {
    this.videoSource = videoSource;
    videoSource.setResolution(Constants.ShooterVision.Camera.WIDTH_PX,Constants.ShooterVision.Camera.HEIGHT_PX);

    VisionThread visionThread = new VisionThread(videoSource,new DetectTargetPipeline(),pipeline -> {
        synchronized (lock) {
            processContours(pipeline.filterContours0Output());
        }
    });
    visionThread.start();
}

相关文章

买水果
比较全面的redis工具类
gson 反序列化到多态子类
java 版本的 mb_strwidth
JAVA 反转字符串的最快方法,大概比StringBuffer.reverse()性...
com.google.gson.internal.bind.ArrayTypeAdapter的实例源码...