org.neuroph.imgrec
Class FractionRgbData
- java.lang.Object
-
- org.neuroph.imgrec.FractionRgbData
-
public class FractionRgbData extends java.lang.ObjectThe intention of this class is to allow you to pay up front (at construction) the compute cost of converting the RGB values in a BufferedImage into a derived form. The major benefit of using this class is a single loop that grabs all 3 color channels (red, green, and blue) from each (x,y) coordinate, as opposed to looping through each color channel (red, green, or blue) when you need it. If you only need a single color from the channels (red, green, or blue) then using this class may be more expensive than a custom solution. In the event that it needs to be parsed, the flattened rgb values array contains all the red first, followed by all the green, followed by all the blue values. The flattened array size should be divisible by 3.
-
-
Constructor Summary
Constructors Constructor and Description FractionRgbData(java.awt.image.BufferedImage img)FractionRgbData(Image img)Creates rgb data for the specified image.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description static double[]convertRgbInputToBinaryBlackAndWhite(double[] inputRGB)Converts image rgb data to binary black and white data (1 for black, 0 for white)booleanequals(java.lang.Object obj)double[][]getBlueValues()Returns blue color component for the entire imagedouble[]getFlattenedRgbValues()Returns rgb data in a form: all red rows, all green rows, all blue rowsdouble[][]getGreenValues()Returns green color component for the entire imageintgetHeight()Get image heightdouble[][]getRedValues()Returns red color component for the entire imageintgetWidth()Get image widthinthashCode()java.lang.StringtoString()
-
-
-
Constructor Detail
-
FractionRgbData
public FractionRgbData(Image img)
Creates rgb data for the specified image.- Parameters:
img- image to cretae rgb data for
-
FractionRgbData
public FractionRgbData(java.awt.image.BufferedImage img)
-
-
Method Detail
-
convertRgbInputToBinaryBlackAndWhite
public static double[] convertRgbInputToBinaryBlackAndWhite(double[] inputRGB)
Converts image rgb data to binary black and white data (1 for black, 0 for white)- Parameters:
inputRGB- flatten rgb data- Returns:
- binary black and white representation of image
-
getWidth
public int getWidth()
Get image width- Returns:
- image width
-
getHeight
public int getHeight()
Get image height- Returns:
- image height
-
getRedValues
public double[][] getRedValues()
Returns red color component for the entire image- Returns:
- 2d array in the form: [row][column]
-
getGreenValues
public double[][] getGreenValues()
Returns green color component for the entire image- Returns:
- 2d array in the form: [row][column]
-
getBlueValues
public double[][] getBlueValues()
Returns blue color component for the entire image- Returns:
- 2d array in the form: [row][column]
-
getFlattenedRgbValues
public double[] getFlattenedRgbValues()
Returns rgb data in a form: all red rows, all green rows, all blue rows- Returns:
- All the red rows, followed by all the green rows, followed by all the blue rows.
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-
DMelt 3.0 © DataMelt by jWork.ORG