14. API Reference
This section provides detailed description of ARGear classes.
ARGSession class stores statuses of an application and provides corresponding functions based on the statuses.
Method | Description |
ARGSession(Context context, ARGConfig config) | Create ARGSession according to ARGConfig. |
ARGSession(Context context, ARGConfig config, Set<ARGInferenceConfig.Feature> inference) | Create ARGSession according to ARGConfig and ARGInferenceConfig.Feature. |
auth | Return ARGAuth object. |
contents | Return ARGContents object. |
setCameraConfig | Set camera configuration information. |
applyAdditionalFaceInfo | Send additional information for face detection. |
feedRawData | Update Preview Frame data from camera. |
feedTextureId | Feed texture ID of camera |
drawFrame | Render fed frames from camera along with ARGear contents. |
resume | Start or resume ARGSession. |
pause | Pause ARGSession. |
destroy | Destroy ARGSession. |
setFeatureInference | Set or update ARGInferenceConfig.Feature. |
setDebugInference | Enable or disable ARGInferenceConfig.Debug. |
public ARGSession(Context context, ARGConfig config) |
Create ARGSession according to ARGConfig. ARGConfig contains configuration information for ARGSession and must be provided to create ARGSession. Corresponding information must be set to the variables below. - public String apiUrl; - public String apiKey; - public String secretKey; - public String authKey;
Parameters
Returns
|
public ARGSession(Context context, ARGConfig config, Set<ARGInferenceConfig.Feature> inference) |
Use ARGConfig and ARGInferenceConfig.Feature to create ARGSession. ARGConfig contains configuration information for ARGSession and must be provided to create ARGSession. Corresponding information must be set to the variables below. public String apiUrl; public String apiKey; public String secretKey; public String authKey; ARGInferenceConfig.Feature is a required parameter and can be obtained from ARGFrame. Types of feature inferences are declared as follows. public enum Feature { FACE_LOW_TRACKING, // Machine Learning based TRACKING FACE_HIGH_TRACKING, // Deep Learning based TRACKING (Low polygon) FACE_MESH_TRACKING, // Deep Learning based TRACKING (High polygon) // FACE_BLEND_SHAPES, SEGMENTATION_HALF, // SEGMENTATION_FULL, // HAND_TRACKING, // HAND_LANDMARK_2D, // HAND_LANDMARK_3D, // BODY_TRACKING, // BODY_POSE_2D, // BODY_POSE_3D }
Parameters
Returns
|
public ARGAuth auth() |
Return An Instance of ARGAuth. (Reference : 12.2 ARGAuth)
Returns
|
public ARGContents contents() |
Return An Instance of ARGContents (Reference : 12.6 ARGContents)
Returns
|
public void setCameraConfig(ARGCameraConfig config) |
Set Camera Configuration Information. ARGCameraConfig declares variables as written below. public int previewWidth; public int previewHeight; public float verticalFov; public float horizontalFov; public int orientation; public boolean isFrontFacing; public float fps;
Parameters
|
public void applyAdditionalFaceInfo(List faceVerticesList, List poseMatrixList, float [] projectionMatrix, float [] viewMatrix |
Send additional information for face detection. Parameters
|
public void feedRawData(byte[] data) |
For Camera API 1 Update Preview Frame Data from Camera Device.
Parameters
|
public void feedRawData(Image data) |
For Camera API 2 Update Preview Frame Data from Camera Device.
Parameters
|
public void feedTexture(int textureId, Size textureSize) |
Feed texture ID of a camera
Parameters
|
public ARGFrame drawFrame(GL10 gl, ARGFrame.Ratio ratio, int viewWidth, int viewHeight) |
Render fed frames from camera along with ARGear contents. The function must be called in gl thread environment. Possible screen ratios are described below. public enum Ratio { RATIO_FULL(3), RATIO_4_3(2), RATIO_1_1(1);
public final int code; Ratio(int code) { this.code = code; } }
Parameters
|
public void resume() |
Start or Resume ARGSession. |
public void pause() |
Pause ARGSession. |
public void destroy() |
Destroy ARGSession. |
public void setFeatureInference(Set<ARGInferenceConfig.Feature> config) |
Set or update ARGInferenceConfig.Feature. From ARGFrame, configured information can be retrieved. Types of feature inferences are declared as follows. public enum Feature { FACE_LOW_TRACKING, // Machine Learning based TRACKING FACE_HIGH_TRACKING, // Deep Learning based TRACKING (Low polygon) // FACE_MESH_TRACKING, // Deep Learning based TRACKING (High polygon) // FACE_BLEND_SHAPES, SEGMENTATION_HALF, // SEGMENTATION_FULL, // HAND_TRACKING, // HAND_LANDMARK_2D, // HAND_LANDMARK_3D, // BODY_TRACKING, // BODY_POSE_2D, // BODY_POSE_3D }
Parameters
|
public void setDebugInference(Set<ARGInferenceConfig.Debug> config) |
Enable or Disable ARGInferenceConfig.Debug. Types of feature inferences are declared as below. public enum Debug { NONE(0), FACE_RECT_HW(1 << 0), FACE_RECT_SW(1 << 3), FACE_LANDMARK(1 << 4), FACE_LANDMARK_EXTEND(1 << 5), FACE_AXIES(1 << 6);
public final int code; Debug(int code) { this.code = code; } }
Parameters
|
ARGAuth provides validity check and signed download URL creation functions.
Method | Description |
isValid | Check whether Authentication is valid. |
requestSignedUrl | Convert download URL into signed download URL. |
public boolean isValid() |
Return boolean value to check whether Authentication is valid or not. If Authentication is invalid, ARGear will not work.
Returns
|
public void requestSignedUrl(final String url, final String itemTitle, final String itemType, final ARGAuth.Callback callback) |
Convert download url into signed download url. After signed url request is sent, the result can be obtained by running ARGAuth.Callback function. ARGAuth.Callback is defined as below. public interface Callback { void onSuccess(String url); void onError(Throwable e); } When ARGAuth.Callback succeeds, it passes signed download url to OnSuccess method as its parameter. When it does not, it passes SignedUrlGenerationException or NetworkException to OnError method as its parameters.
Parameters
|
ARGFrame contains both the fed frames from the camera and the rendered ARGear Contents. ARGFrame can be obtained as a result of calling the drawFrame function in ARGSession.
Method | Description |
getTextureId | Return rendered texture id from ARGear. |
getRawData | Return rendered result from ARGear in byte array type. |
getItemTriggerFlag | Return trigger flag value of ARGear Contents in ARGear. |
getFaces | Return the list of ARGFace objects. |
segmentation | Return ARGSegmentation object. |
public int getTextureId() |
Return rendered texture id in ARGear.
Returns
|
public ByteBuffer getRawData(int degree, boolean flipX, boolean flipY) |
Return rendered result from ARGear in byte array type. This method should be called in gl thread environment.
Returns
|
public int getItemTriggerFlag() |
Return trigger flag values of ARGear Contents in ARGear. When a type of trigger flag action is performed by a user, it triggers a corresponding event.
Returns
|
public @Nullable List<ARGFace> getFaces() |
Return a list of ARGFace objects. (Reference : 12.4 ARGFace)
Returns
|
public @Nullable ARGSegmentation segmentation() |
Return ARGSegmentation object. (Reference : 12.5 Segmentation)
Returns
|
ARGFace contains face tracking and detection related information.
Method | Description |
getLandmark | Return 68 point 2d landmark. |
getExtendLandmark | Return 83 point 2d landmark. |
getRotationMatrix | Return rotation matrix. |
getTranslationVector | Return translation vector. |
getTriggerInfo | Return trigger. |
isValid | Return a boolean value by whether face is detected or not. |
public float [] getLandmark() |
Return 68 point 2d landmark. The shape of landmark array is 68 * 2. It contains 68 x and y coordinates in the order of [0] : x1, [1] : y1, [2] : x2, [3] : y2, …, [66] : x68, [67] : y68.
Returns
|
public float [] getExtendLandmark() |
Return 83 point 2d landmark. The shape of landmark array is 83 * 2. It contains 83 x and y coordinates in the order of [0] : x1, [1] : y1, [2] : x2, [3] : y2, …, [82] : x83, [82] : y83.
Returns
|
public double [] getRotationMatrix() |
Return a rotation matrix.
Returns
|[0],[1],[2]| |[3],[4],[5]| |[6],[7],[8]| |
public double [] getTranslationVector() |
Return a translation vector array.
Returns
[0] : x [1] : y [2] : z |
public int [] getTriggerInfo() |
Return trigger related information.
Parameters
Returns
[0] : Left Eye Open (1: opened 0:closed) [1] : Right Eye Open (1: opened 0:closed) [2] : MOUTH(0:closed ~ 100:opened) |
public boolean isValid() |
Check whether face is detected or not.
Returns
|
ARGSegmentation contains the result of segmentation.
Method | Description |
getTextureId | Return texture id of segmentation result. |
public int getTextureId() |
Return texture id of segmentation result.
Returns
|
Apply ARGear contents, beauty, or bulge effects.
Method | Description |
setItem | Set ARGear contents. |
setBeauty | Set face beautification effect. |
setBulge | Set face fun bulge effect. |
setFilterOption | Set a type of filter option (blur, vignetting). |
setFilterLevel | Manipulate level of a filter effect. |
clear | Clear applied contents. |
public void setItem(Type type, String path, String id, ARGContents.Callback callback) |
Set ARGear contents. Two types of contents (ARGContents.Type.ARGItem, ARGContents.Type.FilterItem) can be set. The result callback interface is defined as below. public interface Callback { void onSuccess(); void onError(Throwable e); } For the OnError parameter, InvalidContentsException comes in.
Parameters
|
public void setBeauty(float [] values) |
Set a face beautification effect. The function takes a float array as its input, each element of which indicates a level of face beautification effect of its type. A sample input of a float array is shown below. public float[] beautyValues = { 10, //VLINE 90, //ACE_SLIM 55, //JAW -50, //CHIN 5, //EYE -10, //EYE_GAP 0, //NOSE_LINE 35, //NOSE_SIDE 30, //NOSE_LENGTH -35, //MOUTH_SIZE 0, //EYE_BACK 0, //EYE_CORNER 0, //LIP_SIZE 50, //SKIN 0, //DARK_CIRCLE 0, //MOUTH_WRINKLE }; For the range of the float array, please refer to 9.2 Apply Face Beautification Effect.
Parameters
|
public void setBulge(BulgeType type) |
Apply a face fun bulge effect. The function provides 6 types of face fun bulge effects as shown below. public enum BulgeType { NONE(-1), FUN1(1), FUN2(2), FUN3(3), FUN4(4), FUN5(5), FUN6(6);
public final int code;
BulgeType(int code) { this.code = code; } }
Parameters
|
public void setFilterOption(FilterOption option, boolean flag) |
Apply a type of filter (blur, vignetting). The function provides two types of options and its effect is applied only when a filter content is applied beforehand. public enum FilterOption { BLUR, VIGNETTING }
Parameters
Returns |
public void setFilterLevel(int level) |
The function manipulates a level of a filter effect between 0 and 100. The effect is applied when a filter content is applied beforehand.
Parameters
|
public void clear(Type type) |
Clear applied contents.
Parameters
|
ARGMedia provides photo capture and video recording functions.
Method | Description |
initRecorder | Configure video recording options. |
startRecording | Start video recording. |
stopRecording | Stop video recording. |
updateFrame | Encode rendered texture. |
isRecording | Check whether video recording is going on or not. |
takePicture | Take a picture. |
public void initRecorder(String path, int width, int height, int bitrate, boolean videoOnly, boolean flipV, boolean flipH, Ratio ratio) |
Configure video recording options. The function must be called before recording a video. Three different size of ratios are allowed for recording as shown below. public enum Ratio { RATIO_16_9(0), RATIO_4_3(1), RATIO_1_1(2);
public final int code; Ratio(int code) { this.code = code; } }
Parameters
|
public void startRecording() |
The function starts recording a video. |
public void stopRecording() |
The function stops recording a video. Once stopped, it stores the video in the path set in initRecorder function earlier. |
public void updateFrame(int textureId) |
The function encodes rendered texture. It must be called in a gl thread.
Parameters
|
public boolean isRecording() |
Check whether video recording has been started or not.
Returns
|
Public void takePicture(int textureId, String path, Ratio ratio) |
Take a photo. The function provides three different ratios for photo capture as shown below. public enum Ratio { RATIO_16_9(0), RATIO_4_3(1), RATIO_1_1(2);
public final int code; Ratio(int code) { this.code = code; } } This function must be called in a gl thread environment.
Parameters
|
Last modified 2yr ago