Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Camera intent with resolution parameters in 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?

Any advice would be greatly appreciated.

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

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.

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.

like image 840
Lasse Samson Avatar asked Nov 02 '11 13:11

Lasse Samson


1 Answers

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.

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

  • query supported image formats and resolutions (you guessed it - vendor dependent)
  • set up preview and capure resolutions and formats (but camera software is free to ignore this setting, and some formats and resolutions can produce weird exceptions despite being advertised as supported)

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

like image 183
Konstantin Pribluda Avatar answered Nov 09 '22 04:11

Konstantin Pribluda