Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| " 2013 FRC Java API "
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## edu.wpi.first.wpilibj.image
Class NIVision

    java.lang.Object
      edu.wpi.first.wpilibj.image.NIVision

    public class NIVision

extends Object

Class for interfacing with the NIVision libraries

Author:
  dtjones

Nested Class Summary
`static class` | `NIVision.ColorMode` Enumerations representing the possible color spaces to operate in
`static class` | `NIVision.ImageType` Enumeration representing the possible types of imaq images
`static class` | `NIVision.MeasurementType`
`static class` | `NIVision.Range`
`static class` | `NIVision.Rect`

Field Summary
`protected static BlockingFunction` | `imaqCreateImageFn`

Method Summary
`protected static void` | `assertCleanStatus(int code)`
`static void` | `colorEqualize(Pointer destination, Pointer source, boolean all)` Calculates the histogram of each plane of a color image and redistributes pixel values across the desired range while maintaining pixel value groupings.
`static void` | `colorThreshold(Pointer dest, Pointer source, NIVision.ColorMode mode, Pointer plane1Range, Pointer plane2Range, Pointer plane3Range)` Convert the given image into a binary image true where the colors match the given thresholds
`static void` | `convexHull(Pointer dest, Pointer source, int connectivity8)`
`static int` | `countParticles(Pointer image)` Counts the number of particles in a binary image.
`float` | `decodeGreyscaleValue(int pixelValue)`
`static EllipseMatch[]` | `detectEllipses(MonoImage image, EllipseDescriptor ellipseDescriptor, CurveOptions curveOptions, ShapeDetectionOptions shapeDetectionOptions, RegionOfInterest roi)`
`static void` | `dispose(Pointer item)` Cleans up resources associated with images, regions of interest (ROIs), arrays, and reports that you no longer need.
`int` | `encodeGreyscaleValue(float greyscale)`
`int` | `encodeHSLValue(int h, int s, int l, int a)`
`int` | `encodeHSVValue(int h, int s, int v, int a)`
`int` | `encodeRGBValue(int r, int g, int b, int a)`
`static void` | `extractColorPlanes(Pointer source, NIVision.ColorMode mode, Pointer plane1, Pointer plane2, Pointer plane3)` Extract the color planes from the given source image into the given planes
`static int` | `getHeight(Pointer image)` Get the height of an image.
`static int` | `getLastError()`
`static LinearAverages` | `getLinearAverages(Pointer image, LinearAverages.LinearAveragesMode mode, NIVision.Rect rect)`
`static int` | `getWidth(Pointer image)` Get the width of an image.
`int` | `hslGetA(int hslvalue)`
`int` | `hslGetH(int hslvalue)`
`int` | `hslGetL(int hslvalue)`
`int` | `hslGetS(int hslvalue)`
`int` | `hsvGetA(int hsvvalue)`
`int` | `hsvGetH(int hsvvalue)`
`int` | `hsvGetS(int hsvvalue)`
`int` | `hsvGetV(int hsvvalue)`
`static Pointer` | `imaqCreateImage(NIVision.ImageType type, int borderSize)` Allocates space for and creates a new imaq image
`static double` | `MeasureParticle(Pointer image, int particleNum, boolean calibrated, NIVision.MeasurementType type)` Returns a measurement associated with a particle
`static int` | `particleFilter(Pointer dest, Pointer source, CriteriaCollection collection)`
`static void` | `readFile(Pointer image, String fileName)` Read an image from to the given image from the given filename
`static void` | `readJpegString(Pointer image, Pointer p)` Read a pointer to a byte array into the given image
`static void` | `replaceColorPlanes(Pointer dest, Pointer source, NIVision.ColorMode mode, Pointer plane1, Pointer plane2, Pointer plane3)` Replaces one or more of the color planes of a color image.
`int` | `rgbGetA(int rgbvalue)`
`int` | `rgbGetB(int rgbvalue)`
`int` | `rgbGetG(int rgbvalue)`
`int` | `rgbGetR(int rgbvalue)`
`static void` | `setWriteFileAllowed(boolean val)` Set true to be able to create files on cRio
`static void` | `sizeFilter(Pointer dest, Pointer source, boolean connectivity8, int erosions, boolean keepLarger)`
`static void` | `writeFile(Pointer image, String fileName)` Write an image to the given file.
`static void` | `writeFile(Pointer image, String fileName, Pointer colorTable)` Write an image to the given file.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### imaqCreateImageFn

    protected static final BlockingFunction imaqCreateImageFn

Method Detail

