diff --git a/core/java/android/hardware/camera2/CameraCharacteristics.java b/core/java/android/hardware/camera2/CameraCharacteristics.java index 5f9c8c2a92907..6f5af9c023349 100644 --- a/core/java/android/hardware/camera2/CameraCharacteristics.java +++ b/core/java/android/hardware/camera2/CameraCharacteristics.java @@ -267,8 +267,9 @@ public final class CameraCharacteristics extends CameraMetadata { new Key("android.lens.info.minimumFocusDistance", float.class); /** - *

Dimensions of lens shading - * map

+ *

Dimensions of lens shading map.

+ *

The map should be on the order of 30-40 rows and columns, and + * must be smaller than 64x64.

*/ public static final Key LENS_INFO_SHADING_MAP_SIZE = new Key("android.lens.info.shadingMapSize", android.hardware.camera2.Size.class); diff --git a/core/java/android/hardware/camera2/CaptureRequest.java b/core/java/android/hardware/camera2/CaptureRequest.java index 9304cd0d70327..5474e611fdb68 100644 --- a/core/java/android/hardware/camera2/CaptureRequest.java +++ b/core/java/android/hardware/camera2/CaptureRequest.java @@ -842,7 +842,7 @@ public final class CaptureRequest extends CameraMetadata implements Parcelable { * shading map in output result metadata

*

When set to ON, * android.statistics.lensShadingMap must be provided in - * the output result metdata.

+ * the output result metadata.

* @see #STATISTICS_LENS_SHADING_MAP_MODE_OFF * @see #STATISTICS_LENS_SHADING_MAP_MODE_ON */ diff --git a/core/java/android/hardware/camera2/CaptureResult.java b/core/java/android/hardware/camera2/CaptureResult.java index 2d686f9bc5672..9e4133f9d435b 100644 --- a/core/java/android/hardware/camera2/CaptureResult.java +++ b/core/java/android/hardware/camera2/CaptureResult.java @@ -664,15 +664,46 @@ public final class CaptureResult extends CameraMetadata { new Key("android.statistics.faceScores", byte[].class); /** - *

A low-resolution map of lens shading, per - * color channel

- *

Assume bilinear interpolation of map. The least - * shaded section of the image should have a gain factor - * of 1; all other sections should have gains above 1. - * the map should be on the order of 30-40 rows, and - * must be smaller than 64x64.

+ *

The shading map is a low-resolution floating-point map + * that lists the coefficients used to correct for vignetting, for each + * Bayer color channel.

+ *

The least shaded section of the image should have a gain factor + * of 1; all other sections should have gains above 1.

*

When android.colorCorrection.mode = TRANSFORM_MATRIX, the map * must take into account the colorCorrection settings.

+ *

The shading map is for the entire active pixel array, and is not + * affected by the crop region specified in the request. Each shading map + * entry is the value of the shading compensation map over a specific + * pixel on the sensor. Specifically, with a (N x M) resolution shading + * map, and an active pixel array size (W x H), shading map entry + * (x,y) ϵ (0 ... N-1, 0 ... M-1) is the value of the shading map at + * pixel ( ((W-1)/(N-1)) * x, ((H-1)/(M-1)) * y) for the four color channels. + * The map is assumed to be bilinearly interpolated between the sample points.

+ *

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. + * The shading map is stored in a fully interleaved format, and its size + * is provided in the camera static metadata by android.lens.info.shadingMapSize.

+ *

The shading map should have on the order of 30-40 rows and columns, + * and must be smaller than 64x64.

+ *

As an example, given a very small map defined as:

+ *
android.lens.info.shadingMapSize = [ 4, 3 ]
+     * android.statistics.lensShadingMap =
+     * [ 1.3, 1.2, 1.15, 1.2,  1.2, 1.2, 1.15, 1.2,
+     *     1.1, 1.2, 1.2, 1.2,  1.3, 1.2, 1.3, 1.3,
+     *   1.2, 1.2, 1.25, 1.1,  1.1, 1.1, 1.1, 1.0,
+     *     1.0, 1.0, 1.0, 1.0,  1.2, 1.3, 1.25, 1.2,
+     *   1.3, 1.2, 1.2, 1.3,   1.2, 1.15, 1.1, 1.2,
+     *     1.2, 1.1, 1.0, 1.2,  1.3, 1.15, 1.2, 1.3 ]
+     * 
+ *

The low-resolution scaling map images for each channel are + * (displayed using nearest-neighbor interpolation):

+ *

Red lens shading map + * Green (even rows) lens shading map + * Green (odd rows) lens shading map + * Blue lens shading map

+ *

As a visualization only, inverting the full-color map to recover an + * image of a gray wall (using bicubic interpolation for visual quality) as captured by the sensor gives:

+ *

Image of a uniform white wall (inverse shading map)

*/ public static final Key STATISTICS_LENS_SHADING_MAP = new Key("android.statistics.lensShadingMap", float[].class); diff --git a/docs/html/images/camera2/metadata/android.statistics.lensShadingMap/blue_shading.png b/docs/html/images/camera2/metadata/android.statistics.lensShadingMap/blue_shading.png new file mode 100644 index 0000000000000..7b10f6b7c812e Binary files /dev/null and b/docs/html/images/camera2/metadata/android.statistics.lensShadingMap/blue_shading.png differ diff --git a/docs/html/images/camera2/metadata/android.statistics.lensShadingMap/green_e_shading.png b/docs/html/images/camera2/metadata/android.statistics.lensShadingMap/green_e_shading.png new file mode 100644 index 0000000000000..41972cfd71b91 Binary files /dev/null and b/docs/html/images/camera2/metadata/android.statistics.lensShadingMap/green_e_shading.png differ diff --git a/docs/html/images/camera2/metadata/android.statistics.lensShadingMap/green_o_shading.png b/docs/html/images/camera2/metadata/android.statistics.lensShadingMap/green_o_shading.png new file mode 100644 index 0000000000000..d26600b37aca0 Binary files /dev/null and b/docs/html/images/camera2/metadata/android.statistics.lensShadingMap/green_o_shading.png differ diff --git a/docs/html/images/camera2/metadata/android.statistics.lensShadingMap/inv_shading.png b/docs/html/images/camera2/metadata/android.statistics.lensShadingMap/inv_shading.png new file mode 100644 index 0000000000000..1e7208ed79a24 Binary files /dev/null and b/docs/html/images/camera2/metadata/android.statistics.lensShadingMap/inv_shading.png differ diff --git a/docs/html/images/camera2/metadata/android.statistics.lensShadingMap/red_shading.png b/docs/html/images/camera2/metadata/android.statistics.lensShadingMap/red_shading.png new file mode 100644 index 0000000000000..ecef3ae7998ec Binary files /dev/null and b/docs/html/images/camera2/metadata/android.statistics.lensShadingMap/red_shading.png differ