# LensShadingMap

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[Constants](https://developer.android.com/reference/android/hardware/camera2/params/LensShadingMap#constants)\|[Methods](https://developer.android.com/reference/android/hardware/camera2/params/LensShadingMap#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/hardware/camera2/params/LensShadingMap#inhmethods)  

# LensShadingMap

*** ** * ** ***

[Kotlin](https://developer.android.com/reference/kotlin/android/hardware/camera2/params/LensShadingMap "View this page in Kotlin")\|Java

`
public

final

class
LensShadingMap
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object)`


``


`

|---|------------------------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.hardware.camera2.params.LensShadingMap |

<br />

*** ** * ** ***

Immutable class for describing a`4 x N x M`lens shading map of floats.  
**See also:**

- [CaptureResult.STATISTICS_LENS_SHADING_CORRECTION_MAP](https://developer.android.com/reference/android/hardware/camera2/CaptureResult#STATISTICS_LENS_SHADING_CORRECTION_MAP)

## Summary

|                                                                                  ### Constants                                                                                   ||
|---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `float` | [MINIMUM_GAIN_FACTOR](https://developer.android.com/reference/android/hardware/camera2/params/LensShadingMap#MINIMUM_GAIN_FACTOR) The smallest gain factor in this map. |

|                                                                                                                                                                                        ### Public methods                                                                                                                                                                                         ||
|-------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` void`                                                                                                           | ` `[copyGainFactors](https://developer.android.com/reference/android/hardware/camera2/params/LensShadingMap#copyGainFactors(float[],%20int))`(float[] destination, int offset) ` Copy all gain factors in row-major order from this lens shading map into the destination.     |
| ` boolean`                                                                                                        | ` `[equals](https://developer.android.com/reference/android/hardware/camera2/params/LensShadingMap#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Check if this LensShadingMap is equal to another LensShadingMap.     |
| ` int`                                                                                                            | ` `[getColumnCount](https://developer.android.com/reference/android/hardware/camera2/params/LensShadingMap#getColumnCount())`() ` Get the number of columns in this map.                                                                                                       |
| ` float`                                                                                                          | ` `[getGainFactor](https://developer.android.com/reference/android/hardware/camera2/params/LensShadingMap#getGainFactor(int,%20int,%20int))`(int colorChannel, int column, int row) ` Get a single color channel gain factor from this lens shading map by its row and column. |
| ` int`                                                                                                            | ` `[getGainFactorCount](https://developer.android.com/reference/android/hardware/camera2/params/LensShadingMap#getGainFactorCount())`() ` Get the total number of gain factors in this map.                                                                                    |
| ` `[RggbChannelVector](https://developer.android.com/reference/android/hardware/camera2/params/RggbChannelVector) | ` `[getGainFactorVector](https://developer.android.com/reference/android/hardware/camera2/params/LensShadingMap#getGainFactorVector(int,%20int))`(int column, int row) ` Get a gain factor vector from this lens shading map by its row and column.                            |
| ` int`                                                                                                            | ` `[getRowCount](https://developer.android.com/reference/android/hardware/camera2/params/LensShadingMap#getRowCount())`() ` Get the number of rows in this map.                                                                                                                |
| ` int`                                                                                                            | ` `[hashCode](https://developer.android.com/reference/android/hardware/camera2/params/LensShadingMap#hashCode())`() ` Returns a hash code value for the object.                                                                                                                |
| ` `[String](https://developer.android.com/reference/java/lang/String)                                             | ` `[toString](https://developer.android.com/reference/android/hardware/camera2/params/LensShadingMap#toString())`() ` Return the LensShadingMap as a string representation.                                                                                                    |

| ### Inherited methods |
|-----------------------|---|
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](https://developer.android.com/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.                                                          | | ` final `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long,%20int))`(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed. | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long))`(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed.                   | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*.                                                                                             | ||

## Constants

### MINIMUM_GAIN_FACTOR

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final float MINIMUM_GAIN_FACTOR
```

The smallest gain factor in this map.

All values in this map will be at least this large.

<br />

<br />

Constant Value: 1.0

## Public methods

### copyGainFactors

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void copyGainFactors (float[] destination, 
                int offset)
```

Copy all gain factors in row-major order from this lens shading map into the destination.

Each gain factor will be \>=[MINIMUM_GAIN_FACTOR](https://developer.android.com/reference/android/hardware/camera2/params/LensShadingMap#MINIMUM_GAIN_FACTOR).

<br />

<br />

|                                                                                                       Parameters                                                                                                        ||
|---------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `destination` | `float`: an array big enough to hold at least[RggbChannelVector.COUNT](https://developer.android.com/reference/android/hardware/camera2/params/RggbChannelVector#COUNT)elements after the`offset` <br /> |
| `offset`      | `int`: a non-negative offset into the array <br />                                                                                                                                                       |

|                                                                                                    Throws                                                                                                     ||
|--------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------|
| [NullPointerException](https://developer.android.com/reference/java/lang/NullPointerException)                     | If`destination`was`null`                                                                  |
| [IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException)             | If offset was negative                                                                    |
| [ArrayIndexOutOfBoundsException](https://developer.android.com/reference/java/lang/ArrayIndexOutOfBoundsException) | If there's not enough room to write the elements at the specified destination and offset. |

**See also:**

- [CaptureResult.STATISTICS_LENS_SHADING_CORRECTION_MAP](https://developer.android.com/reference/android/hardware/camera2/CaptureResult#STATISTICS_LENS_SHADING_CORRECTION_MAP)  

### equals

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public boolean equals (Object obj)
```

Check if this LensShadingMap is equal to another LensShadingMap.

Two lens shading maps are equal if and only if they have the same rows/columns, and all of their elements are[equal](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)).

