2.2上的camera移到2.3上,在camere的驱动中要设置两个值
朝向和mount angle,朝向就是前camera还是后camera,问题是这个mount angle
搞不清要如何设置,到底设置多少度,前camera预览是正常的,一拍照就镜像了,所以怀疑这个angle没设置对。
结果在上层找到了说明,却没有搞明白是什么意思,
说明如下 Framework/base/core/java/android/hardware/camera.java**
* The orientation of the camera image. The value is the angle that the
* camera image needs to be rotated clockwise so it shows correctly on
* the display in its natural orientation. It should be 0, 90, 180, or 270.
*
* For example, suppose a device has a naturally tall screen. The
* back-facing camera sensor is mounted in landscape. You are looking at
* the screen. If the top side of the camera sensor is aligned with the
* right edge of the screen in natural orientation, the value should be
* 90. If the top side of a front-facing camera sensor is aligned with
* the right of the screen, the value should be 270.
*
大家帮忙解释一下,这个mount angle干嘛用的,如何设置?
尤其是红色部分,sensor的顶端和屏的右端对齐,什么意思?
前摄像头的顶端和和屏右端对齐又是什么意思?
natural orientation指什么,我们正常使用时手机的状态?
英语很烂,让大家见笑了

解决方案 »

  1.   

    mount angle就是倾斜的角度呀,不知道你哪里不明白呢 
      

  2.   

    我是想知道这个值如何设置?
    因为在上层看到会用这个值,前后camera处理不一样:
    preview时:  public static void setCameraDisplayOrientation(Activity activity,
                int cameraId, Camera camera) {
            // See android.hardware.Camera.setCameraDisplayOrientation for
            // documentation.
            Camera.CameraInfo info = new Camera.CameraInfo();
            Camera.getCameraInfo(cameraId, info);
            int degrees = getDisplayRotation(activity);
            int result;

            if (info.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) {
    Log.e(TAG, "=yue===>setCameraDisplayOrientation FACING FRONT ");
                result = (info.orientation + degrees) % 360;
               result = (360 - result) % 360;  // compensate the mirror
            } else {  // back-facing
            Log.e(TAG, "====>setCameraDisplayOrientation FACING BACK ");
                result = (info.orientation - degrees + 360) % 360;
            }
    // result=270;
    Log.e(TAG, "====>setCameraDisplayOrientation: result= "+ result);

            camera.setDisplayOrientation(result);
        }
    capture时:        private void capture() {
                mCaptureOnlyData = null;            // See android.hardware.Camera.Parameters.setRotation for
                // documentation.
                int rotation = 0; Log.e(TAG, "====>capture  mOrientation ="+mOrientation);

                if (mOrientation != OrientationEventListener.ORIENTATION_UNKNOWN) {
                    CameraInfo info = CameraHolder.instance().getCameraInfo()[mCameraId];
    Log.e(TAG, "====>capture  info.orientation ="+(info.orientation));                 if (info.facing == CameraInfo.CAMERA_FACING_FRONT) {
                        rotation = (info.orientation - mOrientation + 360) % 360;

                    } else {  // back-facing camera
                        rotation = (info.orientation + mOrientation) % 360;
                    }
                }

                mParameters.setRotation(rotation);