create a coordination convert matrix See also android.hardware.Camera.Face#rect - Android Camera

Android examples for Camera:Camera Facing

Description

create a coordination convert matrix See also android.hardware.Camera.Face#rect

Demo Code


//package com.java2s;
import android.graphics.Matrix;

public class Main {
    private static Matrix createConvertMatrix(boolean frontCamera,
            float displayOrientation, float viewWidth, float viewHeight) {
        Matrix matrix = new Matrix();
        boolean mirror = frontCamera;
        matrix.setScale(mirror ? -1 : 1, 1);
        matrix.postRotate(displayOrientation);
        matrix.postScale(viewWidth / 2000f, viewHeight / 2000f);
        matrix.postTranslate(viewWidth / 2f, viewHeight / 2f);
        return matrix;
    }/*from   www  .j a va2  s  .  co m*/
}

Related Tutorials