"

2013 FRC Java API

"

edu.wpi.first.wpilibj.image
Class BinaryImage

java.lang.Object
  extended by edu.wpi.first.wpilibj.image.Image
      extended by edu.wpi.first.wpilibj.image.MonoImage
          extended by edu.wpi.first.wpilibj.image.BinaryImage

public class BinaryImage
extends MonoImage

An image where each pixel is treated as either on or off.

Author:
dtjones

Field Summary
 
Fields inherited from class edu.wpi.first.wpilibj.image.Image
image
 
Method Summary
 BinaryImage convexHull(boolean connectivity8)
           
 int getNumberParticles()
          Returns the number of particles.
 ParticleAnalysisReport[] getOrderedParticleAnalysisReports()
          Gets all the particle analysis reports ordered from largest area to smallest.
 ParticleAnalysisReport[] getOrderedParticleAnalysisReports(int size)
          Gets all the particle analysis reports ordered from largest area to smallest.
 ParticleAnalysisReport getParticleAnalysisReport(int index)
          Get a particle analysis report for the particle at the given index.
 BinaryImage particleFilter(CriteriaCollection criteria)
           
 BinaryImage removeLargeObjects(boolean connectivity8, int erosions)
          removeLargeObjects filters particles based on their size.
 BinaryImage removeSmallObjects(boolean connectivity8, int erosions)
          removeSmallObjects filters particles based on their size.
 void write(String fileName)
          Write the image to a file.
 
Methods inherited from class edu.wpi.first.wpilibj.image.MonoImage
detectEllipses, detectEllipses
 
Methods inherited from class edu.wpi.first.wpilibj.image.Image
free, getHeight, getWidth
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getNumberParticles

public int getNumberParticles()
                       throws NIVisionException
Returns the number of particles.

Returns:
The number of particles
Throws:
NIVisionException

getParticleAnalysisReport

public ParticleAnalysisReport getParticleAnalysisReport(int index)
                                                 throws NIVisionException
Get a particle analysis report for the particle at the given index.

Parameters:
index - The index of the particle to report on.
Returns:
The ParticleAnalysisReport for the particle at the given index
Throws:
NIVisionException

getOrderedParticleAnalysisReports

public ParticleAnalysisReport[] getOrderedParticleAnalysisReports(int size)
                                                           throws NIVisionException
Gets all the particle analysis reports ordered from largest area to smallest.

Parameters:
size - The number of particles to return
Returns:
An array of ParticleReports from largest area to smallest
Throws:
NIVisionException

getOrderedParticleAnalysisReports

public ParticleAnalysisReport[] getOrderedParticleAnalysisReports()
                                                           throws NIVisionException
Gets all the particle analysis reports ordered from largest area to smallest.

Returns:
An array of ParticleReports from largest are to smallest
Throws:
NIVisionException

write

public void write(String fileName)
           throws NIVisionException
Description copied from class: Image
Write the image to a file. Supported extensions: .aipd or .apd AIPD .bmp BMP .jpg or .jpeg JPEG .jp2 JPEG2000 .png PNG .tif or .tiff TIFF

Overrides:
write in class Image
Parameters:
fileName - The path to write the image to.
Throws:
NIVisionException

removeSmallObjects

public BinaryImage removeSmallObjects(boolean connectivity8,
                                      int erosions)
                               throws NIVisionException
removeSmallObjects filters particles based on their size. The algorithm erodes the image a specified number of times and keeps the particles from the original image that remain in the eroded image.

Parameters:
connectivity8 - true to use connectivity-8 or false for connectivity-4 to determine whether particles are touching. For more information about connectivity, see Chapter 9, Binary Morphology, in the NI Vision Concepts manual.
erosions - the number of erosions to perform
Returns:
a BinaryImage after applying the filter
Throws:
NIVisionException

removeLargeObjects

public BinaryImage removeLargeObjects(boolean connectivity8,
                                      int erosions)
                               throws NIVisionException
removeLargeObjects filters particles based on their size. The algorithm erodes the image a specified number of times and discards the particles from the original image that remain in the eroded image.

Parameters:
connectivity8 - true to use connectivity-8 or false for connectivity-4 to determine whether particles are touching. For more information about connectivity, see Chapter 9, Binary Morphology, in the NI Vision Concepts manual.
erosions - the number of erosions to perform
Returns:
a BinaryImage after applying the filter
Throws:
NIVisionException

convexHull

public BinaryImage convexHull(boolean connectivity8)
                       throws NIVisionException
Throws:
NIVisionException

particleFilter

public BinaryImage particleFilter(CriteriaCollection criteria)
                           throws NIVisionException
Throws:
NIVisionException

"

2013 FRC Java API

"

"
For updated information see the Java FRC site
"