<br />

<br />

|                             Parameters                              ||
|-------|--------------------------------------------------------------|
| `obj` | `Object`: the reference object with which to compare. <br /> |

|                              Returns                               ||
|-----------|---------------------------------------------------------|
| `boolean` | `true`if the objects were equal,`false`otherwise <br /> |

### getColumnCount

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public int getColumnCount ()
```

Get the number of columns in this map.

<br />

|    Returns    ||
|-------|--------|
| `int` | <br /> |

### getGainFactor

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public float getGainFactor (int colorChannel, 
                int column, 
                int row)
```

Get a single color channel gain factor from this lens shading map by its row and column.

The rows must be within the range \[0,[getRowCount()](https://developer.android.com/reference/android/hardware/camera2/params/LensShadingMap#getRowCount())), the column must be within the range \[0,[getColumnCount()](https://developer.android.com/reference/android/hardware/camera2/params/LensShadingMap#getColumnCount())), and the color channel must be within the range \[0,[android.hardware.camera2.params.RggbChannelVector.COUNT RggbChannelVector.COUNT](https://developer.android.com/reference/android/hardware/camera2/params/RggbChannelVector#COUNT)).

The channel order is`[R, Geven, Godd, B]`, where`Geven`is the green channel for the even rows of a Bayer pattern, and`Godd`is the odd rows.

<br />

<br />

|                                                                                   Parameters                                                                                    ||
|----------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `colorChannel` | `int`: color channel from`[R, Geven, Godd, B]` <br />                                                                                                           |
| `column`       | `int`: within the range \[0,[getColumnCount()](https://developer.android.com/reference/android/hardware/camera2/params/LensShadingMap#getColumnCount())) <br /> |
| `row`          | `int`: within the range \[0,[getRowCount()](https://developer.android.com/reference/android/hardware/camera2/params/LensShadingMap#getRowCount())) <br />       |

|                                                                               Returns                                                                               ||
|---------|------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `float` | a gain factor \>=[.MINIMUM_GAIN_FACTOR](https://developer.android.com/reference/android/hardware/camera2/params/LensShadingMap#MINIMUM_GAIN_FACTOR) <br /> |

|                                                                      Throws                                                                       ||
|--------------------------------------------------------------------------------------------------------|-------------------------------------------|
| [IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException) | if any of the parameters was out of range |

**See also:**

- [RggbChannelVector.RED](https://developer.android.com/reference/android/hardware/camera2/params/RggbChannelVector#RED)
- [RggbChannelVector.GREEN_EVEN](https://developer.android.com/reference/android/hardware/camera2/params/RggbChannelVector#GREEN_EVEN)
- [RggbChannelVector.GREEN_ODD](https://developer.android.com/reference/android/hardware/camera2/params/RggbChannelVector#GREEN_ODD)
- [RggbChannelVector.BLUE](https://developer.android.com/reference/android/hardware/camera2/params/RggbChannelVector#BLUE)
- [getRowCount()](https://developer.android.com/reference/android/hardware/camera2/params/LensShadingMap#getRowCount())
- [getColumnCount()](https://developer.android.com/reference/android/hardware/camera2/params/LensShadingMap#getColumnCount())  

### getGainFactorCount

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public int getGainFactorCount ()
```

Get the total number of gain factors in this map.

A single gain factor contains exactly one color channel. Use with[copyGainFactors(float, int)](https://developer.android.com/reference/android/hardware/camera2/params/LensShadingMap#copyGainFactors(float[],%20int))to allocate a large-enough array.

<br />

<br />

|    Returns    ||
|-------|--------|
| `int` | <br /> |

### getGainFactorVector

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public RggbChannelVector getGainFactorVector (int column, 
                int row)
```

Get a gain factor vector from this lens shading map by its row and column.

The rows must be within the range \[0,[getRowCount()](https://developer.android.com/reference/android/hardware/camera2/params/LensShadingMap#getRowCount())), the column must be within the range \[0,[getColumnCount()](https://developer.android.com/reference/android/hardware/camera2/params/LensShadingMap#getColumnCount())).

<br />

<br />

|                                                                                Parameters                                                                                 ||
|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `column` | `int`: within the range \[0,[getColumnCount()](https://developer.android.com/reference/android/hardware/camera2/params/LensShadingMap#getColumnCount())) <br /> |
| `row`    | `int`: within the range \[0,[getRowCount()](https://developer.android.com/reference/android/hardware/camera2/params/LensShadingMap#getRowCount())) <br />       |

|                                                                                                                                                                                               Returns                                                                                                                                                                                               ||
|----------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [RggbChannelVector](https://developer.android.com/reference/android/hardware/camera2/params/RggbChannelVector) | an[RggbChannelVector](https://developer.android.com/reference/android/hardware/camera2/params/RggbChannelVector)where each gain factor \>=[.MINIMUM_GAIN_FACTOR](https://developer.android.com/reference/android/hardware/camera2/params/LensShadingMap#MINIMUM_GAIN_FACTOR) <br /> |

|                                                                      Throws                                                                       ||
|--------------------------------------------------------------------------------------------------------|-------------------------------------------|
| [IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException) | if any of the parameters was out of range |

**See also:**

- [getRowCount()](https://developer.android.com/reference/android/hardware/camera2/params/LensShadingMap#getRowCount())
- [getColumnCount()](https://developer.android.com/reference/android/hardware/camera2/params/LensShadingMap#getColumnCount())  

### getRowCount

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public int getRowCount ()
```

Get the number of rows in this map.

<br />

|    Returns    ||
|-------|--------|
| `int` | <br /> |

### hashCode

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
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](https://developer.android.com/reference/java/util/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](https://developer.android.com/reference/java/lang/Object#equals(java.lang.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](https://developer.android.com/reference/java/lang/Object#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.

<br />

<br />

|                     Returns                      ||
|-------|-------------------------------------------|
| `int` | a hash code value for this object. <br /> |

### toString

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public String toString ()
```

Return the LensShadingMap as a string representation.

`"LensShadingMap{R:([%f, %f, ... %f], ... [%f, %f, ... %f]), G_even:([%f, %f, ...
%f], ... [%f, %f, ... %f]), G_odd:([%f, %f, ... %f], ... [%f, %f, ... %f]), B:([%f, %f, ...
%f], ... [%f, %f, ... %f])}"`, where each`%f`represents one gain factor and each`[%f, %f, ... %f]`represents a row of the lens shading map

<br />

<br />

|                                                                                                   Returns                                                                                                   ||
|--------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------|
| [String](https://developer.android.com/reference/java/lang/String) | string representation of[LensShadingMap](https://developer.android.com/reference/android/hardware/camera2/params/LensShadingMap) <br /> |