Save the date! Android Dev Summit is coming to Mountain View, CA on November 7-8, 2018.

RggbChannelVector

public final class RggbChannelVector
extends Object

java.lang.Object
   ↳ android.hardware.camera2.params.RggbChannelVector


Immutable class to store a 4-element vector of floats indexable by a bayer RAW 2x2 pixel block.

Summary

Constants

int BLUE

Blue color channel in a bayer Raw pattern.

int COUNT

The number of color channels in this vector.

int GREEN_EVEN

Green color channel in a bayer Raw pattern used by the even rows.

int GREEN_ODD

Green color channel in a bayer Raw pattern used by the odd rows.

int RED

Red color channel in a bayer Raw pattern.

Public constructors

RggbChannelVector(float red, float greenEven, float greenOdd, float blue)

Create a new RggbChannelVector from an RGGB 2x2 pixel.

Public methods

void copyTo(float[] destination, int offset)

Copy the vector into the destination in the order [R, Geven, Godd, B].

boolean equals(Object obj)

Check if this RggbChannelVector is equal to another RggbChannelVector.

float getBlue()

Get the blue component.

float getComponent(int colorChannel)

Get the component by the color channel index.

float getGreenEven()

Get the green (even rows) component.

float getGreenOdd()

Get the green (odd rows) component.

float getRed()

Get the red component.

int hashCode()

Returns a hash code value for the object.

String toString()

Return the RggbChannelVector as a string representation.

Inherited methods

Constants

BLUE

added in API level 21
public static final int BLUE

Blue color channel in a bayer Raw pattern.

Constant Value: 3 (0x00000003)

COUNT

added in API level 21
public static final int COUNT

The number of color channels in this vector.

Constant Value: 4 (0x00000004)

GREEN_EVEN

added in API level 21
public static final int GREEN_EVEN

Green color channel in a bayer Raw pattern used by the even rows.

Constant Value: 1 (0x00000001)

GREEN_ODD

added in API level 21
public static final int GREEN_ODD

Green color channel in a bayer Raw pattern used by the odd rows.

Constant Value: 2 (0x00000002)

RED

added in API level 21
public static final int RED

Red color channel in a bayer Raw pattern.

Constant Value: 0 (0x00000000)

Public constructors

RggbChannelVector

added in API level 21
public RggbChannelVector (float red, 
                float greenEven, 
                float greenOdd, 
                float blue)

Create a new RggbChannelVector from an RGGB 2x2 pixel.

All pixel values are considered normalized within [0.0f, 1.0f] (i.e. 1.0f could be linearized to 255 if converting to a non-floating point pixel representation).

All arguments must be finite; NaN and infinity is not allowed.

Parameters
red float: red pixel

greenEven float: green pixel (even row)

greenOdd float: green pixel (odd row)

blue float: blue pixel

Throws
IllegalArgumentException if any of the arguments were not finite

Public methods

copyTo

added in API level 21
public void copyTo (float[] destination, 
                int offset)

Copy the vector into the destination in the order [R, Geven, Godd, B].

Parameters
destination float: an array big enough to hold at least .COUNT elements after the offset

offset int: a non-negative offset into the array

Throws
NullPointerException If destination was null
ArrayIndexOutOfBoundsException If there's not enough room to write the elements at the specified destination and offset.

equals

added in API level 21
public boolean equals (Object obj)

Check if this RggbChannelVector is equal to another RggbChannelVector.

Two vectors are only equal if and only if each of the respective elements is equal.

Parameters
obj Object: the reference object with which to compare.

Returns
boolean true if the objects were equal, false otherwise

getBlue

added in API level 21
public float getBlue ()

Get the blue component.

Returns
float a floating point value (guaranteed to be finite)

getComponent

added in API level 21
public float getComponent (int colorChannel)

Get the component by the color channel index.

colorChannel must be one of RED, GREEN_EVEN, GREEN_ODD, BLUE.

Parameters
colorChannel int: greater or equal to 0 and less than COUNT

Returns
float a floating point value (guaranteed to be finite)

Throws
IllegalArgumentException if colorChannel was out of range

getGreenEven

added in API level 21
public float getGreenEven ()

Get the green (even rows) component.

Returns
float a floating point value (guaranteed to be finite)

getGreenOdd

added in API level 21
public float getGreenOdd ()

Get the green (odd rows) component.

Returns
float a floating point value (guaranteed to be finite)

getRed

added in API level 21
public float getRed ()

Get the red component.

Returns
float a floating point value (guaranteed to be finite)

hashCode

added in API level 21
public int hashCode ()

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals(Object) method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals(java.lang.Object) method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.

As much as is reasonably practical, the hashCode method defined by class Object does return distinct integers for distinct objects. (This is typically implemented by converting the internal address of the object into an integer, but this implementation technique is not required by the Java™ programming language.)

Returns
int a hash code value for this object.

toString

added in API level 21
public String toString ()

Return the RggbChannelVector as a string representation.

"RggbChannelVector{R:%f, G_even:%f, G_odd:%f, B:%f}", where each %f respectively represents one of the the four color channels.

Returns
String string representation of RggbChannelVector