更改摄像机分辨率的Andr​​oid编程设置 [英] Change camera resolution setting programmatically in android

查看:256
本文介绍了更改摄像机分辨率的Andr​​oid编程设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用下面的code打开摄像头。是否可以将相机分辨率设置为高编程?

 私人无效openDefaultCameraApp(){
    意图I =新的意图(android.provider.MediaStore.ACTION_IM​​AGE_CAPTURE);
    startActivityForResult(ⅰ,CAPTURE_PHOTO_CONSTANT);
}
 

解决方案

您必须将 MediaStore.EXTRA_OUTPUT 添加到意图。在额外的,你必须指定一个URI的图片保存到。这将节省的全分辨率图像,否则,它只会捕捉一个小图像。

请参考Android的文档: ACTION_IM​​AGE_CAPTURE

这可以被发送到具有相机应用程序捕捉图像并将其返回标准意图动作。 调用者可以通过一个额外的 EXTRA_OUTPUT 来控制,其中该图像将被写入。如果 EXTRA_OUTPUT 不是present,然后小尺寸图像返回作为额外字段Bitmap对象。这对于应用程序,只需要一个小的图像是有用的。如果 EXTRA_OUTPUT 是present,那么全尺寸图像将被写入 EXTRA_OUTPUT 的URI值

I'm using the below code to open the camera. Is it possible to set the camera resolution to high programmatically?

private void openDefaultCameraApp() {
    Intent i = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
    startActivityForResult(i, CAPTURE_PHOTO_CONSTANT);
}

解决方案

You must add an MediaStore.EXTRA_OUTPUT to the intent. In the extra, you have to specify a Uri for the picture to be saved to. This will save the full resolution image, otherwise, it will just snap a small image.

Refer to the Android docs: ACTION_IMAGE_CAPTURE

Standard Intent action that can be sent to have the camera application capture an image and return it. The caller may pass an extra EXTRA_OUTPUT to control where this image will be written. If the EXTRA_OUTPUT is not present, then a small sized image is returned as a Bitmap object in the extra field. This is useful for applications that only need a small image. If the EXTRA_OUTPUT is present, then the full-sized image will be written to the Uri value of EXTRA_OUTPUT

这篇关于更改摄像机分辨率的Andr​​oid编程设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