Example usage for android.hardware.camera2.params ColorSpaceTransform getElement

List of usage examples for android.hardware.camera2.params ColorSpaceTransform getElement

Introduction

In this page you can find the example usage for android.hardware.camera2.params ColorSpaceTransform getElement.

Prototype

public Rational getElement(int column, int row) 

Source Link

Document

Get an element of this matrix by its row and column.

Usage

From source file:com.android.camera2.its.ItsSerializer.java

@SuppressWarnings("unchecked")
private static Object serializeColorSpaceTransform(ColorSpaceTransform xform) throws org.json.JSONException {
    JSONArray xformObj = new JSONArray();
    for (int row = 0; row < 3; row++) {
        for (int col = 0; col < 3; col++) {
            xformObj.put(serializeRational(xform.getElement(col, row)));
        }/*  w ww .j  a v  a 2s .  co  m*/
    }
    return xformObj;
}

From source file:freed.cam.apis.camera2.modules.PictureModuleApi2.java

private float[] getFloatMatrix(ColorSpaceTransform transform) {
    float[] ret = new float[9];
    ret[0] = roundTo6Places(transform.getElement(0, 0).floatValue());
    ret[1] = roundTo6Places(transform.getElement(1, 0).floatValue());
    ret[2] = roundTo6Places(transform.getElement(2, 0).floatValue());
    ret[3] = roundTo6Places(transform.getElement(0, 1).floatValue());
    ret[4] = roundTo6Places(transform.getElement(1, 1).floatValue());
    ret[5] = roundTo6Places(transform.getElement(2, 1).floatValue());
    ret[6] = roundTo6Places(transform.getElement(0, 2).floatValue());
    ret[7] = roundTo6Places(transform.getElement(1, 2).floatValue());
    ret[8] = roundTo6Places(transform.getElement(2, 2).floatValue());
    return ret;// w  ww .  j a  v a2  s .c  o  m
}