Android용 증강 얼굴 개발자 가이드
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
앱에서 증강 얼굴 기능을 사용하는 방법을 알아보세요.
기본 요건
기본 AR 개념을 이해합니다.
ARCore 세션을 구성하는 방법을 알아보세요.
Android에서 증강 얼굴 사용하기
- ARCore 세션 구성
- 감지된 얼굴에 액세스하기
기존 ARCore 세션에서 전면 카메라를 선택하여 증강 얼굴 사용을 시작합니다. 참고: 전면 카메라를 선택하면
다양한 변경사항이
ARCore 동작에 영향을 줍니다.
자바
// Set a camera configuration that usese the front-facing camera.
CameraConfigFilter filter =
new CameraConfigFilter(session).setFacingDirection(CameraConfig.FacingDirection.FRONT);
CameraConfig cameraConfig = session.getSupportedCameraConfigs(filter).get(0);
session.setCameraConfig(cameraConfig);
Kotlin
// Set a camera configuration that usese the front-facing camera.
val filter = CameraConfigFilter(session).setFacingDirection(CameraConfig.FacingDirection.FRONT)
val cameraConfig = session.getSupportedCameraConfigs(filter)[0]
session.cameraConfig = cameraConfig
AugmentedFaceMode
를 사용 설정합니다.
자바
Config config = new Config(session);
config.setAugmentedFaceMode(Config.AugmentedFaceMode.MESH3D);
session.configure(config);
Kotlin
val config = Config(session)
config.augmentedFaceMode = Config.AugmentedFaceMode.MESH3D
session.configure(config)
얼굴 메시 방향
페이스 메시의 방향에 유의하세요.
![]()
감지된 얼굴에 액세스
Trackable
가져오기
확인할 수 있습니다 Trackable
는 ARCore가 추적할 수 있는 항목이며
앵커를 연결할 수 있습니다.
자바
// ARCore's face detection works best on upright faces, relative to gravity.
Collection<AugmentedFace> faces = session.getAllTrackables(AugmentedFace.class);
Kotlin
// ARCore's face detection works best on upright faces, relative to gravity.
val faces = session.getAllTrackables(AugmentedFace::class.java)
TrackingState
다운로드
(각 Trackable
). TRACKING
인 경우
현재 ARCore에서 그 포즈를 알고 있습니다.
자바
for (AugmentedFace face : faces) {
if (face.getTrackingState() == TrackingState.TRACKING) {
// UVs and indices can be cached as they do not change during the session.
FloatBuffer uvs = face.getMeshTextureCoordinates();
ShortBuffer indices = face.getMeshTriangleIndices();
// Center and region poses, mesh vertices, and normals are updated each frame.
Pose facePose = face.getCenterPose();
FloatBuffer faceVertices = face.getMeshVertices();
FloatBuffer faceNormals = face.getMeshNormals();
// Render the face using these values with OpenGL.
}
}
Kotlin
faces.forEach { face ->
if (face.trackingState == TrackingState.TRACKING) {
// UVs and indices can be cached as they do not change during the session.
val uvs = face.meshTextureCoordinates
val indices = face.meshTriangleIndices
// Center and region poses, mesh vertices, and normals are updated each frame.
val facePose = face.centerPose
val faceVertices = face.meshVertices
val faceNormals = face.meshNormals
// Render the face using these values with OpenGL.
}
}
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-07-26(UTC)
[null,null,["최종 업데이트: 2025-07-26(UTC)"],[[["\u003cp\u003eThis guide explains how to integrate the Augmented Faces feature into your Android applications for real-time face tracking and augmentation.\u003c/p\u003e\n"],["\u003cp\u003eBefore starting, ensure you have a foundational understanding of AR concepts and ARCore session configuration.\u003c/p\u003e\n"],["\u003cp\u003eTo use Augmented Faces, configure your ARCore session to utilize the front-facing camera and enable the AugmentedFaceMode.\u003c/p\u003e\n"],["\u003cp\u003eAccess and track detected faces by obtaining a Trackable object for each frame and checking its TrackingState.\u003c/p\u003e\n"],["\u003cp\u003eOnce a face is tracked, you can access its pose, mesh data (vertices, normals, UVs, indices), and use them for rendering and augmentation.\u003c/p\u003e\n"]]],["To use Augmented Faces, first configure the ARCore session to use the front camera and enable `AugmentedFaceMode` with `MESH3D`. Then, access the detected face via `getAllTrackables`, ensuring the `TrackingState` is `TRACKING`. Retrieve and cache face mesh UVs and indices. Each frame, update center/region poses, mesh vertices, and normals to render the face, using provided examples in Java and Kotlin.\n"],null,["# Augmented Faces developer guide for Android\n\nLearn how to use the Augmented Faces feature in your own apps.\n\nPrerequisites\n-------------\n\nMake sure that you understand [fundamental AR concepts](/ar/develop/fundamentals)\nand how to [configure an ARCore session](/ar/develop/java/session-config) before proceeding.\n\nUsing Augmented Faces in Android\n--------------------------------\n\n1. [Configure the ARCore session](#configure-session)\n2. [Get access to the detected face](#face-access)\n\n### Configure the ARCore session\n\nSelect the front camera in an existing ARCore session to start using Augmented Faces. Note that selecting the front camera\nwill cause a number of [changes](/ar/reference/java/com/google/ar/core/CameraConfig.FacingDirection#front)\nin ARCore behavior. \n\n### Java\n\n```java\n// Set a camera configuration that usese the front-facing camera.\nCameraConfigFilter filter =\n new CameraConfigFilter(session).setFacingDirection(CameraConfig.FacingDirection.FRONT);\nCameraConfig cameraConfig = session.getSupportedCameraConfigs(filter).get(0);\nsession.setCameraConfig(cameraConfig);\n```\n\n### Kotlin\n\n```kotlin\n// Set a camera configuration that usese the front-facing camera.\nval filter = CameraConfigFilter(session).setFacingDirection(CameraConfig.FacingDirection.FRONT)\nval cameraConfig = session.getSupportedCameraConfigs(filter)[0]\nsession.cameraConfig = cameraConfig\n```\n\nEnable [`AugmentedFaceMode`](/ar/reference/java/com/google/ar/core/Config.AugmentedFaceMode): \n\n### Java\n\n```java\nConfig config = new Config(session);\nconfig.setAugmentedFaceMode(Config.AugmentedFaceMode.MESH3D);\nsession.configure(config);\n```\n\n### Kotlin\n\n```kotlin\nval config = Config(session)\nconfig.augmentedFaceMode = Config.AugmentedFaceMode.MESH3D\nsession.configure(config)\n```\n\n### Face mesh orientation\n\nNote the orientation of the face mesh:\n\n### Access the detected face\n\nGet a [`Trackable`](/ar/reference/java/com/google/ar/core/Trackable)\nfor each frame. A `Trackable` is something that ARCore can track and that\nAnchors can be attached to. \n\n### Java\n\n```java\n// ARCore's face detection works best on upright faces, relative to gravity.\nCollection\u003cAugmentedFace\u003e faces = session.getAllTrackables(AugmentedFace.class);\n```\n\n### Kotlin\n\n```kotlin\n// ARCore's face detection works best on upright faces, relative to gravity.\nval faces = session.getAllTrackables(AugmentedFace::class.java)\n```\n\nGet the [`TrackingState`](/ar/reference/java/com/google/ar/core/TrackingState)\nfor each `Trackable`. If it is [`TRACKING`](/ar/reference/java/com/google/ar/core/TrackingState#tracking),\nthen its pose is currently known by ARCore. \n\n### Java\n\n```java\nfor (AugmentedFace face : faces) {\n if (face.getTrackingState() == TrackingState.TRACKING) {\n // UVs and indices can be cached as they do not change during the session.\n FloatBuffer uvs = face.getMeshTextureCoordinates();\n ShortBuffer indices = face.getMeshTriangleIndices();\n // Center and region poses, mesh vertices, and normals are updated each frame.\n Pose facePose = face.getCenterPose();\n FloatBuffer faceVertices = face.getMeshVertices();\n FloatBuffer faceNormals = face.getMeshNormals();\n // Render the face using these values with OpenGL.\n }\n}\n```\n\n### Kotlin\n\n```kotlin\nfaces.forEach { face -\u003e\n if (face.trackingState == TrackingState.TRACKING) {\n // UVs and indices can be cached as they do not change during the session.\n val uvs = face.meshTextureCoordinates\n val indices = face.meshTriangleIndices\n // Center and region poses, mesh vertices, and normals are updated each frame.\n val facePose = face.centerPose\n val faceVertices = face.meshVertices\n val faceNormals = face.meshNormals\n // Render the face using these values with OpenGL.\n }\n}\n```"]]