Android examples for android.hardware:Camera Feature
get Sensor Coordinates
import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Matrix; import android.graphics.Point; import android.graphics.Rect; public class Main{ public static void getSensorCoordinates(float[] coordinates, Rect viewCoordinatesRange, int displayOrientation, boolean frontFacing) { final Matrix matrix = new Matrix(); matrix.setTranslate(-viewCoordinatesRange.left, -viewCoordinatesRange.top); matrix.postScale(frontFacing ? -1 : 1, 1); matrix.postScale(2000f / viewCoordinatesRange.width(), 2000f / viewCoordinatesRange.height()); matrix.postTranslate(-1000f, -1000f); matrix.postRotate(-displayOrientation); matrix.mapPoints(coordinates);// w ww. j av a2 s . c o m } }