Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Neuroph
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.neuroph.contrib.imgrec
Class FractionRgbData

    java.lang.Object
      org.neuroph.contrib.imgrec.FractionRgbData

    public class FractionRgbData

extends java.lang.Object

The 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.

Field Summary
`protected double[][]` | `blueValues` Array which contains blue componenet of the color for each image pixel
`protected double[]` | `flattenedRgbValues` Single array with the red, green and blue componenets of the color for each image pixel
`protected double[][]` | `greenValues` Array which contains green componenet of the color for each image pixel
`protected double[][]` | `redValues` Array which contains red componenet of the color for each image pixel

Constructor Summary
`FractionRgbData(java.awt.image.BufferedImage img)` Creates rgb data for the specified image.

Method Summary
`static double[]` | `convertRgbInputToBinaryBlackAndWhite(double[] inputRGB)` Converts image rgb data to binary black and white data
`boolean` | `equals(java.lang.Object obj)`
`double[][]` | `getBlueValues()` Returns blue color component for the entire image
`double[]` | `getFlattenedRgbValues()` Returns rgb data in a form: all red rows, all green rows, all blue rows
`double[][]` | `getGreenValues()` Returns green color component for the entire image
`int` | `getHeight()` Get image height
`double[][]` | `getRedValues()` Returns red color component for the entire image
`int` | `getWidth()` Get image width
`int` | `hashCode()`
`protected void` | `populateRGBArrays(java.awt.image.BufferedImage img)` Fills the rgb arrays from image
`java.lang.String` | `toString()`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Field Detail

### redValues

    protected double[][] redValues

  Array which contains red componenet of the color for each image pixel

### greenValues

    protected double[][] greenValues

  Array which contains green componenet of the color for each image pixel

### blueValues

    protected double[][] blueValues

  Array which contains blue componenet of the color for each image pixel

### flattenedRgbValues

    protected double[] flattenedRgbValues

  Single array with the red, green and blue componenets of the color for each image pixel

Constructor Detail

### FractionRgbData

    public FractionRgbData(java.awt.image.BufferedImage img)

  Creates rgb data for the specified image.

  Parameters:
    `img` - image to cretae rgb data for

Method Detail

### populateRGBArrays

    protected void populateRGBArrays(java.awt.image.BufferedImage img)

  Fills the rgb arrays from image

  Parameters:
    `img` - image to get rgb data from

### convertRgbInputToBinaryBlackAndWhite

    public static double[] convertRgbInputToBinaryBlackAndWhite(double[] inputRGB)

  Converts image rgb data to binary black and white data

  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:
    `equals` in class `java.lang.Object`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `java.lang.Object`

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Neuroph
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD