Java 类edu.wpi.first.wpilibj.image.ColorImage 实例源码

项目:2014_software    文件:HotGoalDetector.java   
public void getImages(String imageAppend)
{   
    try
    {
        ColorImage image = camera.getImage();
        if(imageWriteLevel >= 1 && imageWriteLevel <= 3)
        {
            NIVision.writeFile(image.image, "/ColorImage" + imageAppend + ".jpg");
            System.out.println("Saving Color Image");
        }
    }
    catch(Throwable t)
    {
        t.printStackTrace();
    }
}
项目:wpilibj    文件:AxisCamera.java   
/**
 * Get an image from the camera. Be sure to free the image when you are done with it.
 * @return A new image from the camera.
 */
public ColorImage getImage() throws AxisCameraException, NIVisionException {
    ColorImage image = new HSLImage();
    if (getImageFn.call1(image.image) == 0) {
        image.free();
        throw new AxisCameraException("No image available");
    }
    return image;
}
项目:FRCTesting    文件:ImageUtils.java   
/** 
 * ColorImage- getImage/getTarget/refresh/update
 * should filter image and get details
 * http://www.spectrum3847.org/frc2012api/edu/wpi/first/wpilibj/image/ColorImage.html
 */
public ColorImage getImage() throws AxisCameraException, NIVisionException {
  ColorImage image=new HSLImage();
  if (true) {//getImageFn.call1(image.image) == 0) {
    image.free();
    throw new AxisCameraException("No image available");
  }
  return image;
}
项目:2014_software    文件:WsCamera.java   
public ColorImage getImage() throws WsCameraException, NIVisionException {
    ColorImage image = new HSLImage();
    if (getImageFn.call1(image.image) == 0) {
        image.free();
        throw new WsCameraException("No image available");
    }
    return image;
}
项目:RobotCode2013    文件:Vision.java   
public VisionTarget [] processFrame() {
    if (enableVision) {
        lastFrame = System.currentTimeMillis();
        try {
            ColorImage image   = camera.getImage();
            BinaryImage bImage = image.thresholdRGB(
                    redLow, redHigh,
                    greenLow, greenHigh,
                    blueLow, blueHigh);
            BinaryImage fImage = bImage.particleFilter(cc);
            ParticleAnalysisReport [] report = fImage.getOrderedParticleAnalysisReports();
            VisionTarget [] targets = new VisionTarget[report.length];
            for (int i = 0; i < report.length; i++) {
                double centerX = report[i].center_mass_x;
                double centerY = report[i].center_mass_y;
                double width = report[i].boundingRectWidth;
                double height = report[i].boundingRectHeight;
                int area = (int)report[i].particleArea;
                targets[i] = new VisionTarget(centerX, centerY, width, height, area);
            }
            frameProcess = System.currentTimeMillis() - lastFrame;
            image.free();
            bImage.free();
            fImage.free();
            return targets;
        } catch (AxisCameraException e) {
            System.out.println("No Image From Camera: ");
            frameProcess = System.currentTimeMillis() - lastFrame;
            return new VisionTarget[0];
        } catch (Exception ex) {
            System.out.println("Camera Exception Thrown: " + ex.getMessage());
            frameProcess = System.currentTimeMillis() - lastFrame;
            return new VisionTarget[0];
        }
    } else { // Vision is not enabled
        return new VisionTarget[0];
    }
}
项目:wpilib-java    文件:AxisCamera.java   
/**
 * Get an image from the camera. Be sure to free the image when you are done with it.
 * @return A new image from the camera.
 */
public ColorImage getImage() throws AxisCameraException, NIVisionException {
    ColorImage image = new HSLImage();
    if (getImageFn.call1(image.image) == 0) {
        image.free();
        throw new AxisCameraException("No image available");
    }
    return image;
}
项目:Robot-Code-2013    文件:CameraSubsystem.java   
public BinaryImage getFilteredImage() throws Exception {
    ColorImage ci = getImage();
    bi = ci.thresholdRGB(RED_LOW, RED_HIGH, GREEN_LOW, GREEN_HIGH, BLUE_LOW, BLUE_HIGH);
    bi = bi.convexHull(false);
    bi = bi.removeSmallObjects(true, 3);
    bi = bi.particleFilter(cc);
    ci.free();
    return bi;
}
项目:Robot-Code-2013    文件:CameraSubsystem.java   
public ColorImage getImage() {
    try{
        return cam.getImage();
    }
    catch(Exception e) {
        return null;
    }
}
项目:Team_1482_2013    文件:vision.java   
public BinaryImage getHSVimage(ColorImage image){
    try{
        this.HSVimage = image.thresholdHSV(92, 196, 19, 100, 30, 100);
    } catch (NIVisionException ex) {
        ex.printStackTrace();
    }
    System.out.println("Processed HSV image");
    return this.HSVimage;
}
项目:Team_1482_2013    文件:vision.java   
public BinaryImage getRGBimage(ColorImage image) {
    try{
        this.RGBimage = image.thresholdRGB(0, 150, 145, 230, 120, 225);
    } catch (NIVisionException ex) {
        ex.printStackTrace();
    }
    System.out.println("Processing RGB image");
    return this.RGBimage;
}
项目:649code2014    文件:CameraSubsystem.java   
public ColorImage getImage() throws AxisCameraException, NIVisionException {
    return cam.getImage();
}
项目:Robot-Code-2013    文件:CameraSubsystem.java   
private void storeTop() throws AxisCameraException {
        top = null;
        ColorImage ci = getImage();
        ParticleAnalysisReport target = null;
        if(ci != null) {
            try{
                System.out.println("Storing top details...");
                bi = ci.thresholdRGB(RED_LOW, RED_HIGH, GREEN_LOW, GREEN_HIGH, BLUE_LOW, BLUE_HIGH);
//                ci.free();
//                ci.image.clear();
//                ci.image.free();
                bi = bi.convexHull(false);
                bi = bi.particleFilter(cc);
                bi = bi.removeSmallObjects(true, 2);
                System.out.println("Got here.");
                ParticleAnalysisReport[] reports = bi.getOrderedParticleAnalysisReports();
                ParticleAnalysisReport tmp;
                int lastHighest = 321;
                for(int i=0; i<reports.length; i++) {
                    tmp = reports[i];
                    if(tmp.center_mass_y < lastHighest) {
                        lastHighest = tmp.center_mass_y;
                        target = tmp;
                    }
                }
                }
            catch(Exception e) {
                isProcessing = false;
                System.out.println("Error in the processing.");
                throw new AxisCameraException("Error: "+e.getMessage());
            }
                if(target == null) {
                        isProcessing = false;
                        throw new AxisCameraException("No targets found that fit the specified criteria.");
                    }
                    else {
                        System.out.println(target.toString());
                        top = target;
                    }

//            }
//            catch(Exception e) {
//                isProcessing = false;
//                throw new AxisCameraException("Error: "+e.getMessage());
//            }
        }
        else {
            isProcessing = false;
            throw new AxisCameraException("Couldn't get image.");
        }
        isProcessing = false;
        System.out.println("Finished processing.");
    }
项目:2017    文件:KilroyCamera.java   
/**
 * Returns the AxisCamera (final), in case direct access is necessary
 * For the most part, this should not be used, and if a new camera
 * method is needed, it should just be added to this class
 *
 * @method getCameraInstance()
 * @return ColorImage - Camera.getImage() or a 0x0 hsl image
 * @author Nathan Lydick
 * @throws NIVisionException
 *             - throws exception when fails
 * @written Oct 16, 2014
 *          -------------------------------------------------------
 */
public ColorImage getImage () throws NIVisionException
{
    if (this.haveCamera)
        return this.camera.getImage();
    // returns a 0x0 image
    return new HSLImage();
}
项目:2016    文件:KilroyCamera.java   
/**
 * Returns the AxisCamera (final), in case direct access is necessary
 * For the most part, this should not be used, and if a new camera
 * method is needed, it should just be added to this class
 *
 * @method getCameraInstance()
 * @return ColorImage - Camera.getImage() or a 0x0 hsl image
 * @author Nathan Lydick
 * @throws NIVisionException
 *             - throws exception when fails
 * @written Oct 16, 2014
 *          -------------------------------------------------------
 */
public ColorImage getImage () throws NIVisionException
{
    if (this.haveCamera)
        return this.camera.getImage();
    // returns a 0x0 image
    return new HSLImage();
}
项目:2017    文件:ImageProcessing.java   
/**
 * Updates the current working image
 *
 * @param image
 *            the image to be used as the working image
 */
public void updateImage (ColorImage image)
{
    this.image = image;
}
项目:2017    文件:ImageProcessing_old.java   
/**
 * Updates the current working image
 *
 * @param image
 *            the image to be used as the working image
 */
public void updateImage (ColorImage image)
{
    this.image = image;
}
项目:2016    文件:ImageProcessing.java   
/**
 * Updates the current working image
 *
 * @param image
 *            the image to be used as the working image
 */
public void updateImage (ColorImage image)
{
    this.image = image;
}
项目:Frc2016FirstStronghold    文件:AxisCamera.java   
/**
 * Get an image from the camera and store it in the provided image.
 *
 * @param image The image to store the result in. This must be an HSL or RGB
 *        image
 * @return true upon success, false on a failure
 */
public boolean getImage(ColorImage image) {
  return this.getImage(image.image);
}