public class RHImgUtilities
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.awt.Color |
Color_magenta |
static float[] |
comps |
static float[] |
comps_mag |
static java.awt.Color |
customFillColor1_blue |
static java.awt.Color |
customFillColor1_green |
static java.awt.Color |
customFillColor1_red |
static java.awt.Color |
customFillColor10_blue |
static java.awt.Color |
customFillColor10_green |
static java.awt.Color |
customFillColor10_red |
static java.awt.Color |
customFillColor2_blue |
static java.awt.Color |
customFillColor2_green |
static java.awt.Color |
customFillColor2_mag |
static java.awt.Color |
customFillColor2_red |
static java.awt.Color |
customFillColor3_blue |
static java.awt.Color |
customFillColor3_green |
static java.awt.Color |
customFillColor3_red |
static java.awt.Color |
customFillColor4_blue |
static java.awt.Color |
customFillColor4_green |
static java.awt.Color |
customFillColor4_red |
static java.awt.Color |
customFillColor5_blue |
static java.awt.Color |
customFillColor5_green |
static java.awt.Color |
customFillColor5_red |
static java.awt.Color |
customFillColor6_blue |
static java.awt.Color |
customFillColor6_green |
static java.awt.Color |
customFillColor6_mag |
static java.awt.Color |
customFillColor6_red |
static java.awt.Color |
customFillColor7_blue |
static java.awt.Color |
customFillColor7_green |
static java.awt.Color |
customFillColor7_red |
static java.awt.Color |
customFillColor8_blue |
static java.awt.Color |
customFillColor8_green |
static java.awt.Color |
customFillColor8_red |
static java.awt.Color |
customFillColor9_blue |
static java.awt.Color |
customFillColor9_green |
static java.awt.Color |
customFillColor9_red |
static java.awt.Color |
drawColor |
static java.awt.Color |
enhancedColor |
static java.awt.Color |
enhancedFillColor |
static java.awt.Color |
fillColor |
Constructor and Description |
---|
RHImgUtilities() |
Modifier and Type | Method and Description |
---|---|
static java.awt.image.BufferedImage |
applyAlpha(java.awt.image.BufferedImage theImage,
int alpha)
This method returns an BufferedImage after applying an alpha (transparency) to it
|
static int |
ARGBColorToInt(int alpha,
int r,
int b,
int g)
Assembles a RGB color int from individual color values
|
static java.awt.image.BufferedImage |
clone(java.awt.image.BufferedImage inImage)
Returns a deep copy of the image
|
static java.awt.image.BufferedImage |
copyWithAlpha(java.awt.image.BufferedImage inImage)
Returns a deep copy of the image
|
static int |
countBlackPixels(java.awt.image.BufferedImage theImage)
counts how many pixels are black.
|
static int |
getColorDifference(byte[] cBGR1,
byte[] cBGR2)
get the average difference between two colors
|
static int |
getColorDifference(java.awt.Color col1,
java.awt.Color col2)
get the average difference between two colors
|
static int |
getColorDifference(float[] cBGR1,
float[] cBGR2)
get the average difference between two colors
|
static int |
getColorDifference(int[] cBGR1,
byte[] cBGR2)
get the average difference between two colors
|
static int |
getGrayBit(int x,
int y,
java.awt.image.BufferedImage inBuffImg)
gets a gray value from a pixel of a BufferedImage
|
static byte[] |
getGrayByteArray(java.awt.image.BufferedImage inBuffImg)
gets a gray value from a pixel of a BufferedImage
|
static int |
getGrayValue(int x,
int y,
java.awt.image.BufferedImage inBuffImg)
gets a gray value from a pixel of a BufferedImage
|
static float[] |
getHSBColorVals(byte[] BGR)
returns the HSB color values for an RGB Color
|
static float[] |
getHSBColorVals(java.awt.Color aCol)
returns the HSB color values for an RGB Color
|
static boolean |
hasAlpha(java.awt.Image inImage)
returns whether the provided image has transparent pixels
|
static byte[] |
IntToARGBBytes(int color)
Assembles individual RGB byes from an int color
|
static int[] |
IntToARGBInts(int color)
Assembles a RGB color from individual color values
|
static boolean |
isBinary(java.awt.image.BufferedImage inBuffImage)
returns whether the provided image has binary information
|
static boolean |
isColor(java.awt.image.BufferedImage inBuffImage)
returns whether the provided image has color information
|
static boolean |
isGray(java.awt.image.BufferedImage inBuffImage)
returns whether the provided image has grayscale information
|
static void |
listGrayByteArray(java.awt.image.BufferedImage inBuffImg)
List the pixel values of a BufferedImage
|
static java.awt.image.BufferedImage |
to1byte_Binary(java.awt.image.BufferedImage inImage)
Returns a deep copy of the image
|
static java.awt.image.BufferedImage |
to1byte_Gray(java.awt.image.BufferedImage inImage)
Returns a deep copy of the image
|
static java.awt.image.BufferedImage |
to1int_ARGB(java.awt.image.BufferedImage inImage)
Returns a deep copy of the image
|
static java.awt.image.BufferedImage |
to3byte_BGR(java.awt.image.BufferedImage inImage)
Returns a deep copy of the image
|
static java.awt.image.BufferedImage |
to4byte_ABGR(java.awt.image.BufferedImage inImage)
Returns a deep copy of the image
|
static java.awt.image.BufferedImage |
toBufferedImage(java.awt.Image inImage)
This method returns a buffered image with the contents of an image
|
static java.awt.image.BufferedImage |
toBufferedImage(org.opencv.core.Mat inMat)
creates a new BufferedImage from an OpenCV Mat
|
static java.awt.image.BufferedImage |
toBufferedImage(org.openpnp.libuvc4j.uvc_frame frame,
int channels)
This method returns a buffered image with the contents of an uvc_frame
|
static org.opencv.core.Mat |
toColorMat_8UC3(java.awt.image.BufferedImage inBuffImg)
Fill a Mat from a BufferedImage
|
static org.opencv.core.Mat |
toGrayMat_8UC1(java.awt.image.BufferedImage inBuffImg)
Fill a Mat from a BufferedImage
|
static java.awt.Image |
toImage(java.awt.image.BufferedImage inImage)
This method returns an image with the contents of a BufferedImage
|
public static java.awt.Color fillColor
public static java.awt.Color drawColor
public static java.awt.Color Color_magenta
public static float[] comps_mag
public static java.awt.Color customFillColor2_mag
public static java.awt.Color customFillColor6_mag
public static java.awt.Color enhancedColor
public static float[] comps
public static java.awt.Color enhancedFillColor
public static java.awt.Color customFillColor1_red
public static java.awt.Color customFillColor1_green
public static java.awt.Color customFillColor1_blue
public static java.awt.Color customFillColor2_red
public static java.awt.Color customFillColor2_green
public static java.awt.Color customFillColor2_blue
public static java.awt.Color customFillColor3_red
public static java.awt.Color customFillColor3_green
public static java.awt.Color customFillColor3_blue
public static java.awt.Color customFillColor4_red
public static java.awt.Color customFillColor4_green
public static java.awt.Color customFillColor4_blue
public static java.awt.Color customFillColor5_red
public static java.awt.Color customFillColor5_green
public static java.awt.Color customFillColor5_blue
public static java.awt.Color customFillColor6_red
public static java.awt.Color customFillColor6_green
public static java.awt.Color customFillColor6_blue
public static java.awt.Color customFillColor7_red
public static java.awt.Color customFillColor7_green
public static java.awt.Color customFillColor7_blue
public static java.awt.Color customFillColor8_red
public static java.awt.Color customFillColor8_green
public static java.awt.Color customFillColor8_blue
public static java.awt.Color customFillColor9_red
public static java.awt.Color customFillColor9_green
public static java.awt.Color customFillColor9_blue
public static java.awt.Color customFillColor10_red
public static java.awt.Color customFillColor10_green
public static java.awt.Color customFillColor10_blue
public static java.awt.image.BufferedImage clone(java.awt.image.BufferedImage inImage)
inImage
- the image to usepublic static java.awt.image.BufferedImage to4byte_ABGR(java.awt.image.BufferedImage inImage)
inImage
- the image to usepublic static java.awt.image.BufferedImage to1int_ARGB(java.awt.image.BufferedImage inImage)
inImage
- the image to usepublic static java.awt.image.BufferedImage to3byte_BGR(java.awt.image.BufferedImage inImage)
inImage
- the image to usepublic static java.awt.image.BufferedImage to1byte_Gray(java.awt.image.BufferedImage inImage)
inImage
- the image to usepublic static java.awt.image.BufferedImage to1byte_Binary(java.awt.image.BufferedImage inImage)
inImage
- the image to usepublic static java.awt.image.BufferedImage copyWithAlpha(java.awt.image.BufferedImage inImage) throws java.lang.Exception
inImage
- the image to usejava.lang.Exception
public static java.awt.image.BufferedImage toBufferedImage(org.opencv.core.Mat inMat) throws java.io.IOException
inMat
- the 2D Mat with pixel datajava.io.IOException
- ...public static java.awt.image.BufferedImage toBufferedImage(java.awt.Image inImage) throws java.lang.Exception
inImage
- the image to convertjava.lang.Exception
public static java.awt.image.BufferedImage toBufferedImage(org.openpnp.libuvc4j.uvc_frame frame, int channels)
frame
- the image to convertpublic static java.awt.Image toImage(java.awt.image.BufferedImage inImage)
inImage
- the image to convertpublic static byte[] getGrayByteArray(java.awt.image.BufferedImage inBuffImg)
inBuffImg
- the BufferedImagepublic static int getGrayBit(int x, int y, java.awt.image.BufferedImage inBuffImg) throws java.lang.Exception
x
- y
- inBuffImg
- the BufferedImagejava.lang.Exception
public static int getGrayValue(int x, int y, java.awt.image.BufferedImage inBuffImg)
x
- y
- inBuffImg
- the BufferedImagepublic static void listGrayByteArray(java.awt.image.BufferedImage inBuffImg)
inBuffImg
- the image to list the values forpublic static org.opencv.core.Mat toColorMat_8UC3(java.awt.image.BufferedImage inBuffImg)
inBuffImg
- the image to convertpublic static org.opencv.core.Mat toGrayMat_8UC1(java.awt.image.BufferedImage inBuffImg)
inBuffImg
- the image to convertpublic static java.awt.image.BufferedImage applyAlpha(java.awt.image.BufferedImage theImage, int alpha) throws java.lang.Exception
theImage
- the image to convertjava.lang.Exception
public static float[] getHSBColorVals(byte[] BGR)
public static float[] getHSBColorVals(java.awt.Color aCol)
public static int ARGBColorToInt(int alpha, int r, int b, int g) throws java.lang.Exception
r
- red valueb
- blue valueg
- green valuejava.lang.Exception
public static byte[] IntToARGBBytes(int color) throws java.lang.Exception
color
- the colorjava.lang.Exception
public static int[] IntToARGBInts(int color) throws java.lang.Exception
color
- the colorjava.lang.Exception
public static int getColorDifference(java.awt.Color col1, java.awt.Color col2)
col1
- color one stored as an intcol2
- color two stored as an intpublic static int getColorDifference(int[] cBGR1, byte[] cBGR2)
cBGR1
- color one stored as an array of intscBGR2
- color two stored as an array of bytespublic static int getColorDifference(byte[] cBGR1, byte[] cBGR2)
cBGR1
- color one stored as an array of bytescBGR2
- color two stored as an array of bytespublic static int getColorDifference(float[] cBGR1, float[] cBGR2)
cBGR1
- color one stored as an array of floatscBGR2
- color two stored as an array of floatspublic static int countBlackPixels(java.awt.image.BufferedImage theImage)
theImage
- the BufferedImage to searchpublic static boolean isColor(java.awt.image.BufferedImage inBuffImage)
inBuffImage
- the image to usepublic static boolean isGray(java.awt.image.BufferedImage inBuffImage)
inBuffImage
- the image to usepublic static boolean isBinary(java.awt.image.BufferedImage inBuffImage)
inBuffImage
- the image to usepublic static boolean hasAlpha(java.awt.Image inImage) throws java.lang.Exception
inImage
- the image to usejava.lang.Exception
RH, 2017