### encodeRGBValue

    public int encodeRGBValue(int r,
                              int g,
                              int b,
                              int a)

### rgbGetR

    public int rgbGetR(int rgbvalue)

### rgbGetG

    public int rgbGetG(int rgbvalue)

### rgbGetB

    public int rgbGetB(int rgbvalue)

### rgbGetA

    public int rgbGetA(int rgbvalue)

### encodeHSLValue

    public int encodeHSLValue(int h,
                              int s,
                              int l,
                              int a)

### hslGetH

    public int hslGetH(int hslvalue)

### hslGetS

    public int hslGetS(int hslvalue)

### hslGetL

    public int hslGetL(int hslvalue)

### hslGetA

    public int hslGetA(int hslvalue)

### encodeHSVValue

    public int encodeHSVValue(int h,
                              int s,
                              int v,
                              int a)

### hsvGetH

    public int hsvGetH(int hsvvalue)

### hsvGetS

    public int hsvGetS(int hsvvalue)

### hsvGetV

    public int hsvGetV(int hsvvalue)

### hsvGetA

    public int hsvGetA(int hsvvalue)

### encodeGreyscaleValue

    public int encodeGreyscaleValue(float greyscale)

### decodeGreyscaleValue

    public float decodeGreyscaleValue(int pixelValue)

### getHeight

    public static int getHeight(Pointer image)
                         throws NIVisionException

  Get the height of an image.

  Parameters:
    `image` - The image to get the height of.
  Returns:
    The height of the image.
  Throws:
    `NIVisionException`

### getWidth

    public static int getWidth(Pointer image)
                        throws NIVisionException

  Get the width of an image.

  Parameters:
    `image` - The image to get the width of.
  Returns:
    The width of the image.
  Throws:
    `NIVisionException`

### convexHull

    public static void convexHull(Pointer dest,
                                  Pointer source,
                                  int connectivity8)
                           throws NIVisionException

  Throws:
    `NIVisionException`

### sizeFilter

    public static void sizeFilter(Pointer dest,
                                  Pointer source,
                                  boolean connectivity8,
                                  int erosions,
                                  boolean keepLarger)
                           throws NIVisionException

  Throws:
    `NIVisionException`

### countParticles

    public static int countParticles(Pointer image)
                              throws NIVisionException

  Counts the number of particles in a binary image.

  Parameters:
    `image` - The image to count the particles in
  Returns:
    The number of particles
  Throws:
    `NIVisionException`

### MeasureParticle

    public static double MeasureParticle(Pointer image,
                                         int particleNum,
                                         boolean calibrated,
                                         NIVision.MeasurementType type)
                                  throws NIVisionException

  Returns a measurement associated with a particle

  Parameters:
    `image` - The image containing the particle to get information about.
    `particleNum` - The number of the particle to get information about.
    `calibrated` - Specifies whether to return the measurement as a real-world value.
    `type` - The measurement to make on the particle.
  Returns:
    The value of the requested measurement.
  Throws:
    `NIVisionException`

### particleFilter

    public static int particleFilter(Pointer dest,
                                     Pointer source,
                                     CriteriaCollection collection)
                              throws NIVisionException

  Throws:
    `NIVisionException`

### imaqCreateImage

    public static Pointer imaqCreateImage(NIVision.ImageType type,
                                          int borderSize)
                                   throws NIVisionException

  Allocates space for and creates a new imaq image

  Parameters:
    `type` - the imaq encoding to use for the image
    `borderSize` - the size of border to use for the image
  Returns:
    a newly allocated pointer to an imaqImage
  Throws:
    `NIVisionException`

### colorThreshold

    public static void colorThreshold(Pointer dest,
                                      Pointer source,
                                      NIVision.ColorMode mode,
                                      Pointer plane1Range,
                                      Pointer plane2Range,
                                      Pointer plane3Range)
                               throws NIVisionException

  Convert the given image into a binary image true where the colors match the given thresholds

  Parameters:
    `dest` - the 8 bit monocolor image to store the result in
    `source` - the color image source
    `mode` - The mode of color to use
    `plane1Range` - First color range
    `plane2Range` - Second color range
    `plane3Range` - Third color range
  Throws:
    `NIVisionException`

### colorEqualize

    public static void colorEqualize(Pointer destination,
                                     Pointer source,
                                     boolean all)
                              throws NIVisionException

  Calculates the histogram of each plane of a color image and redistributes pixel values across the desired range while maintaining pixel value groupings.

  Parameters:
    `destination` - The destination image.
    `source` - The image to equalize.
    `all` - Set this parameter to TRUE to equalize all three planes of the image. Set this parameter to FALSE to equalize only the luminance plane.
  Throws:
    `NIVisionException`

