简体   繁体   English

如何在android中自动对焦本机相机框架到A4大小框架

[英]how to autofocus native camera frame in android to A4 size frame

how to autofocus native camera in android to A4 size frame so through camera i can directully take photo of A4 size paper with below sizes in ixel 如何在android中将本机相机自动对焦到A4尺寸的框架,以便通过相机我可以在ixel中直接拍摄具有以下尺寸的A4尺寸的纸张的照片

size of A4 in 72dpi = 595*842px A4尺寸(72dpi)= 595 * 842px

is it possible? 可能吗? in android 在Android中

You must get the parameters of the camera after opening the camera and then get parameters and set the picture size accordingly 打开相机后,必须获取相机的参数,然后获取参数并相应地设置图片尺寸

camera = Camera.open();
Parameters param = camera.getParameters();
params.setPictureSize(495,842); //this sets the A4 size image

In case of using intent: 如果使用意图:

Intent photoPickerIntent = new Intent("android.media.action.IMAGE_CAPTURE");
            photoPickerIntent.putExtra("crop", "true");
            photoPickerIntent.putExtra("outputX", 495);
            photoPickerIntent.putExtra("outputY", 842);
            photoPickerIntent.putExtra("aspectX", 1);
            photoPickerIntent.putExtra("aspectY", 1);
            photoPickerIntent.putExtra("scale", true);
            photoPickerIntent.putExtra(MediaStore.EXTRA_OUTPUT, getTempUri());
            photoPickerIntent.putExtra("outputFormat",
                    Bitmap.CompressFormat.JPEG.toString());
            startActivityForResult(photoPickerIntent, RESULT_LOAD_IMAGE);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM