Camera.Parameters
public class Camera.Parameters
extends Object
java.lang.Object | |
? | android.hardware.Camera.Parameters |
This class was deprecated in API level 21.
We recommend using the new android.hardware.camera2
API for new applications.
Camera service settings.
To make camera parameters take effect, applications have to call setParameters(Camera.Parameters)
.
For example, after setWhiteBalance(String)
is
called, white balance is not actually changed until setParameters(Camera.Parameters)
is
called with the changed parameters object.
让相机参数生效,应用程序必须调用setParameters(Camera.Parameters)。例如,在setWhiteBalance(String),白平衡实际上并不是改变直到setParameters(Camera.Parameters)更改的参数对象。
Different devices may have different camera capabilities, such as picture size or flash modes. The application should query the camera capabilities before setting parameters. For example, the application should call getSupportedColorEffects()
before
calling setColorEffect(String)
. If the camera
does not support color effects, getSupportedColorEffects()
will
return null.
不同的设备有不同的相机功能,如图像大小或闪光模式。应用程序之前应该查询相机功能设置参数。例如,应用程序应该调用getSupportedColorEffects()调用之前setColorEffect(String)。如果相机不支持颜色效果,getSupportedColorEffects()将返回null。
Summary
Constants |
|
---|---|
String |
ANTIBANDING_50HZ
|
String |
ANTIBANDING_60HZ
|
String |
ANTIBANDING_AUTO
|
String |
ANTIBANDING_OFF
|
String |
EFFECT_AQUA
|
String |
EFFECT_BLACKBOARD
|
String |
EFFECT_MONO
|
String |
EFFECT_NEGATIVE
|
String |
EFFECT_NONE
|
String |
EFFECT_POSTERIZE
|
String |
EFFECT_SEPIA
|
String |
EFFECT_SOLARIZE
|
String |
EFFECT_WHITEBOARD
|
String |
FLASH_MODE_AUTO
Flash will be fired automatically when required. Flash在需要时将自动被解雇。 |
String |
FLASH_MODE_OFF
Flash will not be fired. Flash不会被解雇。 |
String |
FLASH_MODE_ON
Flash will always be fired during snapshot. Flash在快照总是会被解雇。 |
String |
FLASH_MODE_RED_EYE
Flash will be fired in red-eye reduction mode. Flash在减少红眼模式将被解雇。 |
String |
FLASH_MODE_TORCH
Constant emission of light during preview, auto-focus and snapshot. 常数光线发射在预览,自动对焦和快照。 |
int |
FOCUS_DISTANCE_FAR_INDEX
The array index of far focus distance for use with 焦点距离远的数组索引使用getFocusDistances(float[]). |
int |
FOCUS_DISTANCE_NEAR_INDEX
The array index of near focus distance for use with 焦点距离附近的数组索引使用getFocusDistances(float[])。 |
int |
FOCUS_DISTANCE_OPTIMAL_INDEX
The array index of optimal focus distance for use with 最佳聚焦距离的数组索引使用getFocusDistances(float[])。 |
String |
FOCUS_MODE_AUTO
Auto-focus mode. 自动对焦模式。 |
String |
FOCUS_MODE_CONTINUOUS_PICTURE
Continuous auto focus mode intended for taking pictures. 连续自动对焦模式用于拍照。 |
String |
FOCUS_MODE_CONTINUOUS_VIDEO
Continuous auto focus mode intended for video recording. 连续自动对焦模式用于录像。 |
String |
FOCUS_MODE_EDOF
Extended depth of field (EDOF). 扩展景深(EDOF)。 |
String |
FOCUS_MODE_FIXED
Focus is fixed. 焦点是固定的。 |
String |
FOCUS_MODE_INFINITY
Focus is set at infinity. 焦点是无穷。 |
String |
FOCUS_MODE_MACRO
Macro (close-up) focus mode. |
int |
PREVIEW_FPS_MAX_INDEX
The array index of maximum preview fps for use with 最大预览fps的数组索引使用getPreviewFpsRange(int[])或getSupportedPreviewFpsRange()。 |
int |
PREVIEW_FPS_MIN_INDEX
The array index of minimum preview fps for use with 最低预览fps的数组索引使用getPreviewFpsRange(int[])或getSupportedPreviewFpsRange()。 |
String |
SCENE_MODE_ACTION
Take photos of fast moving objects. 拍摄快速移动的物体。 |
String |
SCENE_MODE_AUTO
Scene mode is off. 场景模式。 |
String |
SCENE_MODE_BARCODE
Applications are looking for a barcode. 应用程序正在寻找一个条码。 |
String |
SCENE_MODE_BEACH
Take pictures on the beach. 在海滩上拍照。 |
String |
SCENE_MODE_CANDLELIGHT
Capture the naturally warm color of scenes lit by candles. 捕捉场景的自然暖色点燃蜡烛。 |
String |
SCENE_MODE_FIREWORKS
For shooting firework displays. 拍摄焰火表演。 |
String |
SCENE_MODE_HDR
Capture a scene using high dynamic range imaging techniques. 使用高动态范围成像技术捕捉一个场景。 |
String |
SCENE_MODE_LANDSCAPE
Take pictures on distant objects. 拍摄远处的物体。 |
String |
SCENE_MODE_NIGHT
Take photos at night. 晚上拍照。 |
String |
SCENE_MODE_NIGHT_PORTRAIT
Take people pictures at night. 晚上拍摄人物照片。 |
String |
SCENE_MODE_PARTY
Take indoor low-light shot. 室内光线拍摄。 |
String |
SCENE_MODE_PORTRAIT
Take people pictures. 人们拍摄照片。 |
String |
SCENE_MODE_SNOW
Take pictures on the snow. 在雪地里拍照。 |
String |
SCENE_MODE_SPORTS
Take photos of fast moving objects. 拍摄快速移动的物体。 |
String |
SCENE_MODE_STEADYPHOTO
Avoid blurry pictures (for example, due to hand shake). 避免模糊的图片(例如,由于握手)。 |
String |
SCENE_MODE_SUNSET
Take sunset photos. 日落的照片。 |
String |
SCENE_MODE_THEATRE
Take photos in a theater. 在剧院拍照。 |
String |
WHITE_BALANCE_AUTO
|
String |
WHITE_BALANCE_CLOUDY_DAYLIGHT
|
String |
WHITE_BALANCE_DAYLIGHT
|
String |
WHITE_BALANCE_FLUORESCENT
|
String |
WHITE_BALANCE_INCANDESCENT
|
String |
WHITE_BALANCE_SHADE
|
String |
WHITE_BALANCE_TWILIGHT
|
String |
WHITE_BALANCE_WARM_FLUORESCENT
|
Public methods |
|
---|---|
String |
flatten()
Creates a single string with all the parameters set in this Parameters object. |
String |
get(String key)
Returns the value of a String parameter. |
String |
getAntibanding()
Gets the current antibanding setting. |
boolean |
getAutoExposureLock()
Gets the state of the auto-exposure lock. |
boolean |
getAutoWhiteBalanceLock()
Gets the state of the auto-white balance lock. |
String |
getColorEffect()
Gets the current color effect setting. |
int |
getExposureCompensation()
Gets the current exposure compensation index. |
float |
getExposureCompensationStep()
Gets the exposure compensation step. |
String |
getFlashMode()
Gets the current flash mode setting. |
float |
getFocalLength()
Gets the focal length (in millimeter) of the camera. |
List<Camera.Area> |
getFocusAreas()
Gets the current focus areas. |
void |
getFocusDistances(float[] output)
Gets the distances from the camera to where an object appears to be in focus. |
String |
getFocusMode()
Gets the current focus mode setting. |
float |
getHorizontalViewAngle()
Gets the horizontal angle of view in degrees. |
int |
getInt(String key)
Returns the value of an integer parameter. |
int |
getJpegQuality()
Returns the quality setting for the JPEG picture. |
int |
getJpegThumbnailQuality()
Returns the quality setting for the EXIF thumbnail in Jpeg picture. |
Camera.Size |
getJpegThumbnailSize()
Returns the dimensions for EXIF thumbnail in Jpeg picture. |
int |
getMaxExposureCompensation()
Gets the maximum exposure compensation index. |
int |
getMaxNumDetectedFaces()
Gets the maximum number of detected faces supported. |
int |
getMaxNumFocusAreas()
Gets the maximum number of focus areas supported. |
int |
getMaxNumMeteringAreas()
Gets the maximum number of metering areas supported. |
int |
getMaxZoom()
Gets the maximum zoom value allowed for snapshot. |
List<Camera.Area> |
getMeteringAreas()
Gets the current metering areas. |
int |
getMinExposureCompensation()
Gets the minimum exposure compensation index. |
int |
getPictureFormat()
Returns the image format for pictures. |
Camera.Size |
getPictureSize()
Returns the dimension setting for pictures. |
Camera.Size |
getPreferredPreviewSizeForVideo()
Returns the preferred or recommended preview size (width and height) in pixels for video recording. |
int |
getPreviewFormat()
Returns the image format for preview frames got from |
void |
getPreviewFpsRange(int[] range)
Returns the current minimum and maximum preview fps. |
int |
getPreviewFrameRate()
This method was deprecated in API level 9. replaced by |
Camera.Size |
getPreviewSize()
Returns the dimensions setting for preview pictures. |
String |
getSceneMode()
Gets the current scene mode setting. |
List<String> |
getSupportedAntibanding()
Gets the supported antibanding values. |
List<String> |
getSupportedColorEffects()
Gets the supported color effects. |
List<String> |
getSupportedFlashModes()
Gets the supported flash modes. |
List<String> |
getSupportedFocusModes()
Gets the supported focus modes. |
List<Camera.Size> |
getSupportedJpegThumbnailSizes()
Gets the supported jpeg thumbnail sizes. |
List<Integer> |
getSupportedPictureFormats()
Gets the supported picture formats. |
List<Camera.Size> |
getSupportedPictureSizes()
Gets the supported picture sizes. |
List<Integer> |
getSupportedPreviewFormats()
Gets the supported preview formats. |
List<int[]> |
getSupportedPreviewFpsRange()
Gets the supported preview fps (frame-per-second) ranges. |
List<Integer> |
getSupportedPreviewFrameRates()
This method was deprecated in API level 9. replaced by |
List<Camera.Size> |
getSupportedPreviewSizes()
Gets the supported preview sizes. |
List<String> |
getSupportedSceneModes()
Gets the supported scene modes. |
List<Camera.Size> |
getSupportedVideoSizes()
Gets the supported video frame sizes that can be used by MediaRecorder. |
List<String> |
getSupportedWhiteBalance()
Gets the supported white balance. |
float |
getVerticalViewAngle()
Gets the vertical angle of view in degrees. |
boolean |
getVideoStabilization()
Get the current state of video stabilization. |
String |
getWhiteBalance()
Gets the current white balance setting. |
int |
getZoom()
Gets current zoom value. |
List<Integer> |
getZoomRatios()
Gets the zoom ratios of all zoom values. |
boolean |
isAutoExposureLockSupported()
Returns true if auto-exposure locking is supported. |
boolean |
isAutoWhiteBalanceLockSupported()
Returns true if auto-white balance locking is supported. |
boolean |
isSmoothZoomSupported()
Returns true if smooth zoom is supported. |
boolean |
isVideoSnapshotSupported()
Returns true if video snapshot is supported. |
boolean |
isVideoStabilizationSupported()
Returns true if video stabilization is supported. |
boolean |
isZoomSupported()
Returns true if zoom is supported. |
void |
remove(String key) |
void |
removeGpsData()
Removes GPS latitude, longitude, altitude, and timestamp from the parameters. |
void |
set(String key, String value)
Sets a String parameter. |
void |
set(String key,
Sets an integer parameter. |
void |
setAntibanding(String antibanding)
Sets the antibanding. |
void |
setAutoExposureLock(boolean toggle)
Sets the auto-exposure lock state. |
void |
setAutoWhiteBalanceLock(boolean
Sets the auto-white balance lock state. |
void |
setColorEffect(String value)
Sets the current color effect setting. |
void |
setExposureCompensation(int value)
Sets the exposure compensation index. |
void |
setFlashMode(String value)
Sets the flash mode. |
void |
setFocusAreas(List<Camera.Area>
Sets focus areas. |
void |
setFocusMode(String value)
Sets the focus mode. |
void |
setGpsAltitude(double altitude)
Sets GPS altitude. |
void |
setGpsLatitude(double latitude)
Sets GPS latitude coordinate. |
void |
setGpsLongitude(double longitude)
Sets GPS longitude coordinate. |
void |
setGpsProcessingMethod(String processing_method)
Sets GPS processing method. |
void |
setGpsTimestamp(long timestamp)
Sets GPS timestamp. |
void |
setJpegQuality(int quality)
Sets Jpeg quality of captured picture. |
void |
setJpegThumbnailQuality(int quality)
Sets the quality of the EXIF thumbnail in Jpeg picture. |
void |
setJpegThumbnailSize(int width,
Sets the dimensions for EXIF thumbnail in Jpeg picture. |
void |
setMeteringAreas(List<Camera.Area>
Sets metering areas. |
void |
setPictureFormat(int pixel_format)
Sets the image format for pictures. |
void |
setPictureSize(int width, int height)
Sets the dimensions for pictures. |
void |
setPreviewFormat(int pixel_format)
Sets the image format for preview pictures. |
void |
setPreviewFpsRange(int min, int max)
Sets the minimum and maximum preview fps. |
void |
setPreviewFrameRate(int fps)
This method was deprecated in API level 9. replaced by |
void |
setPreviewSize(int width, int height)
Sets the dimensions for preview pictures. |
void |
setRecordingHint(boolean hint)
Sets recording mode hint. |
void |
setRotation(int rotation)
Sets the clockwise rotation angle in degrees relative to the orientation of the camera. |
void |
setSceneMode(String value)
Sets the scene mode. |
void |
setVideoStabilization(boolean toggle)
Enables and disables video stabilization. |
void |
setWhiteBalance(String value)
Sets the white balance. |
void |
setZoom(int value)
Sets current zoom value. |
void |
unflatten(String flattened)
Takes a flattened string of parameters and adds each one to this Parameters object. |
Inherited methods |
|
---|---|
From class java.lang.Object
|
Constants
ANTIBANDING_50HZ
Added in API level 5
String ANTIBANDING_50HZ
Constant Value: "50hz"
ANTIBANDING_60HZ
Added in API level 5
String ANTIBANDING_60HZ
Constant Value: "60hz"
ANTIBANDING_AUTO
Added in API level 5
String ANTIBANDING_AUTO
Constant Value: "auto"
ANTIBANDING_OFF
Added in API level 5
String ANTIBANDING_OFF
Constant Value: "off"
EFFECT_AQUA
Added in API level 5
String EFFECT_AQUA
Constant Value: "aqua"
EFFECT_BLACKBOARD
Added in API level 5
String EFFECT_BLACKBOARD
Constant Value: "blackboard"
EFFECT_MONO
Added in API level 5
String EFFECT_MONO
Constant Value: "mono"
EFFECT_NEGATIVE
Added in API level 5
String EFFECT_NEGATIVE
Constant Value: "negative"
EFFECT_NONE
Added in API level 5
String EFFECT_NONE
Constant Value: "none"
EFFECT_POSTERIZE
Added in API level 5
String EFFECT_POSTERIZE
Constant Value: "posterize"
EFFECT_SEPIA
Added in API level 5
String EFFECT_SEPIA
Constant Value: "sepia"
EFFECT_SOLARIZE
Added in API level 5
String EFFECT_SOLARIZE
Constant Value: "solarize"
EFFECT_WHITEBOARD
Added in API level 5
String EFFECT_WHITEBOARD
Constant Value: "whiteboard"
FLASH_MODE_AUTO
Added in API level 5
String FLASH_MODE_AUTO
Flash will be fired automatically when required. The flash may be fired during preview, auto-focus, or snapshot depending on the driver.
Constant Value: "auto"
FLASH_MODE_OFF
Added in API level 5
String FLASH_MODE_OFF
Flash will not be fired.
Constant Value: "off"
FLASH_MODE_ON
Added in API level 5
String FLASH_MODE_ON
Flash will always be fired during snapshot. The flash may also be fired during preview or auto-focus depending on the driver.
Constant Value: "on"
FLASH_MODE_RED_EYE
Added in API level 5
String FLASH_MODE_RED_EYE
Flash will be fired in red-eye reduction mode.
Constant Value: "red-eye"
FLASH_MODE_TORCH
Added in API level 5
String FLASH_MODE_TORCH
Constant emission of light during preview, auto-focus and snapshot. This can also be used for video recording.
Constant Value: "torch"
FOCUS_DISTANCE_FAR_INDEX
Added in API level 9
int FOCUS_DISTANCE_FAR_INDEX
The array index of far focus distance for use with getFocusDistances(float[])
.
Constant Value: 2 (0x00000002)
FOCUS_DISTANCE_NEAR_INDEX
Added in API level 9
int FOCUS_DISTANCE_NEAR_INDEX
The array index of near focus distance for use with getFocusDistances(float[])
.
Constant Value: 0 (0x00000000)
FOCUS_DISTANCE_OPTIMAL_INDEX
Added in API level 9
int FOCUS_DISTANCE_OPTIMAL_INDEX
The array index of optimal focus distance for use with getFocusDistances(float[])
.
Constant Value: 1 (0x00000001)
FOCUS_MODE_AUTO
Added in API level 5
String FOCUS_MODE_AUTO
Auto-focus mode. Applications should call autoFocus(AutoFocusCallback)
to
start the focus in this mode.
Constant Value: "auto"
FOCUS_MODE_CONTINUOUS_PICTURE
Added in API level 14
String FOCUS_MODE_CONTINUOUS_PICTURE
Continuous auto focus mode intended for taking pictures. The camera continuously tries to focus. The speed of focus change is more aggressive thanFOCUS_MODE_CONTINUOUS_VIDEO
.
Auto focus starts when the parameter is set.
Applications can call autoFocus(AutoFocusCallback)
in
this mode. If the autofocus is in the middle of scanning, the focus callback will return when it completes. If the autofocus is not scanning, the focus callback will immediately return with a boolean that indicates whether the focus is sharp or not. The apps
can then decide if they want to take a picture immediately or to change the focus mode to auto, and run a full autofocus cycle. The focus position is locked after autoFocus call. If applications want to resume the continuous focus, cancelAutoFocus must be
called. Restarting the preview will not resume the continuous autofocus. To stop continuous focus, applications should change the focus mode to other modes.
See also:
Constant Value: "continuous-picture"
FOCUS_MODE_CONTINUOUS_VIDEO
Added in API level 9
String FOCUS_MODE_CONTINUOUS_VIDEO
Continuous auto focus mode intended for video recording. The camera continuously tries to focus. This is the best choice for video recording because the focus changes smoothly . Applications still can call takePicture(Camera.ShutterCallback,
in this mode but the subject may not be in focus. Auto focus starts when the parameter is set.
Camera.PictureCallback, Camera.PictureCallback)
Since API level 14, applications can call autoFocus(AutoFocusCallback)
in
this mode. The focus callback will immediately return with a boolean that indicates whether the focus is sharp or not. The focus position is locked after autoFocus call. If applications want to resume the continuous focus, cancelAutoFocus must be called. Restarting
the preview will not resume the continuous autofocus. To stop continuous focus, applications should change the focus mode to other modes.
See also:
Constant Value: "continuous-video"
FOCUS_MODE_EDOF
Added in API level 8
String FOCUS_MODE_EDOF
Extended depth of field (EDOF). Focusing is done digitally and continuously. Applications should not call autoFocus(AutoFocusCallback)
in
this mode.
Constant Value: "edof"
FOCUS_MODE_FIXED
Added in API level 5
String FOCUS_MODE_FIXED
Focus is fixed. The camera is always in this mode if the focus is not adjustable. If the camera has auto-focus, this mode can fix the focus, which is usually at hyperfocal distance. Applications should not call autoFocus(AutoFocusCallback)
in
this mode.
Constant Value: "fixed"
FOCUS_MODE_INFINITY
Added in API level 5
String FOCUS_MODE_INFINITY
Focus is set at infinity. Applications should not call autoFocus(AutoFocusCallback)
in
this mode.
Constant Value: "infinity"
FOCUS_MODE_MACRO
Added in API level 5
String FOCUS_MODE_MACRO
Macro (close-up) focus mode. Applications should call autoFocus(AutoFocusCallback)
to
start the focus in this mode.
Constant Value: "macro"
PREVIEW_FPS_MAX_INDEX
Added in API level 9
int PREVIEW_FPS_MAX_INDEX
The array index of maximum preview fps for use with getPreviewFpsRange(int[])
or getSupportedPreviewFpsRange()
.
Constant Value: 1 (0x00000001)
PREVIEW_FPS_MIN_INDEX
Added in API level 9
int PREVIEW_FPS_MIN_INDEX
The array index of minimum preview fps for use with getPreviewFpsRange(int[])
or getSupportedPreviewFpsRange()
.
Constant Value: 0 (0x00000000)
SCENE_MODE_ACTION
Added in API level 5
String SCENE_MODE_ACTION
Take photos of fast moving objects. Same as SCENE_MODE_SPORTS
.
Constant Value: "action"
SCENE_MODE_AUTO
Added in API level 5
String SCENE_MODE_AUTO
Scene mode is off.
Constant Value: "auto"
SCENE_MODE_BARCODE
Added in API level 8
String SCENE_MODE_BARCODE
Applications are looking for a barcode. Camera driver will be optimized for barcode reading.
Constant Value: "barcode"
SCENE_MODE_BEACH
Added in API level 5
String SCENE_MODE_BEACH
Take pictures on the beach.
Constant Value: "beach"
SCENE_MODE_CANDLELIGHT
Added in API level 5
String SCENE_MODE_CANDLELIGHT
Capture the naturally warm color of scenes lit by candles.
Constant Value: "candlelight"
SCENE_MODE_FIREWORKS
Added in API level 5
String SCENE_MODE_FIREWORKS
For shooting firework displays.
Constant Value: "fireworks"
SCENE_MODE_HDR
Added in API level 17
String SCENE_MODE_HDR
Capture a scene using high dynamic range imaging techniques. The camera will return an image that has an extended dynamic range compared to a regular capture. Capturing such an image may take longer than a regular
capture.
Constant Value: "hdr"
SCENE_MODE_LANDSCAPE
Added in API level 5
String SCENE_MODE_LANDSCAPE
Take pictures on distant objects.
Constant Value: "landscape"
SCENE_MODE_NIGHT
Added in API level 5
String SCENE_MODE_NIGHT
Take photos at night.
Constant Value: "night"
SCENE_MODE_NIGHT_PORTRAIT
Added in API level 5
String SCENE_MODE_NIGHT_PORTRAIT
Take people pictures at night.
Constant Value: "night-portrait"
SCENE_MODE_PARTY
Added in API level 5
String SCENE_MODE_PARTY
Take indoor low-light shot.
Constant Value: "party"
SCENE_MODE_PORTRAIT
Added in API level 5
String SCENE_MODE_PORTRAIT
Take people pictures.
Constant Value: "portrait"
SCENE_MODE_SNOW
Added in API level 5
String SCENE_MODE_SNOW
Take pictures on the snow.
Constant Value: "snow"
SCENE_MODE_SPORTS
Added in API level 5
String SCENE_MODE_SPORTS
Take photos of fast moving objects. Same as SCENE_MODE_ACTION
.
Constant Value: "sports"
SCENE_MODE_STEADYPHOTO
Added in API level 5
String SCENE_MODE_STEADYPHOTO
Avoid blurry pictures (for example, due to hand shake).
Constant Value: "steadyphoto"
SCENE_MODE_SUNSET
Added in API level 5
String SCENE_MODE_SUNSET
Take sunset photos.
Constant Value: "sunset"
SCENE_MODE_THEATRE
Added in API level 5
String SCENE_MODE_THEATRE
Take photos in a theater. Flash light is off.
Constant Value: "theatre"
WHITE_BALANCE_AUTO
Added in API level 5
String WHITE_BALANCE_AUTO
Constant Value: "auto"
WHITE_BALANCE_CLOUDY_DAYLIGHT
Added in API level 5
String WHITE_BALANCE_CLOUDY_DAYLIGHT
Constant Value: "cloudy-daylight"
WHITE_BALANCE_DAYLIGHT
Added in API level 5
String WHITE_BALANCE_DAYLIGHT
Constant Value: "daylight"
WHITE_BALANCE_FLUORESCENT
Added in API level 5
String WHITE_BALANCE_FLUORESCENT
Constant Value: "fluorescent"
WHITE_BALANCE_INCANDESCENT
Added in API level 5
String WHITE_BALANCE_INCANDESCENT
Constant Value: "incandescent"
WHITE_BALANCE_SHADE
Added in API level 5
String WHITE_BALANCE_SHADE
Constant Value: "shade"
WHITE_BALANCE_TWILIGHT
Added in API level 5
String WHITE_BALANCE_TWILIGHT
Constant Value: "twilight"
WHITE_BALANCE_WARM_FLUORESCENT
Added in API level 5
String WHITE_BALANCE_WARM_FLUORESCENT
Constant Value: "warm-fluorescent"
Public methods
flatten
Added in API level 1
String flatten ()
Creates a single string with all the parameters set in this Parameters object.
创建一个字符串中所有的参数设置的参数对象。
The unflatten(String)
method
does the reverse.
Returns | |
---|---|
String |
a String with all values from this Parameters object, in semi-colon delimited key-value pairs |
get
Added in API level 1
String get (String key)
Returns the value of a String parameter.
Parameters | |
---|---|
key |
String : the key name for the parameter |
Returns | |
---|---|
String |
the String value of the parameter |
getAntibanding
Added in API level 5
String getAntibanding ()
Gets the current antibanding setting.获取当前antibanding设置。
Returns | |
---|---|
String |
current antibanding. null if antibanding setting is not supported. |
See also:
getAutoExposureLock
Added in API level 14
boolean getAutoExposureLock ()
Gets the state of the auto-exposure lock. Applications should check isAutoExposureLockSupported()
before
using this method. SeesetAutoExposureLock(boolean)
for
details about the lock.在自动曝光锁定的状态。应用程序应该检查isAutoExposureLockSupported()之前使用这种方法。看到setAutoExposureLock(boolean)锁的详细信息。
Returns | |
---|---|
boolean |
State of the auto-exposure lock. Returns true if auto-exposure is currently locked, and false otherwise.在自动曝光锁定的状态。返回true,如果目前在自动曝光锁定,否则,则返回false。 |
See also:
getAutoWhiteBalanceLock
Added in API level 14
boolean getAutoWhiteBalanceLock ()
Gets the state of the auto-white balance lock. Applications should check isAutoWhiteBalanceLockSupported()
before
using this method. SeesetAutoWhiteBalanceLock(boolean)
for
details about the lock.锁会自动白平衡的状态。应用程序应该检查isAutoWhiteBalanceLockSupported()之前使用这种方法。看到setAutoWhiteBalanceLock(boolean)锁的详细信息。
Returns | |
---|---|
boolean |
State of the auto-white balance lock. Returns true if auto-white balance is currently locked, and false otherwise.自动白平衡锁的状态。返回true,如果自动白平衡是目前锁定,否则,则返回false。 |
See also:
getColorEffect
Added in API level 5
String getColorEffect ()
Gets the current color effect setting.获取当前颜色设置的影响。
Returns | |
---|---|
String |
current color effect. null if color effect setting is not supported.当前的颜色效果。如果颜色效果设置不支持则返回null。 |
See also:
EFFECT_NONE
EFFECT_MONO
EFFECT_NEGATIVE
EFFECT_SOLARIZE
EFFECT_SEPIA
EFFECT_POSTERIZE
EFFECT_WHITEBOARD
EFFECT_BLACKBOARD
EFFECT_AQUA
getExposureCompensation
Added in API level 8
int getExposureCompensation ()
Gets the current exposure compensation index.获取当前曝光补偿指数。
Returns | |
---|---|
int |
current exposure compensation index. The range is getMinExposureCompensation() to getMaxExposureCompensation() .0 means exposure is not adjusted. 当前的曝光补偿指数。范围是getMinExposureCompensation()getMaxExposureCompensation()。0意味着暴露不调整。 |
getExposureCompensationStep
Added in API level 8
float getExposureCompensationStep ()
Gets the exposure compensation step.得到了曝光补偿步骤。
Returns | |
---|---|
float |
exposure compensation step. Applications can get EV by multiplying the exposure compensation index and step. Ex: if exposure compensation index is -6 and step is 0.333333333, EV is -2. |
getFlashMode
Added in API level 5
String getFlashMode ()
Gets the current flash mode setting.获取当前闪光模式设置。
Returns | |
---|---|
String |
current flash mode. null if flash mode setting is not supported.当前的闪光模式。如果闪光模式设置不支持则返回null。 |
See also:
getFocalLength
Added in API level 8
float getFocalLength ()
Gets the focal length (in millimeter) of the camera.得到相机的焦距(毫米)。
Returns | |
---|---|
float |
the focal length. This method will always return a valid value.焦距。这个方法总是返回一个有效的值。 |
getFocusAreas
Added in API level 14
List<Camera.Area> getFocusAreas ()
Gets the current focus areas. Camera driver uses the areas to decide focus.得到当前的焦点地区。摄像头驱动程序使用决定关注的领域。
Before using this API or setFocusAreas(List)
,
apps should call getMaxNumFocusAreas()
to know the
maximum number of focus areas first. If the value is 0, focus area is not supported.之前使用这个API或setFocusAreas(列表),应用程序应该叫getMaxNumFocusAreas()先知道重点领域的最大数量。如果该值为0,不支持重点区域。
Each focus area is a rectangle with specified weight. The direction is relative to the sensor orientation, that is, what the sensor sees. The direction is not affected by the rotation or mirroring of setDisplayOrientation(int)
.
Coordinates of the rectangle range from -1000 to 1000. (-1000, -1000) is the upper left point. (1000, 1000) is the lower right point. The width and height of focus areas cannot be 0 or negative.每个重点区域是一个矩形,指定的重量。方向是相对于传感器定位,也就是说,传感器所看到的。方向是不受旋转或镜像setDisplayOrientation(int)。矩形的坐标范围从-1000到1000。(-1000,-1000)是左上角点。(1000,1000)是右下角点。重点区域的宽度和高度不能是0或负面的。
The weight must range from 1 to 1000. The weight should be interpreted as a per-pixel weight - all pixels in the area have the specified weight. This means a small area with the same weight as a larger area will
have less influence on the focusing than the larger area. Focus areas can partially overlap and the driver will add the weights in the overlap region.重量必须在1到1000之间。重量应该解读为单像素的重量,该地区所有像素指定的重量。这意味着小面积相同的体重较大的面积会减少影响比面积较大的关注。重点领域可以部分重叠,传感器将重叠区域的权重。
A special case of a null
focus area list means the driver is free to select focus targets as it wants. For example, the driver may use more signals to select focus areas and change them dynamically.
Apps can set the focus area list to null
if they want the driver to completely control focusing.零聚焦区域的一种特殊情况列表意味着传感器和它想要自由选择重点目标。例如,传感器可能使用更多的信号选择重点领域,并动态地更改它们。应用程序可以设置重点区域列表为空,如果他们想让传感器完全集中控制。
Focus areas are relative to the current field of view (getZoom()
).
No matter what the zoom level is, (-1000,-1000) represents the top of the currently visible camera frame. The focus area cannot be set to be outside the current field of view, even when using zoom.重点领域是相对于当前的视野(getZoom())。无论缩放级别是什么,(-1000、-1000)代表目前可见的相机顶部的框架。重点区域不能被设置为当前的视野之外,即使使用变焦。
关注领域只有效果如果FOCUS_MODE_AUTO当前的焦点模式,FOCUS_MODE_MACRO,FOCUS_MODE_CONTINUOUS_VIDEO
orFOCUS_MODE_CONTINUOUS_PICTURE。
Returns | |
---|---|
List<Camera.Area> |
a list of current focus areas |
getFocusDistances
Added in API level 9
void getFocusDistances (float[] output)
Gets the distances from the camera to where an object appears to be in focus. The object is sharpest at the optimal focus distance. The depth of field is the far focus distance minus near focus distance.获取物体距离相机,似乎是焦点。最佳的对象是最焦点的距离。景深是焦点距离-焦点附近距离。
Focus distances may change after calling autoFocus(AutoFocusCallback)
, cancelAutoFocus()
,
or startPreview()
. Applications can callgetParameters()
and
this method anytime to get the latest focus distances. If the focus mode is FOCUS_MODE_CONTINUOUS_VIDEO, focus distances may change from time to time.焦点的距离可能会改变调用自动对焦(AutoFocusCallback)后,cancelAutoFocus(),或startPreview()。应用程序可以callgetParameters()和该方法随时获取最新的焦点的距离。如果FOCUS_MODE_CONTINUOUS_VIDEO重点模式,焦点的距离可能会改变的时候。
This method is intended to estimate the distance between the camera and the subject. After autofocus, the subject distance may be within near and far focus distance. However, the precision depends on the camera
hardware, autofocus algorithm, the focus area, and the scene. The error can be large and it should be only used as a reference.这种方法旨在估计相机之间的距离和主题。自动对焦后,主题可能在远近距离焦点的距离。然而,精度取决于相机硬件、自动对焦算法,重点区域和现场。错误可以大,它应该只作为参考使用。
Far focus distance >= optimal focus distance >= near focus distance. If the focus distance is infinity, the value will be Float.POSITIVE_INFINITY
.远焦点附近距离>
=最佳焦点距离> =焦点的距离。如果焦点距离是无穷,将Float.POSITIVE_INFINITY价值。
Parameters | |
---|---|
output |
float : focus distances in meters. output must be a float array with three elements. Near focus distance, optimal focus distance, and far focus distance will be filled in the array. |
See also:
getFocusMode
Added in API level 5
String getFocusMode ()
Gets the current focus mode setting.得到当前的焦点模式设置。
Returns | |
---|---|
String |
current focus mode. This method will always return a non-null value. Applications should call autoFocus(AutoFocusCallback) tostart the focus if focus mode is FOCUS_MODE_AUTO or FOCUS_MODE_MACRO.目前的焦点模式。这个方法总是返回一个非空值。应用程序应该调用自动对焦(AutoFocusCallback)开始专注如果FOCUS_MODE_AUTO或FOCUS_MODE_MACRO集中模式。 |
See also:
FOCUS_MODE_AUTO
FOCUS_MODE_INFINITY
FOCUS_MODE_MACRO
FOCUS_MODE_FIXED
FOCUS_MODE_EDOF
FOCUS_MODE_CONTINUOUS_VIDEO
getHorizontalViewAngle
Added in API level 8
float getHorizontalViewAngle ()
Gets the horizontal angle of view in degrees.获取角度的水平视角。
Returns | |
---|---|
float |
horizontal angle of view. This method will always return a valid value.水平视角。这个方法总是返回一个有效的值。 |
getInt
Added in API level 1
int getInt (String key)
Returns the value of an integer parameter.
Parameters | |
---|---|
key |
String : the key name for the parameter |
Returns | |
---|---|
int |
the int value of the parameter |
getJpegQuality
Added in API level 5
int getJpegQuality ()
Returns the quality setting for the JPEG picture.获取JPEG图片的照片质量
Returns | |
---|---|
int |
the JPEG picture quality setting.JPEG图像质量设置。 |
getJpegThumbnailQuality
Added in API level 5
int getJpegThumbnailQuality ()
Returns the quality setting for the EXIF thumbnail in Jpeg picture.返回EXIF
Jpeg图像的缩略图质量。
Returns | |
---|---|
int |
the JPEG quality setting of the EXIF thumbnail. JPEG质量设置的EXIF缩略图。 |
getJpegThumbnailSize
Added in API level 5
Camera.Size getJpegThumbnailSize ()
Returns the dimensions for EXIF thumbnail in Jpeg picture.返回EXIF缩略图的尺寸在Jpeg图像。
Returns | |
---|---|
Camera.Size |
a Size object with the height and width setting for the EXIF thumbnails大小对象的高度和宽度设置EXIF缩略图 |
getMaxExposureCompensation
Added in API level 8
int getMaxExposureCompensation ()
Gets the maximum exposure compensation index.得到了最大的曝光补偿指数。
Returns | |
---|---|
int |
maximum exposure compensation index (>=0). If both this method and getMinExposureCompensation() return0, exposure compensation is not supported. |
getMaxNumDetectedFaces
Added in API level 14
int getMaxNumDetectedFaces ()
Gets the maximum number of detected faces supported. This is the maximum length of the list returned from Camera.FaceDetectionListener
.
If the return value is 0, face detection of the specified type is not supported.
会发现面临的最大数量的支持。这是列表的最大长度从Camera.FaceDetectionListener回来。如果返回值是0,不支持指定类型的人脸检测。
Returns | |
---|---|
int |
the maximum number of detected face supported by the camera. |
See also:
getMaxNumFocusAreas
Added in API level 14
int getMaxNumFocusAreas ()
Gets the maximum number of focus areas supported. This is the maximum length of the list in setFocusAreas(List)
and getFocusAreas()
.
重点领域支持的最大数量。这是setFocusAreas列表的最大长度(列表)和getFocusAreas()
Returns | |
---|---|
int |
the maximum number of focus areas supported by the camera. |
See also:
getMaxNumMeteringAreas
Added in API level 14
int getMaxNumMeteringAreas ()
Gets the maximum number of metering areas supported. This is the maximum length of the list in setMeteringAreas(List)
and getMeteringAreas()
.
Returns | |
---|---|
int |
the maximum number of metering areas supported by the camera. |
See also:
getMaxZoom
Added in API level 8
int getMaxZoom ()
Gets the maximum zoom value allowed for snapshot. This is the maximum value that applications can set to setZoom(int)
.
Applications should callisZoomSupported()
before using
this method. This value may change in different preview size. Applications should call this again after setting preview size.得到了最大缩放值允许快照。这是应用程序可以设置为最大值setZoom(int)。应用程序应该callisZoomSupported()之前使用这种方法。在不同的预览大小这个值可能会改变。应用程序应该调用这个预览大小后再设置。
Returns | |
---|---|
int |
the maximum zoom value supported by the camera. |
getMeteringAreas
Added in API level 14
List<Camera.Area> getMeteringAreas ()
Gets the current metering areas. Camera driver uses these areas to decide exposure.
Before using this API or setMeteringAreas(List)
,
apps should call getMaxNumMeteringAreas()
to know
the maximum number of metering areas first. If the value is 0, metering area is not supported.
Each metering area is a rectangle with specified weight. The direction is relative to the sensor orientation, that is, what the sensor sees. The direction is not affected by the rotation or mirroring of setDisplayOrientation(int)
.
Coordinates of the rectangle range from -1000 to 1000. (-1000, -1000) is the upper left point. (1000, 1000) is the lower right point. The width and height of metering areas cannot be 0 or negative.
The weight must range from 1 to 1000, and represents a weight for every pixel in the area. This means that a large metering area with the same weight as a smaller area will have more effect in the metering result.
Metering areas can partially overlap and the driver will add the weights in the overlap region.
A special case of a null
metering area list means the driver is free to meter as it chooses. For example, the driver may use more signals to select metering areas and change them dynamically.
Apps can set the metering area list to null
if they want the driver to completely control metering.
Metering areas are relative to the current field of view (getZoom()
).
No matter what the zoom level is, (-1000,-1000) represents the top of the currently visible camera frame. The metering area cannot be set to be outside the current field of view, even when using zoom.
No matter what metering areas are, the final exposure are compensated by setExposureCompensation(int)
.
Returns | |
---|---|
List<Camera.Area> |
a list of current metering areas |
getMinExposureCompensation
Added in API level 8
int getMinExposureCompensation ()
Gets the minimum exposure compensation index.
Returns | |
---|---|
int |
minimum exposure compensation index (<=0). If both this method and getMaxExposureCompensation() return0, exposure compensation is not supported. |
getPictureFormat
Added in API level 1
int getPictureFormat ()
Returns the image format for pictures. 返回图像格式的图片。
Returns | |
---|---|
int |
the picture format |
See also:
getPictureSize
Added in API level 1
Camera.Size getPictureSize ()
Returns the dimension setting for pictures.返回图片设置尺寸。
Returns | |
---|---|
Camera.Size |
a Size object with the height and width setting for pictures |
getPreferredPreviewSizeForVideo
Added in API level 11
Camera.Size getPreferredPreviewSizeForVideo ()
Returns the preferred or recommended preview size (width and height) in pixels for video recording. Camcorder applications should set the preview size to a value that is not larger than the preferred preview size.
In other words, the product of the width and height of the preview size should not be larger than that of the preferred preview size. In addition, we recommend to choose a preview size that has the same aspect ratio as the resolution of video to be recorded.返回的首选或推荐预览大小(宽度和高度)像素的录像。摄像机应用程序应该设置预览大小的值不大于首选预览大小。换句话说,产品的宽度和高度预览大小不应超过的首选预览大小。此外,我们建议选择一个预览大小相同的长宽比分辨率的视频记录。
Returns | |
---|---|
Camera.Size |
the preferred preview size (width and height) in pixels for video recording if getSupportedVideoSizes() does not return null; otherwise, null is returned. |
See also:
getPreviewFormat
Added in API level 1
int getPreviewFormat ()
Returns the image format for preview frames got from Camera.PreviewCallback
.返回从Camera.PreviewCallback预览帧的图像格式。
Returns | |
---|---|
int |
the preview format. |
See also:
getPreviewFpsRange
Added in API level 9
void getPreviewFpsRange (int[] range)
Returns the current minimum and maximum preview fps. The values are one of the elements returned by getSupportedPreviewFpsRange()
.
返回当前的最小和最大预览fps。返回的值是一个元素getSupportedPreviewFpsRange()。
Parameters | |
---|---|
range |
int |
Returns | |
---|---|
void |
range the minimum and maximum preview fps (scaled by 1000). |
See also:
getPreviewFrameRate
Added in API level 1
int getPreviewFrameRate ()
This method was deprecated in API level 9.
replaced by getPreviewFpsRange(int[])
Returns the setting for the rate at which preview frames are received. This is the target frame rate. The actual frame rate depends on the driver.返回设置预览帧的速率。这是目标帧率。实际的帧速率取决于传感器。
Returns | |
---|---|
int |
the frame rate setting (frames per second) |
getPreviewSize
Added in API level 1
Camera.Size getPreviewSize ()
Returns the dimensions setting for preview pictures.
Returns | |
---|---|
Camera.Size |
a Size object with the width and height setting for the preview picture |
getSceneMode
Added in API level 5
String getSceneMode ()
Gets the current scene mode setting.获取当前情景模式设置。
Returns | |
---|---|
String |
one of SCENE_MODE_XXX string constant. null if scene mode setting is not supported. |
See also:
SCENE_MODE_AUTO
SCENE_MODE_ACTION
SCENE_MODE_PORTRAIT
SCENE_MODE_LANDSCAPE
SCENE_MODE_NIGHT
SCENE_MODE_NIGHT_PORTRAIT
SCENE_MODE_THEATRE
SCENE_MODE_BEACH
SCENE_MODE_SNOW
SCENE_MODE_SUNSET
SCENE_MODE_STEADYPHOTO
SCENE_MODE_FIREWORKS
SCENE_MODE_SPORTS
SCENE_MODE_PARTY
SCENE_MODE_CANDLELIGHT
SCENE_MODE_BARCODE
getSupportedAntibanding
Added in API level 5
List<String> getSupportedAntibanding ()
Gets the supported antibanding values.
Returns | |
---|---|
List<String> |
a list of supported antibanding values. null if antibanding setting is not supported. |
See also:
getSupportedColorEffects
Added in API level 5
List<String> getSupportedColorEffects ()
Gets the supported color effects.
Returns | |
---|---|
List<String> |
a list of supported color effects. null if color effect setting is not supported. |
See also:
getSupportedFlashModes
Added in API level 5
List<String> getSupportedFlashModes ()
Gets the supported flash modes.
Returns | |
---|---|
List<String> |
a list of supported flash modes. null if flash mode setting is not supported. |
See also:
getSupportedFocusModes
Added in API level 5
List<String> getSupportedFocusModes ()
Gets the supported focus modes.
Returns | |
---|---|
List<String> |
a list of supported focus modes. This method will always return a list with at least one element. |
See also:
getSupportedJpegThumbnailSizes
Added in API level 8
List<Camera.Size> getSupportedJpegThumbnailSizes ()
Gets the supported jpeg thumbnail sizes.
Returns | |
---|---|
List<Camera.Size> |
a list of Size object. This method will always return a list with at least two elements. Size 0,0 (no thumbnail) is always supported. |
getSupportedPictureFormats
Added in API level 5
List<Integer> getSupportedPictureFormats ()
Gets the supported picture formats.
Returns | |
---|---|
List<Integer> |
supported picture formats. This method will always return a list with at least one element. |
See also:
getSupportedPictureSizes
Added in API level 5
List<Camera.Size> getSupportedPictureSizes ()
Gets the supported picture sizes.
Returns | |
---|---|
List<Camera.Size> |
a list of supported picture sizes. This method will always return a list with at least one element. |
getSupportedPreviewFormats
Added in API level 5
List<Integer> getSupportedPreviewFormats ()
Gets the supported preview formats. NV21
is
always supported. YV12
is always supported since API level 12.
Returns | |
---|---|
List<Integer> |
a list of supported preview formats. This method will always return a list with at least one element. |
See also:
getSupportedPreviewFpsRange
Added in API level 9
List<int[]> getSupportedPreviewFpsRange ()
Gets the supported preview fps (frame-per-second) ranges. Each range contains a minimum fps and maximum fps. If minimum fps equals to maximum fps, the camera outputs frames in fixed frame rate. If not, the camera
outputs frames in auto frame rate. The actual frame rate fluctuates between the minimum and the maximum. The values are multiplied by 1000 and represented in integers. For example, if frame rate is 26.623 frames per second, the value is 26623.得到了支持预览fps(frame-per-second)范围。每个范围包含一个最低fps和最大fps。如果最小fps等于最大fps,摄像机固定帧速率输出帧。如果没有,相机输出帧汽车帧速率。实际的帧率最小值和最大值之间的波动。价值乘以1000,用整数表示。例如,如果帧速率是每秒26.623帧,值为26623。
Returns | |
---|---|
List<int[]> |
a list of supported preview fps ranges. This method returns a list with at least one element. Every element is an int array of two values - minimum fps and maximum fps. The list is sorted from small to large (first by maximum fps and then minimum fps). |
See also:
getSupportedPreviewFrameRates
Added in API level 5
List<Integer> getSupportedPreviewFrameRates ()
This method was deprecated in API level 9.
replaced by getSupportedPreviewFpsRange()
Gets the supported preview frame rates.
Returns | |
---|---|
List<Integer> |
a list of supported preview frame rates. null if preview frame rate setting is not supported. |
getSupportedPreviewSizes
Added in API level 5
List<Camera.Size> getSupportedPreviewSizes ()
Gets the supported preview sizes.
Returns | |
---|---|
List<Camera.Size> |
a list of Size object. This method will always return a list with at least one element. |
getSupportedSceneModes
Added in API level 5
List<String> getSupportedSceneModes ()
Gets the supported scene modes.
Returns | |
---|---|
List<String> |
a list of supported scene modes. null if scene mode setting is not supported. |
See also:
getSupportedVideoSizes
Added in API level 11
List<Camera.Size> getSupportedVideoSizes ()
Gets the supported video frame sizes that can be used by MediaRecorder.
If the returned list is not null, the returned list will contain at least one Size and one of the sizes in the returned list must be passed to MediaRecorder.setVideoSize() for camcorder application if camera is
used as the video source. In this case, the size of the preview can be different from the resolution of the recorded video during video recording.
Returns | |
---|---|
List<Camera.Size> |
a list of Size object if camera has separate preview and video output; otherwise, null is returned. |
See also:
getSupportedWhiteBalance
Added in API level 5
List<String> getSupportedWhiteBalance ()
Gets the supported white balance.
Returns | |
---|---|
List<String> |
a list of supported white balance. null if white balance setting is not supported. |
See also:
getVerticalViewAngle
Added in API level 8
float getVerticalViewAngle ()
Gets the vertical angle of view in degrees.
Returns | |
---|---|
float |
vertical angle of view. This method will always return a valid value. |
getVideoStabilization
Added in API level 15
boolean getVideoStabilization ()
Get the current state of video stabilization. See setVideoStabilization(boolean)
for
details of video stabilization.
Returns | |
---|---|
boolean |
true if video stabilization is enabled |
See also:
getWhiteBalance
Added in API level 5
String getWhiteBalance ()
Gets the current white balance setting.
Returns | |
---|---|
String |
current white balance. null if white balance setting is not supported. |
See also:
WHITE_BALANCE_AUTO
WHITE_BALANCE_INCANDESCENT
WHITE_BALANCE_FLUORESCENT
WHITE_BALANCE_WARM_FLUORESCENT
WHITE_BALANCE_DAYLIGHT
WHITE_BALANCE_CLOUDY_DAYLIGHT
WHITE_BALANCE_TWILIGHT
WHITE_BALANCE_SHADE
getZoom
Added in API level 8
int getZoom ()
Gets current zoom value. This also works when smooth zoom is in progress. Applications should check isZoomSupported()
before
using this method.
Returns | |
---|---|
int |
the current zoom value. The range is 0 to getMaxZoom() .0 means the camera is not zoomed. |
getZoomRatios
Added in API level 8
List<Integer> getZoomRatios ()
Gets the zoom ratios of all zoom values. Applications should check isZoomSupported()
before
using this method.
Returns | |
---|---|
List<Integer> |
the zoom ratios in 1/100 increments. Ex: a zoom of 3.2x is returned as 320. The number of elements is getMaxZoom() +1. The list is sorted from small to large. The first element is always 100. The last element is the zoom ratio of the maximum zoom value. |
isAutoExposureLockSupported
Added in API level 14
boolean isAutoExposureLockSupported ()
Returns true if auto-exposure locking is supported. Applications should call this before trying to lock auto-exposure. See setAutoExposureLock(boolean)
for
details about the lock.
Returns | |
---|---|
boolean |
true if auto-exposure lock is supported. |
See also:
isAutoWhiteBalanceLockSupported
Added in API level 14
boolean isAutoWhiteBalanceLockSupported ()
Returns true if auto-white balance locking is supported. Applications should call this before trying to lock auto-white balance. SeesetAutoWhiteBalanceLock(boolean)
for
details about the lock.
Returns | |
---|---|
boolean |
true if auto-white balance lock is supported. |
See also:
isSmoothZoomSupported
Added in API level 8
boolean isSmoothZoomSupported ()
Returns true if smooth zoom is supported. Applications should call this before using other smooth zoom methods.如果平滑缩放支持返回true。应用程序应该调用这个之前使用其他平滑缩放方法。
Returns | |
---|---|
boolean |
true if smooth zoom is supported. |
isVideoSnapshotSupported
Added in API level 14
boolean isVideoSnapshotSupported ()
Returns true if video snapshot is supported. That is, applications can call takePicture(Camera.ShutterCallback,
during recording. Applications do not need to call
Camera.PictureCallback, Camera.PictureCallback, Camera.PictureCallback)startPreview()
after
taking a picture. The preview will be still active. Other than that, taking a picture during recording is identical to taking a picture normally. All settings and methods related to takePicture work identically. Ex: getPictureSize()
, getSupportedPictureSizes()
, setJpegQuality(int)
, setRotation(int)
,
and etc. The picture will have an EXIF header. FLASH_MODE_AUTO
and FLASH_MODE_ON
also
still work, but the video will record the flash.
Applications can set shutter callback as null to avoid the shutter sound. It is also recommended to set raw picture and post view callbacks to null to avoid the interrupt of preview display.
Field-of-view of the recorded video may be different from that of the captured pictures. The maximum size of a video snapshot may be smaller than that for regular still captures. If the current picture size is set
higher than can be supported by video snapshot, the picture will be captured at the maximum supported size instead.
Returns | |
---|---|
boolean |
true if video snapshot is supported. |
isVideoStabilizationSupported
Added in API level 15
boolean isVideoStabilizationSupported ()
Returns true if video stabilization is supported. See setVideoStabilization(boolean)
for
details of video stabilization.
Returns | |
---|---|
boolean |
true if video stabilization is supported |
See also:
isZoomSupported
Added in API level 8
boolean isZoomSupported ()
Returns true if zoom is supported. Applications should call this before using other zoom methods.
Returns | |
---|---|
boolean |
true if zoom is supported. |
remove
Added in API level 1
void remove (String key)
Parameters | |
---|---|
key |
String |
removeGpsData
Added in API level 5
void removeGpsData ()
Removes GPS latitude, longitude, altitude, and timestamp from the parameters.删除GPS经度,纬度、海拔高度和时间戳的参数。
set
Added in API level 1
void set (String key, String value)
Sets a String parameter.
Parameters | |
---|---|
key |
String : the key name for the parameter |
value |
String : the String value of the parameter |
set
Added in API level 1
void set (String key, int value)
Sets an integer parameter.
Parameters | |
---|---|
key |
String : the key name for the parameter |
value |
int : the int value of the parameter |
setAntibanding
Added in API level 5
void setAntibanding (String antibanding)
Sets the antibanding.
Parameters | |
---|---|
antibanding |
String : new antibanding value. |
See also:
setAutoExposureLock
Added in API level 14
void setAutoExposureLock (boolean toggle)
Sets the auto-exposure lock state. Applications should check isAutoExposureLockSupported()
before
using this method.
If set to true, the camera auto-exposure routine will immediately pause until the lock is set to false. Exposure compensation settings changes will still take effect while auto-exposure is locked.
If auto-exposure is already locked, setting this to true again has no effect (the driver will not recalculate exposure values).
Stopping preview with stopPreview()
,
or triggering still image capture with takePicture(Camera.ShutterCallback,
, will not change the lock.
Camera.PictureCallback, Camera.PictureCallback)
Exposure compensation, auto-exposure lock, and auto-white balance lock can be used to capture an exposure-bracketed burst of images, for example.
Auto-exposure state, including the lock state, will not be maintained after camera release()
is
called. Locking auto-exposure after open()
but before the first call to startPreview()
will
not allow the auto-exposure routine to run at all, and may result in severely over- or under-exposed images.
Parameters | |
---|---|
toggle |
boolean : new state of the auto-exposure lock. True means that auto-exposure is locked, false means that the auto-exposure routine is free to run normally. |
See also:
setAutoWhiteBalanceLock
Added in API level 14
void setAutoWhiteBalanceLock (boolean toggle)
Sets the auto-white balance lock state. Applications should check isAutoWhiteBalanceLockSupported()
before
using this method.
If set to true, the camera auto-white balance routine will immediately pause until the lock is set to false.
If auto-white balance is already locked, setting this to true again has no effect (the driver will not recalculate white balance values).
Stopping preview with stopPreview()
,
or triggering still image capture with takePicture(Camera.ShutterCallback,
, will not change the the lock.
Camera.PictureCallback, Camera.PictureCallback)
Changing the white balance mode with setWhiteBalance(String)
will
release the auto-white balance lock if it is set.
Exposure compensation, AE lock, and AWB lock can be used to capture an exposure-bracketed burst of images, for example. Auto-white balance state, including the lock state, will not be maintained after camera release()
is
called. Locking auto-white balance after open()
but before the first call tostartPreview()
will
not allow the auto-white balance routine to run at all, and may result in severely incorrect color in captured images.
Parameters | |
---|---|
toggle |
boolean : new state of the auto-white balance lock. True means that auto-white balance is locked, false means that the auto-white balance routine is free to run normally. |
See also:
setColorEffect
Added in API level 5
void setColorEffect (String value)
Sets the current color effect setting.
Parameters | |
---|---|
value |
String : new color effect. |
See also:
setExposureCompensation
Added in API level 8
void setExposureCompensation (int value)
Sets the exposure compensation index.
Parameters | |
---|---|
value |
int : exposure compensation index. The valid value range is from getMinExposureCompensation() (inclusive)to getMaxExposureCompensation() (inclusive).0 means exposure is not adjusted. Application should call getMinExposureCompensation and getMaxExposureCompensation to know if exposure compensation is supported. |
setFlashMode
Added in API level 5
void setFlashMode (String value)
Sets the flash mode.
Parameters | |
---|---|
value |
String : flash mode. |
See also:
setFocusAreas
Added in API level 14
void setFocusAreas (List<Camera.Area> focusAreas)
Sets focus areas. See getFocusAreas()
for
documentation.
Parameters | |
---|---|
focusAreas |
List : the focus areas |
See also:
setFocusMode
Added in API level 5
void setFocusMode (String value)
Sets the focus mode.
Parameters | |
---|---|
value |
String : focus mode. |
See also:
setGpsAltitude
Added in API level 5
void setGpsAltitude (double altitude)
Sets GPS altitude. This will be stored in JPEG EXIF header.
Parameters | |
---|---|
altitude |
double : GPS altitude in meters. |
setGpsLatitude
Added in API level 5
void setGpsLatitude (double latitude)
Sets GPS latitude coordinate. This will be stored in JPEG EXIF header.
Parameters | |
---|---|
latitude |
double : GPS latitude coordinate. |
setGpsLongitude
Added in API level 5
void setGpsLongitude (double longitude)
Sets GPS longitude coordinate. This will be stored in JPEG EXIF header.
Parameters | |
---|---|
longitude |
double : GPS longitude coordinate. |
setGpsProcessingMethod
Added in API level 8
void setGpsProcessingMethod (String processing_method)
Sets GPS processing method. The method will be stored in a UTF-8 string up to 31 bytes long, in the JPEG EXIF header.
Parameters | |
---|---|
processing_method |
String : The processing method to get this location. |
setGpsTimestamp
Added in API level 5
void setGpsTimestamp (long timestamp)
Sets GPS timestamp. This will be stored in JPEG EXIF header.
Parameters | |
---|---|
timestamp |
long : GPS timestamp (UTC in seconds since January 1, 1970). |
setJpegQuality
Added in API level 5
void setJpegQuality (int quality)
Sets Jpeg quality of captured picture.
Parameters | |
---|---|
quality |
int : the JPEG quality of captured picture. The range is 1 to 100, with 100 being the best. |
setJpegThumbnailQuality
Added in API level 5
void setJpegThumbnailQuality (int quality)
Sets the quality of the EXIF thumbnail in Jpeg picture.
Parameters | |
---|---|
quality |
int : the JPEG quality of the EXIF thumbnail. The range is 1 to 100, with 100 being the best. |
setJpegThumbnailSize
Added in API level 5
void setJpegThumbnailSize (int width, int height)
Sets the dimensions for EXIF thumbnail in Jpeg picture. If applications set both width and height to 0, EXIF will not contain thumbnail.
Applications need to consider the display orientation. See setPreviewSize(int,
for reference.
int)
Parameters | |
---|---|
width |
int : the width of the thumbnail, in pixels |
height |
int : the height of the thumbnail, in pixels |
See also:
setMeteringAreas
Added in API level 14
void setMeteringAreas (List<Camera.Area> meteringAreas)
Sets metering areas. See getMeteringAreas()
for
documentation.
Parameters | |
---|---|
meteringAreas |
List : the metering areas |
See also:
setPictureFormat
Added in API level 1
void setPictureFormat (int pixel_format)
Sets the image format for pictures.
Parameters | |
---|---|
pixel_format |
int : the desired picture format (ImageFormat.NV21, ImageFormat.RGB_565, or ImageFormat.JPEG) |
See also:
setPictureSize
Added in API level 1
void setPictureSize (int width, int height)
Sets the dimensions for pictures.
Applications need to consider the display orientation. See setPreviewSize(int,
for reference.
int)
Parameters | |
---|---|
width |
int : the width for pictures, in pixels |
height |
int : the height for pictures, in pixels |
See also:
setPreviewFormat
Added in API level 1
void setPreviewFormat (int pixel_format)
Sets the image format for preview pictures.
If this is never called, the default format will be NV21
,
which uses the NV21 encoding format.
Use getSupportedPreviewFormats()
to
get a list of the available preview formats.
It is strongly recommended that either NV21
or YV12
is
used, since they are supported by all camera devices.
For YV12, the image buffer that is received is not necessarily tightly packed, as there may be padding at the end of each row of pixel data, as described inYV12
.
For camera callback data, it can be assumed that the stride of the Y and UV data is the smallest possible that meets the alignment requirements. That is, if the preview size is width x height, then the following equations describe the buffer index
for the beginning of row y for the Y plane and row c for the U and V planes:
yStride = (int) ceil(width / 16.0) * 16;
uvStride = (int) ceil( (yStride / 2) / 16.0) * 16;
ySize = yStride * height;
uvSize = uvStride * height / 2;
yRowIndex = yStride * y;
uRowIndex = ySize + uvSize + uvStride * c;
vRowIndex = ySize + uvStride * c;
size = ySize + uvSize * 2;
Parameters | |
---|---|
pixel_format |
int : the desired preview picture format, defined by one of the ImageFormat constants.(E.g., ImageFormat.NV21 (default), orImageFormat.YV12) |
See also:
setPreviewFpsRange
Added in API level 9
void setPreviewFpsRange (int min, int max)
Sets the minimum and maximum preview fps. This controls the rate of preview frames received in Camera.PreviewCallback
.
The minimum and maximum preview fps must be one of the elements from getSupportedPreviewFpsRange()
.
Parameters | |
---|---|
min |
int : the minimum preview fps (scaled by 1000). |
max |
int : the maximum preview fps (scaled by 1000). |
Throws | |
---|---|
RuntimeException |
if fps range is invalid. |
See also:
setPreviewFrameRate
Added in API level 1
void setPreviewFrameRate (int fps)
This method was deprecated in API level 9.
replaced by setPreviewFpsRange(int, int)
Sets the rate at which preview frames are received. This is the target frame rate. The actual frame rate depends on the driver.
Parameters | |
---|---|
fps |
int : the frame rate (frames per second) |
setPreviewSize
Added in API level 1
void setPreviewSize (int width, int height)
Sets the dimensions for preview pictures. If the preview has already started, applications should stop the preview first before changing preview size. The sides of width and height are based on camera orientation.
That is, the preview size is the size before it is rotated by display orientation. So applications need to consider the display orientation while setting preview size. For example, suppose the camera supports both 480x320 and 320x480 preview sizes. The application
wants a 3:2 preview ratio. If the display orientation is set to 0 or 180, preview size should be set to 480x320. If the display orientation is set to 90 or 270, preview size should be set to 320x480. The display orientation should also be considered while
setting picture size and thumbnail size.
Parameters | |
---|---|
width |
int : the width of the pictures, in pixels |
height |
int : the height of the pictures, in pixels |
See also:
setDisplayOrientation(int)
getCameraInfo(int,
CameraInfo)setPictureSize(int, int)
setJpegThumbnailSize(int,
int)
setRecordingHint
Added in API level 14
void setRecordingHint (boolean hint)
Sets recording mode hint. This tells the camera that the intent of the application is to record videos start()
,
not to take still picturestakePicture(Camera.ShutterCallback,
. Using this hint can allow MediaRecorder.start() to start faster or with fewer glitches on output. This should be called before starting preview for the best result, but can
Camera.PictureCallback, Camera.PictureCallback, Camera.PictureCallback)
be changed while the preview is active. The default value is false. The app can still call takePicture() when the hint is true or call MediaRecorder.start() when the hint is false. But the performance may be worse.
Parameters | |
---|---|
hint |
boolean : true if the apps intend to record videos using MediaRecorder . |
setRotation
Added in API level 5
void setRotation (int rotation)
Sets the clockwise rotation angle in degrees relative to the orientation of the camera. This affects the pictures returned from JPEGCamera.PictureCallback
.
The camera driver may set orientation in the EXIF header without rotating the picture. Or the driver may rotate the picture and the EXIF thumbnail. If the Jpeg picture is rotated, the orientation in the EXIF header will be missing or 1 (row #0 is top and column
#0 is left side).
If applications want to rotate the picture to match the orientation of what users see, apps should use OrientationEventListener
andCamera.CameraInfo
.
The value from OrientationEventListener is relative to the natural orientation of the device. CameraInfo.orientation is the angle between camera orientation and natural device orientation. The sum of the two is the rotation angle for back-facing camera. The
difference of the two is the rotation angle for front-facing camera. Note that the JPEG pictures of front-facing cameras are not mirrored as in preview display.
For example, suppose the natural orientation of the device is portrait. The device is rotated 270 degrees clockwise, so the device orientation is 270. Suppose a back-facing camera sensor is mounted in landscape
and the top side of the camera sensor is aligned with the right edge of the display in natural orientation. So the camera orientation is 90. The rotation should be set to 0 (270 + 90).
The reference code is as follows.
public void onOrientationChanged(int orientation) { if (orientation == ORIENTATION_UNKNOWN) return; android.hardware.Camera.CameraInfo info = new android.hardware.Camera.CameraInfo(); android.hardware.Camera.getCameraInfo(cameraId, info); orientation = (orientation + 45) / 90 * 90; int rotation = 0; if (info.facing == CameraInfo.CAMERA_FACING_FRONT) { rotation = (info.orientation - orientation + 360) % 360; } else { // back-facing camera rotation = (info.orientation + orientation) % 360; } mParameters.setRotation(rotation); }
Parameters | |
---|---|
rotation |
int : The rotation angle in degrees relative to the orientation of the camera. Rotation can only be 0, 90, 180 or 270. |
Throws | |
---|---|
IllegalArgumentException |
if rotation value is invalid. |
See also:
setSceneMode
Added in API level 5
void setSceneMode (String value)
Sets the scene mode. Changing scene mode may override other parameters (such as flash mode, focus mode, white balance). For example, suppose originally flash mode is on and supported flash modes are on/off. In night
scene mode, both flash mode and supported flash mode may be changed to off. After setting scene mode, applications should call getParameters to know if some parameters are changed.
Parameters | |
---|---|
value |
String : scene mode. |
See also:
setVideoStabilization
Added in API level 15
void setVideoStabilization (boolean toggle)
Enables and disables video stabilization. Use isVideoStabilizationSupported()
to
determine if calling this method is valid.
Video stabilization reduces the shaking due to the motion of the camera in both the preview stream and in recorded videos, including data received from the preview callback. It does not reduce motion blur in images
captured with takePicture
.
Video stabilization can be enabled and disabled while preview or recording is active, but toggling it may cause a jump in the video stream that may be undesirable in a recorded video.
Parameters | |
---|---|
toggle |
boolean : Set to true to enable video stabilization, and false to disable video stabilization. |
See also:
setWhiteBalance
Added in API level 5
void setWhiteBalance (String value)
Sets the white balance. Changing the setting will release the auto-white balance lock. It is recommended not to change white balance and AWB lock at the same time.
Parameters | |
---|---|
value |
String : new white balance. |
See also:
setZoom
Added in API level 8
void setZoom (int value)
Sets current zoom value. If the camera is zoomed (value > 0), the actual picture size may be smaller than picture size setting. Applications can check the actual picture size after picture is returned from Camera.PictureCallback
.
The preview size remains the same in zoom. Applications should checkisZoomSupported()
before
using this method.
Parameters | |
---|---|
value |
int : zoom value. The valid range is 0 to getMaxZoom() . |
unflatten
Added in API level 1
void unflatten (String flattened)
Takes a flattened string of parameters and adds each one to this Parameters object.
The flatten()
method
does the reverse.
Parameters | |
---|---|
flattened |
String : a String of parameters (key-value paired) that are semi-colon delimited |