### detectEllipses

    public static EllipseMatch[] detectEllipses(MonoImage image,
                                                EllipseDescriptor ellipseDescriptor,
                                                CurveOptions curveOptions,
                                                ShapeDetectionOptions shapeDetectionOptions,
                                                RegionOfInterest roi)
                                         throws NIVisionException

  Throws:
    `NIVisionException`

### getLinearAverages

    public static LinearAverages getLinearAverages(Pointer image,
                                                   LinearAverages.LinearAveragesMode mode,
                                                   NIVision.Rect rect)
                                            throws NIVisionException

  Throws:
    `NIVisionException`

### getLastError

    public static int getLastError()

### assertCleanStatus

    protected static void assertCleanStatus(int code)
                                     throws NIVisionException

  Throws:
    `NIVisionException`

### dispose

    public static void dispose(Pointer item)
                        throws NIVisionException

  Cleans up resources associated with images, regions of interest (ROIs), arrays, and reports that you no longer need. After you dispose of something, you can no longer use it.

  Parameters:
    `item` - The image, ROI, array, or report whose memory you want to free.
  Throws:
    `NIVisionException`

### readJpegString

    public static void readJpegString(Pointer image,
                                      Pointer p)

  Read a pointer to a byte array into the given image

  Parameters:
    `image` - pointer to an imaq image object
    `p` - pointer to a byte array holding image data

### setWriteFileAllowed

    public static void setWriteFileAllowed(boolean val)

  Set true to be able to create files on cRio

  Parameters:
    `val` - true allows files to be created

### writeFile

    public static void writeFile(Pointer image,
                                 String fileName)
                          throws NIVisionException

  Write an image to the given file. Supported extensions: .aipd or .apd AIPD .bmp BMP .jpg or .jpeg JPEG .jp2 JPEG2000 .png PNG .tif or .tiff TIFF

  Parameters:
    `image` - The image to write to a file.
    `fileName` - The name of the destination file.
  Throws:
    `NIVisionException`

### writeFile

    public static void writeFile(Pointer image,
                                 String fileName,
                                 Pointer colorTable)
                          throws NIVisionException

  Write an image to the given file. Supported extensions: .aipd or .apd AIPD .bmp BMP .jpg or .jpeg JPEG .jp2 JPEG2000 .png PNG .tif or .tiff TIFF

  Parameters:
    `image` - The image to write to a file.
    `fileName` - The name of the destination file.
    `colorTable` - The color table to use for 8-bit images
  Throws:
    `NIVisionException`

### readFile

    public static void readFile(Pointer image,
                                String fileName)
                         throws NIVisionException

  Read an image from to the given image from the given filename

  Parameters:
    `image` - The image to store the data in.
    `fileName` - The name of the file to load.
  Throws:
    `NIVisionException`

### extractColorPlanes

    public static void extractColorPlanes(Pointer source,
                                          NIVision.ColorMode mode,
                                          Pointer plane1,
                                          Pointer plane2,
                                          Pointer plane3)
                                   throws NIVisionException

  Extract the color planes from the given source image into the given planes

  Parameters:
    `source` - The color source image.
    `mode` - The color space to extract the planes of.
    `plane1` - MonoImage destination for the first plane.
    `plane2` - MonoImage destination for the first plane.
    `plane3` - MonoImage destination for the first plane.
  Throws:
    `NIVisionException`

### replaceColorPlanes

    public static void replaceColorPlanes(Pointer dest,
                                          Pointer source,
                                          NIVision.ColorMode mode,
                                          Pointer plane1,
                                          Pointer plane2,
                                          Pointer plane3)
                                   throws NIVisionException

  Replaces one or more of the color planes of a color image. The plane you replace may be independent of the image type. For example, you can replace the green plane of an RGB image or the hue plane of an HSL image.

  Parameters:
    `dest` - The destination image.
    `source` - The source image.
    `mode` - The color space in which the function replaces planes.
    `plane1` - The first plane of replacement data. Set this parameter to null if you do not want to change the first plane of the source image.
    `plane2` - The second plane of replacement data. Set this parameter to null if you do not want to change the second plane of the source image.
    `plane3` - The third plane of replacement data. Set this parameter to null if you do not want to change the third plane of the source image.
  Throws:
    `NIVisionException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| " 2013 FRC Java API "
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

"
For updated information see the Java FRC site
"