Matrix matrix = new Matrix(); CameraInfo info = CameraHolder.instance().getCameraInfo()[cameraId]; // Need mirror for front camera. boolean mirror = (info.facing == CameraInfo.CAMERA_FACING_FRONT); matrix.setScale(mirror ? -1 : 1, 1); // This is the value for android.hardware.Camera.setDisplayOrientation. matrix.postRotate(displayOrientation); // Camera driver coordinates range from (-1000, -1000) to (1000, 1000). // UI coordinates range from (0, 0) to (width, height). matrix.postScale(view.getWidth() / 2000f, view.getHeight() / 2000f); matrix.postTranslate(view.getWidth() / 2f, view.getHeight() / 2f);
Here is the matrix to convert driver coordinates to View coordinates in pixels.
最新推荐文章于 2022-05-28 22:59:32 发布