本文介绍了在Android的分辨率参数相机意图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我建立一个Android应用程序,其中的部分功能包括用户拍摄的图像和录制视频。

I am building an Android application where part of the functionality involves users taking images and recording video.

有关的应用程序,有必要设定为图像和视频特定的分辨率。是否可以指定分辨率参数,然后用相机意图捕捉图像和视频,或我需要建立自己的相机活动?

For the application there is a need to set a specific resolution for both the images and the video.Is it possible to specify the resolution parameters and then use a camera intent to capture images and video or do I need to build my own camera activity?

任何意见将是极大的AP preciated。

Any advice would be greatly appreciated.

编辑:我做了一些额外的研究,并有一看http://developer.android.com/guide/topics/media/camera.html#intents.

I did some additional research and had a look at http://developer.android.com/guide/topics/media/camera.html#intents.

如果我理解正确使用图像捕捉意图http://developer.android.com/reference/android/provider/MediaStore.html#ACTION_IMAGE_CAPTURE.

If I understand correctly there is no option to specify resolution parameters when using the Image capture intent http://developer.android.com/reference/android/provider/MediaStore.html#ACTION_IMAGE_CAPTURE.

有关视频拍摄意图看来我必须使用额外的视频质量参数的选项,但是,只有给我的高质量和低质量(这我不太清楚对应于分辨率方面)的选项http://developer.android.com/reference/android/provider/MediaStore.html#EXTRA_VIDEO_QUALITY

For the Video capture intent it seems I have the option to use the Extra Video Quality parameter, however that only gives me the option of high quality and low quality (which I am not quite sure what corresponds to in terms of resolution) http://developer.android.com/reference/android/provider/MediaStore.html#EXTRA_VIDEO_QUALITY

看来我最开始开发自己的图像和视频的活动的话,除非我错过了一些其他的选择的图像和视频的意图。

It seems I best get started developing my own image and video activities then, unless I missed some other options with the image and video intent.

推荐答案

相机意图开始外置摄像头applciation可能使用你的提示(但可能没有)。活动/应用程序是非标准(手机厂商的依赖),以及具体实施相机软件。

Camera intent starts external camera applciation which MAY use your hints (but MIGHT NOT). The activity/application is non standard (phone vendor dependent), as well as the concrete implementation of the camera software.

您也可以使用相机API(工作的例子是在这个项目中: http://sourceforge.net/项目/ javaocr / ),它可以让你:

You can also use the camera api ( working examples are in this project: http://sourceforge.net/projects/javaocr/ ) which allows you to:

  • 支持的查询图像格式和分辨率(你猜对了 - 供应商的依赖)
  • 设置了preVIEW和capure分辨率和格式(但摄像头的软件是可以忽略此设置,一些格式和分辨率,尽管会产生怪异的异常被宣传为支持)

结论:在Android设备上的相机不同,相机API是underdocumented一塌糊涂。所以,要作为防御性越好。

Conclusion: cameras in android devices are different and the camera API is underdocumented mess. So be as defensive as possible.

这篇关于在Android的分辨率参数相机意图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 16:35