更改摄像机分辨率的Andr​​oid编程设置摄像机、分辨率、oid、Andr

由网友(后退的风景)分享简介:我用下面的code打开摄像头。是否可以将相机分辨率设置为高编程?私人无效openDefaultCameraApp(){意图I =新的意图(android.provider.MediaStore.ACTION_IM​​AGE_CAPTURE);startActivityForResult(ⅰ,CAPTURE_PHOTO_...

我用下面的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

阅读全文

相关推荐

最新文章