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 |
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 |
---|---|
void |
checkForColor()
checks to make sure that color is available
|
void |
checkForGray()
checks to make sure that gray is available
|
void |
checkNumChannels(int nChan)
checks to make sure that there are a minimum number of channels available
|
void |
fillColorBytesFromMat()
fills the color bytes for the Mat
|
void |
fillGrayBytesFromMat()
fills the grayBytes for the Mat
|
Pixel |
findLastInsideEdgePixel(Pixel startPx,
int pixelThreshold,
java.awt.Shape aoi)
finds a pixel on the outline of an object
|
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
|
byte[] |
getFoundObjectBytes(java.awt.Rectangle aRect)
utility function to get the 9 pixel bytes around x.y
|
int |
getGray(int Col,
int Row)
returns the value of a gray scale pixel value as an int
|
Pixel |
getGrayPixelMax(TrackingJobSetting tJobSetting)
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
|
java.awt.Color |
getMeanBackgroundColor(TrackingJobSetting tJobSetting,
java.util.List<SGPolygon> foundPolys,
boolean isGrayScale)
utility function to get the average background color for the trackjob
|
int |
getRed(int Col,
int Row)
returns the value of the red pixel value as a byte
|
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 |
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 |
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 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 fillGrayBytesFromMat() throws java.lang.Exception
java.lang.Exception
public void fillColorBytesFromMat() 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 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 void listGrayPixels() 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() throws java.lang.Exception
java.lang.Exception
public void listColorPixels(java.awt.Rectangle aRect) throws java.lang.Exception
aRect
- the rectangle that defines the areajava.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 void listInfo()
public Pixel getGrayPixelMax(TrackingJobSetting tJobSetting) throws java.lang.Exception
getGrayPixelMax
in interface ObjectTracer
tJobSetting
- the settings for finding the maximum pixel valuejava.lang.Exception
public java.awt.Color getMeanBackgroundColor(TrackingJobSetting tJobSetting, java.util.List<SGPolygon> foundPolys, boolean isGrayScale) throws java.lang.Exception
tJobSetting
- the tracking job settingfoundPolys
- objects are excluded from background calculationisGrayScale
- java.lang.Exception
- ...public byte[] getFoundObjectBytes(java.awt.Rectangle aRect)
aRect
- the rectanglepublic Pixel findLastInsideEdgePixel(Pixel startPx, int pixelThreshold, java.awt.Shape aoi) throws java.lang.Exception
startPx
- start at this pixelpixelThreshold
- the thresholdaoi
- 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 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
public void checkForGray() throws java.lang.Exception
java.lang.Exception
- ...public void checkForColor() throws java.lang.Exception
java.lang.Exception
- ...RH, 2017