public class ImagePixels extends java.lang.Object implements ObjectTracer
Modifier and Type | Field and Description |
---|---|
int |
intsPerRow |
boolean |
isColorSet |
boolean |
isGraySet |
java.awt.Rectangle |
itsBounds |
int |
itsBytesPerPixel |
int[] |
itsColors |
int |
itsFocusPixelValue |
int[] |
itsGrays |
static byte |
PIXEL_BLACK |
static byte |
PIXEL_WHITE |
int |
PixelCols |
int |
PixelRows |
Constructor and Description |
---|
ImagePixels(int Cols,
int Rows)
constructor for the ImagePixels class.
|
Modifier and Type | Method and Description |
---|---|
byte[] |
asbyteArray(java.awt.Rectangle aRect)
Returns the ImagePixels as a 1D byte Array
|
void |
fillGrayPixels(int[] pixelData)
obtains gray values for each pixel from color information
|
Pixel |
findLastInsideEdgePixel(Pixel startPx,
int pixelThreshold,
java.awt.Rectangle aRect)
finds a pixel on the outline of an object
|
Pixel |
findLastOutsideEdgePixel(Pixel startPx,
int pixelThreshold,
java.awt.Rectangle aRect)
finds a pixel on the outline of an object
|
int |
getBlue(int Cols,
int Rows)
returns the red value of a pixel
|
static int |
getBlueValue(int anInt)
returns the red value of a pixel
|
byte |
getByte(int Cols,
int Rows)
returns the value of a grayscale pixel as an int
|
int |
getColorInt(int Cols,
int Rows)
returns the value of a 32bit RGBA color pixel as an int
|
Pixel |
getGrayPixelMax(TrackingJobSetting tJobSetting,
java.util.List<SGPolygon> foundPolys)
reports the max grayscale value for the current area of interest
|
static int |
getGrayValue(int anInt)
returns the red value of a pixel
|
int |
getGreen(int Cols,
int Rows)
returns the red value of a pixel
|
static int |
getGreenValue(int anInt)
returns the red value of a pixel
|
Pixel |
getPixel(int col,
int row)
fills the ImagePixels using data provided from a BufferedImage - color ints
|
int |
getRed(int Cols,
int Rows)
returns the red value of a pixel
|
static int |
getRedValue(int anInt)
returns the red value of a pixel
|
java.awt.Color |
getRGBColor(int Cols,
int Rows)
returns the value of a 32bit RGBA color pixel as an int
|
int |
getValue(int Cols,
int Rows)
returns the value of a grayscale pixel as an int
|
void |
listInfo()
lists descriptive info on the ImagePixels
|
void |
listPixelCValues(int theColumn)
Lists the pixel byte values within a given area of the ImagePixels
|
void |
listPixelRValues(int theRow)
Lists the pixel byte values within a given area of the ImagePixels
|
void |
listPixelValues()
Lists the pixel byte values within a given area of the ImagePixels
|
void |
listPixelValues(java.awt.Rectangle aRect)
Lists the pixel byte values within a given area of the ImagePixels
|
java.util.List<TargetCaptureData> |
locateColorLabel(TrackingJobSetting tJobSetting)
finds the location of multiple labels
|
java.util.List<SGPolygon> |
locateObjectPolys(TrackingJobSetting tJobSetting)
traces the outline of an object
|
java.util.List<TargetCaptureData> |
locateTargets(TrackingJobSetting tJobSetting)
finds the center location of the darkest/lightest object
|
void |
setPixels(java.awt.Image anImage,
boolean calcGrays)
fills the ImagePixels using data provided from a BufferedImage - color ints
|
void |
setPixels(int[] pixelData,
int iPR,
boolean calcGrays)
Fills the ImagePixels using data provided from an integer array
|
void |
setPixels(java.awt.image.Raster aRast,
boolean calcGrays)
fills the ImagePixels using data provided from a BufferedImage - color ints
|
public static byte PIXEL_BLACK
public static byte PIXEL_WHITE
public int PixelCols
public int PixelRows
public int intsPerRow
public int itsBytesPerPixel
public int itsFocusPixelValue
public int[] itsColors
public int[] itsGrays
public boolean isGraySet
public boolean isColorSet
public java.awt.Rectangle itsBounds
public ImagePixels(int Cols, int Rows)
Cols
- number of columns in the pixel array (horizontal dimension)Rows
- number of rows in the pixel array (vertical dimension)public void setPixels(int[] pixelData, int iPR, boolean calcGrays)
pixelData
- the image data to useiPR
- the number of ints per rowcalcGrays
- obtain gray valuespublic void setPixels(java.awt.image.Raster aRast, boolean calcGrays)
aRast
- the image data to use. for a BufferedImage use Raster r = theImage.getData()calcGrays
- obtain gray valuespublic void setPixels(java.awt.Image anImage, boolean calcGrays)
anImage
- the image data to usecalcGrays
- obtain gray valuespublic void fillGrayPixels(int[] pixelData) throws java.lang.Exception
java.lang.Exception
public Pixel getPixel(int col, int row) throws java.lang.Exception
col
- the column in the pixel array (horizontal dimension)row
- the row in the pixel array (vertical dimension)java.lang.Exception
public int getValue(int Cols, int Rows) throws java.lang.Exception
Cols
- number of columns in the pixel array (horizontal dimension)Rows
- number of rows in the pixel array (vertical dimension)java.lang.Exception
public byte getByte(int Cols, int Rows) throws java.lang.Exception
Cols
- number of columns in the pixel array (horizontal dimension)Rows
- number of rows in the pixel array (vertical dimension)java.lang.Exception
public java.awt.Color getRGBColor(int Cols, int Rows) throws java.lang.Exception
Cols
- the columnRows
- the rowjava.lang.Exception
public int getColorInt(int Cols, int Rows) throws java.lang.Exception
Cols
- the columnRows
- the rowjava.lang.Exception
public int getRed(int Cols, int Rows) throws java.lang.Exception
Cols
- the columnRows
- the rowjava.lang.Exception
public int getBlue(int Cols, int Rows) throws java.lang.Exception
Cols
- the columnRows
- the rowjava.lang.Exception
public int getGreen(int Cols, int Rows) throws java.lang.Exception
Cols
- the columnRows
- the rowjava.lang.Exception
public static int getGrayValue(int anInt) throws java.lang.Exception
anInt
- the color stored as an intjava.lang.Exception
public static int getRedValue(int anInt) throws java.lang.Exception
anInt
- the color stored as an intjava.lang.Exception
public static int getBlueValue(int anInt) throws java.lang.Exception
anInt
- the color stored as an intjava.lang.Exception
public static int getGreenValue(int anInt) throws java.lang.Exception
anInt
- the color stored as an intjava.lang.Exception
public void listPixelValues() throws java.lang.Exception
java.lang.Exception
public void listPixelValues(java.awt.Rectangle aRect) throws java.lang.Exception
aRect
- the rectangle that defines our area of interestjava.lang.Exception
public void listPixelRValues(int theRow) throws java.lang.Exception
theRow
- the row for which pixelvalues will be reportedjava.lang.Exception
public void listPixelCValues(int theColumn) throws java.lang.Exception
theColumn
- the column for which pixelvalues will be reportedjava.lang.Exception
public byte[] asbyteArray(java.awt.Rectangle aRect) throws java.lang.Exception
aRect
- the rectangle of interest, null to get entire imagejava.lang.Exception
public void listInfo()
public Pixel getGrayPixelMax(TrackingJobSetting tJobSetting, java.util.List<SGPolygon> foundPolys) throws java.lang.Exception
getGrayPixelMax
in interface ObjectTracer
tJobSetting
- the settings for finding the maximum pixel valuefoundPolys
- the polygons foundjava.lang.Exception
public Pixel findLastInsideEdgePixel(Pixel startPx, int pixelThreshold, java.awt.Rectangle aRect) throws java.lang.Exception
startPx
- start at this pixelpixelThreshold
- the thresholdaRect
- the rectangle of interest, null to use the entire Pixel arrayjava.lang.Exception
public Pixel findLastOutsideEdgePixel(Pixel startPx, int pixelThreshold, java.awt.Rectangle aRect) throws java.lang.Exception
startPx
- start at this pixelpixelThreshold
- the thresholdaRect
- the rectangle of interest, null to use the entire Pixel arrayjava.lang.Exception
public java.util.List<SGPolygon> locateObjectPolys(TrackingJobSetting tJobSetting) throws java.lang.Exception
locateObjectPolys
in interface ObjectTracer
tJobSetting
- use these settings to trace the objectjava.lang.Exception
public java.util.List<TargetCaptureData> locateTargets(TrackingJobSetting tJobSetting) throws java.lang.Exception
locateTargets
in interface ObjectTracer
tJobSetting
- the settings to use for the tracking jobjava.lang.Exception
public java.util.List<TargetCaptureData> locateColorLabel(TrackingJobSetting tJobSetting) throws java.lang.Exception
tJobSetting
- the settings to use for the tracking jobjava.lang.Exception
RH, 2017