public interface AliyunICameraCapture extends AliyunIBaseCapture
Modifier and Type | Method and Description |
---|---|
int |
addImage(EffectImage effectImage)
Adds a image.
|
int |
addPaster(EffectPaster effectPaster)
Adds a face sticker.
|
int |
addPaster(EffectPaster effectPaster,
float sx,
float sy,
float sw,
float sh,
float rotation,
boolean flip)
Adds a sticker.
|
int |
applyAnimationFilter(EffectFilter effectFilter)
Applies an animated filter.
|
int |
applyFilter(EffectFilter effectFilter)
Applies a filter.
|
int |
getBeautyLevel()
Gets the beauty level.
|
int |
getCameraCount()
Gets the number of cameras.
|
float |
getCurrentExposureCompensationRatio()
Gets the current exposure level.
|
java.util.List<Camera.Size> |
getSupportedPictureSize()
Gets the picture sizes supported by the camera.
|
java.util.SortedSet<Size> |
getSupportedPictureSizes() |
void |
needFaceTrackInternal(boolean need)
Sets whether to enable facial recognition.
|
void |
removeAnimationFilter(EffectFilter effectFilter)
Removes an animated filter.
|
void |
removeFilter()
Remove the filter.
|
void |
removeImage(EffectImage effectImage)
Removes a image.
|
void |
removePaster(EffectPaster effectPaster)
Removes a sticker.
|
int |
resizePreviewSize(int width,
int height)
Sets the size of the surface view.
|
void |
setAutoPreviewAfterTakePhoto(boolean autoPreviewAfterTakePhoto)
Sets whether to start preview after taking a picture.
|
void |
setBeautyLevel(int level)
Sets the beauty level.
|
void |
setBeautyStatus(boolean on)
Enables or disables beauty mode.
|
void |
setCamera(CameraType camera)
Sets the camera during preview.
|
void |
setCameraCaptureDataMode(int captureDataMode)
Sets the data capture method during preview.
|
void |
setCameraParam(CameraParam cameraParam)
Sets camera parameters during preview.
|
void |
setDisplayView(SurfaceView displayView)
Sets the
SurfaceView during preview. |
int |
setEffectView(float xRatio,
float yRatio,
float widthRatio,
float heightRatio,
EffectBase effectBase)
Sets sticker parameters, such as the position and size of the sticker.
|
int |
setExposureCompensationRatio(float value)
Sets the exposure level.
|
void |
setFaceDetectRotation(int rotation)
Sets the rotation angle of the gyro sensor when performing facial recognition.
|
int |
setFaces(float[][] faces)
Sets the coordinate points to define faces.
|
void |
setFaceTrackInternalMaxFaceCount(int maxFaceCount)
Sets the maximum number of faces that can be recognized at the same time.
|
int |
setFaceTrackInternalModelPath(java.lang.String path)
Sets the path to facial recognition models.
|
void |
setFocus(float xRatio,
float yRatio)
Sets the focus point.
|
void |
setFocus(Point point)
Deprecated.
|
void |
setFocusMode(int mode)
Sets the focus mode.
|
boolean |
setLight(FlashType flashType)
Sets the flash mode.
|
void |
setOnChoosePictureSizeCallBack(OnChoosePictureSizeCallback callback)
Sets the callback that outputs the image resolution.
|
void |
setOnFaceDetectInfoListener(OnFaceDetectInfoListener listener)
Sets the callback that outputs facial recognition data.
|
void |
setOnFrameCallback(OnFrameCallback callback)
Sets the callback that outputs frame data.
|
void |
setOnTextureIdCallback(OnTextureIdCallback callback)
Sets the callback that outputs the texture on every frame.
|
void |
setOutputFlip(boolean flip)
Use this method to flip the camera recording output.
|
int |
setPictureSize(int width,
int height)
Sets the picture size.
|
void |
setRecordRotation(int rotation)
Sets the rotation angle of the gyro sensor during recording.
|
void |
setRotation(int rotation)
Sets the rotation angle of the gyro sensor.
|
void |
setShutterSound(boolean bNeedShutterSound)
Sets whether to turn on the shutter sound.
|
int |
setZoom(float rate)
Sets the zoom level.
|
void |
snapshot(boolean needBitmap,
OnPictureCallback pictureCallback)
Camera preview snapshot, include effects.
|
int |
startPreviewAfterTakePicture()
Use this method to start preview after taking a picture.
|
int |
switchCamera()
Switches cameras.
|
FlashType |
switchLight()
Switches flash modes.
|
void |
takePhoto(boolean needBitmap,
OnPictureCallback pictureCallback)
Takes a picture by system camera, no effects.
|
int |
updateAnimationFilter(EffectFilter effectFilter)
update an animated filter.
|
captureId, removeBorder, setBorderParam, setProperty, updateLayout
void setCamera(CameraType camera)
switchCamera()
to switch cameras.camera
- CameraType.BACK
,
CameraType.FRONT
void setDisplayView(SurfaceView displayView)
SurfaceView
during preview.displayView
- void setCameraCaptureDataMode(int captureDataMode)
captureDataMode
- CameraCaptureDataMode
int addPaster(EffectPaster effectPaster)
setRotation(int)
must be invoked to add face stickers. For details about calculating the rotation parameter, see the demo.
Use this method to add face stickers only. To add other stickers, call addPaster(EffectPaster, float, float, float, float, float, boolean)
.effectPaster
- EffectPaster
int addPaster(EffectPaster effectPaster, float sx, float sy, float sw, float sh, float rotation, boolean flip)
setEffectView(float, float, float, float, EffectBase)
and this method can be used to add multiple effects.effectPaster
- sx
- The x coordinate of the sticker relative to the video resolution.sy
- The x coordinate of the sticker relative to the video resolution.sw
- The width of the sticker relative to the video resolution.sh
- The height of the sticker relative to the video resolution.rotation
- The rotation angle of the sticker.flip
- Whether to flip the sticker.setEffectView(float, float, float, float, EffectBase)
void removePaster(EffectPaster effectPaster)
effectPaster
- int addImage(EffectImage effectImage)
setEffectView(float, float, float, float, EffectBase)
to adjust the position of the image.effectImage
- void removeImage(EffectImage effectImage)
effectImage
- int applyFilter(EffectFilter effectFilter)
effectFilter
- void removeFilter()
int applyAnimationFilter(EffectFilter effectFilter)
EffectFilter.Builder
to create the filter object.effectFilter
- int updateAnimationFilter(EffectFilter effectFilter)
EffectFilter.Builder
to create the filter object.effectFilter
- void removeAnimationFilter(EffectFilter effectFilter)
effectFilter
- int getCameraCount()
void setCameraParam(CameraParam cameraParam)
cameraParam
- CameraParam
int switchCamera()
FlashType switchLight()
FlashType.AUTO
,
FlashType.OFF
,
FlashType.ON
boolean setLight(FlashType flashType)
flashType
- int setZoom(float rate)
rate
- int setExposureCompensationRatio(float value)
value
- void setFocusMode(int mode)
mode
- CameraParam.FOCUS_MODE_CONTINUE
,
CameraParam.FOCUS_MODE_AUTO
@Deprecated void setFocus(Point point)
setFocus(float xRatio, float yRatio)
Sets the focus point.point
- void setFocus(float xRatio, float yRatio)
setFocusMode(int)
is set to CameraParam.FOCUS_MODE_AUTO
.xRatio
- The x coordinate of the focus point relative to the surface view.yRatio
- The y coordinate of the focus point relative to the surface view.int getBeautyLevel()
void setBeautyLevel(int level)
level
- Valid values: [0, 100]. A value of 0 indicates disable beauty mode.void setBeautyStatus(boolean on)
on
- A value of true indicates enable beauty mode. A value of false indicates disable beauty mode.int setEffectView(float xRatio, float yRatio, float widthRatio, float heightRatio, EffectBase effectBase)
xRatio
- The x coordinate of the sticker relative to the video resolution.yRatio
- The y coordinate of the sticker relative to the video resolution.widthRatio
- The width of the sticker relative to the video resolution.heightRatio
- The height of the sticker relative to the video resolution.effectBase
- The sticker.void setOnFrameCallback(OnFrameCallback callback)
callback
- OnFrameCallback
void setOnChoosePictureSizeCallBack(OnChoosePictureSizeCallback callback)
callback
- int setFaces(float[][] faces)
faces
- Represented by a 2D array of size N*6.
point[i][0] => LEFT_EYE_X
point[i][1] => LEFT_EYE_Y
point[i][2] => RIGHT_EYE_X
point[i][3] => RIGHT_EYE_Y
point[i][4] => MOUTH_X
point[i][5] => MOUTH_Y
The above example defines the six features of face i.void setRotation(int rotation)
private int getSensorRotation() { int orientation = orientationDetector.getOrientation(); int rotation = 90; if (orientation >= 45 && orientation < 135) { rotation = 180; } if (orientation >= 135 && orientation < 225) { rotation = 270; } if (orientation >= 225 && orientation < 315) { rotation = 0; } if (mCameraType == CameraType.FRONT) { if (rotation != 0) { rotation = 360 - rotation; } } return rotation; }
rotation
- Do not use this method to control the angle when performing facial recognition or recording.setFaceDetectRotation(int)
,
setRecordRotation(int)
void setFaceDetectRotation(int rotation)
setRecordRotation(int)
,
setRotation(int)
void setRecordRotation(int rotation)
setRotation(int)
,
setFaceDetectRotation(int)
void setOnTextureIdCallback(OnTextureIdCallback callback)
callback
- OnTextureIdCallback
void setOnFaceDetectInfoListener(OnFaceDetectInfoListener listener)
OnFaceDetectInfoListener.onFaceInfoChange(FaceDetectInfo)
is invoked when changes in facial recognition data are detected.listener
- float getCurrentExposureCompensationRatio()
void takePhoto(boolean needBitmap, OnPictureCallback pictureCallback)
OnPictureCallback#onPicture(byte[])
to return byte array data,
call OnPictureCallback.onPicture(Bitmap)
to return the bitmap if need.needBitmap
- Whether to generate a bitmap image.pictureCallback
- Callback to return datavoid snapshot(boolean needBitmap, OnPictureCallback pictureCallback)
OnPictureCallback#onPicture(byte[])
to return byte array data,
call OnPictureCallback.onPicture(Bitmap)
to return the bitmap if need.needBitmap
- Whether to generate a bitmap image.pictureCallback
- Callback to return datavoid needFaceTrackInternal(boolean need)
need
- int setFaceTrackInternalModelPath(java.lang.String path)
path
- AliyunErrorCode.OK
if the invocation is successful.
AliyunErrorCode.ERROR_INVALID_ARGUMENTS
if the invocation fails, the path is invalid, or the model files are damaged.void setFaceTrackInternalMaxFaceCount(int maxFaceCount)
maxFaceCount
- void setShutterSound(boolean bNeedShutterSound)
bNeedShutterSound
- true indicates turn on the shutter sound. false indicates turn off the shutter sound.
Default value: true.void setAutoPreviewAfterTakePhoto(boolean autoPreviewAfterTakePhoto)
autoPreviewAfterTakePhoto
- true indicates start preview. false indicates load the newly taken picture on the screen.
Default value: true.takePhoto(boolean, OnPictureCallback)
java.util.List<Camera.Size> getSupportedPictureSize()
java.util.SortedSet<Size> getSupportedPictureSizes()
int setPictureSize(int width, int height)
width
- height
- int startPreviewAfterTakePicture()
setAutoPreviewAfterTakePhoto(boolean)
int resizePreviewSize(int width, int height)
width
- The width of the surface view.height
- The height of the surface view.void setOutputFlip(boolean flip)
flip
- is need flip