public class ImagePixelMat extends java.lang.Object implements ObjectTracer
Modifier and Type | Field and Description |
---|---|
int |
channels |
int |
cols |
java.awt.Rectangle |
itsBounds |
byte[] |
itsColorPixelBytes |
int |
itsFocusPixelValue |
byte[] |
itsGrayPixelBytes |
org.opencv.core.Mat |
itsMat |
int |
rows |
Constructor and Description |
---|
ImagePixelMat(org.opencv.core.Mat inMat)
constructor for the ImagePixels class.
|
ImagePixelMat(org.opencv.core.Mat inMat,
boolean fillGrays)
constructor for the ImagePixels class.
|
Modifier and Type | Method and Description |
---|---|
byte[] |
asGraybyteArray(java.awt.Rectangle aRect)
Returns the ImagePixels as a 1D byte Array
|
void |
checkNumChannels(int nChan)
checks to make sure that there are a minimum number of channels available
|
void |
fillColorBytes()
fills the color bytes for the Mat
|
void |
fillGrayBytes()
fills the grayBytes for the Mat
|
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 |
getABGRColorInt(int Col,
int Row)
returns the value of the ABGR bytes values as an integer
|
byte[] |
getBGRColorbytes(int Col,
int Row)
returns the value of the color pixels as bytes for BGR
|
int |
getBlue(int Col,
int Row)
returns the value of the blue pixel value as a byte
|
java.awt.Color |
getColor(int Col,
int Row)
returns the value of the BGR bytes value as an integer
|
org.opencv.core.Mat |
getColorRangeMask(org.opencv.core.Scalar sScalar,
org.opencv.core.Scalar eScalar)
produces a binary bit image with pixels of 1 if they are within the color range and 0 if they are not
|
int |
getGray(int Col,
int Row)
returns the value of a gray scale pixel value as a byte
|
byte |
getGrayByte(int Col,
int Row)
returns the value of a gray scale pixel as a byte
|
Pixel |
getGrayPixelMax(TrackingJobSetting tJobSetting,
java.util.List<SGPolygon> foundPolys)
reports the max gray scale value for the current area of interest
|
int |
getGreen(int Col,
int Row)
returns the value of the green pixel value as a byte
|
int |
getIntValue(int Col,
int Row)
returns the value of a pixel as an integer - This is not the main method.
|
int |
getRed(int Col,
int Row)
returns the value of the red pixel value as a byte
|
void |
listColorCPixels(int theCol)
Lists the pixel byte values within a given area of the ImagePixels
|
void |
listColorPixel(int col,
int row)
lists the color value of the pixel value as RGB bytes
|
void |
listColorPixels()
Lists all color pixel values
|
void |
listColorPixels(java.awt.Rectangle aRect)
Lists the pixel byte values within a given area of the ImagePixels
|
void |
listColorRPixels(int theRow)
Lists the pixel byte values within a given area of the ImagePixels
|
void |
listGrayCPixels(int theCol)
Lists the pixel byte values within a given area of the ImagePixels
|
void |
listGrayPixel(int col,
int row)
lists the grayscale value of the pixel
|
void |
listGrayPixels()
Lists all gray scale pixel values
|
void |
listGrayPixels(java.awt.Rectangle aRect)
Lists the pixel byte values within a given area of the ImagePixels
|
void |
listGrayRPixels(int theRow)
Lists the pixel byte values within a given area of the ImagePixels
|
void |
listInfo()
lists descriptive info on the ImagePixels
|
java.util.ArrayList<TargetCaptureData> |
locateColorLabel(TrackingJobSetting tJobSetting)
finds the pixel with the color value closest to the provided color
|
void |
locateColorRangeContours(int[] sHSV,
int[] eHSV)
finds the color contours
|
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
|
org.opencv.core.Mat |
makeColorRangeMask(int[] sHSV,
int[] eHSV)
assembles a binary bit image with pixels of 1 if they are within the color range and 0 if they are not.
|
public org.opencv.core.Mat itsMat
public int channels
public int cols
public int rows
public int itsFocusPixelValue
public byte[] itsGrayPixelBytes
public byte[] itsColorPixelBytes
public java.awt.Rectangle itsBounds
public ImagePixelMat(org.opencv.core.Mat inMat) throws java.lang.Exception
inMat
- the pixel arrayjava.lang.Exception
public ImagePixelMat(org.opencv.core.Mat inMat, boolean fillGrays) throws java.lang.Exception
inMat
- the pixel arrayfillGrays
- fill with grayjava.lang.Exception
public void fillGrayBytes() throws java.lang.Exception
java.lang.Exception
public void fillColorBytes() throws java.lang.Exception
java.lang.Exception
public int getGray(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 getBlue(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 getGreen(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 getRed(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 java.awt.Color getColor(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 byte[] getBGRColorbytes(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 getABGRColorInt(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 getIntValue(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 byte getGrayByte(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 void listGrayPixels() throws java.lang.Exception
java.lang.Exception
public void listColorPixels() throws java.lang.Exception
java.lang.Exception
public void listGrayPixels(java.awt.Rectangle aRect) throws java.lang.Exception
aRect
- the rectangle that defines the areajava.lang.Exception
public void listColorPixels(java.awt.Rectangle aRect) throws java.lang.Exception
aRect
- the rectangle that defines the areajava.lang.Exception
public void listGrayRPixels(int theRow) throws java.lang.Exception
theRow
- the row for which pixel values will be reportedjava.lang.Exception
public void listColorRPixels(int theRow) throws java.lang.Exception
theRow
- the row for which pixel values will be reportedjava.lang.Exception
public void listGrayCPixels(int theCol) throws java.lang.Exception
theCol
- the column for which pixel values will be reportedjava.lang.Exception
public void listColorCPixels(int theCol) throws java.lang.Exception
theCol
- the column for which pixel values will be reportedjava.lang.Exception
public void listGrayPixel(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 void listColorPixel(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 byte[] asGraybyteArray(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.ArrayList<TargetCaptureData> locateColorLabel(TrackingJobSetting tJobSetting) throws java.lang.Exception
tJobSetting
- the specific settings to use in trackingjava.lang.Exception
public org.opencv.core.Mat getColorRangeMask(org.opencv.core.Scalar sScalar, org.opencv.core.Scalar eScalar)
sScalar
- starting hue (0-180), saturation (0-255), brightness (0-255) valueseScalar
- ending hue (0-180), saturation (0-255), brightness (0-255) valuespublic org.opencv.core.Mat makeColorRangeMask(int[] sHSV, int[] eHSV) throws java.lang.Exception
sHSV
- starting hue (0-180), saturation (0-255), brightness (0-255) valuessHSV
- ending hue (0-180), saturation (0-255), brightness (0-255) valuesjava.lang.Exception
public void locateColorRangeContours(int[] sHSV, int[] eHSV) throws java.lang.Exception
java.lang.Exception
public void checkNumChannels(int nChan) throws java.lang.Exception
nChan
- number of channels neededjava.lang.Exception
RH, 2017