CameraConfig
은 다음을 포함한 기본 카메라 센서의 속성을 설명합니다.
- 카메라 ID
- 가능한 경우 심도 센서 사용 여부
- 카메라가 향하는 방향:
- 전면 (셀카)
- 후면 (월드)
- FPS (초당 프레임 수) 범위
- CPU 이미지 크기
- GPU 텍스처 크기
- 기기의 스테레오 다중 카메라 사용 여부(있는 경우)
새 ARCore 세션을 만들 때 ARCore는 setCameraConfig
을 사용하여 getSupportedCameraConfigs(CameraConfigFilter)
에서 반환한 사용 가능한 구성 목록과 가장 일치하는 카메라 구성을 설정합니다.
앱은 CameraConfigFilter
를 사용하여 앱의 요구사항에 따라 필터링하여 런타임에 특정 기기에서 사용할 수 있는 카메라 구성 범위를 좁힐 수 있습니다.
필터링의 일반적인 사용 사례는 다음과 같습니다.
카메라 캡처 프레임 속도를 30fps로 제한 60fps를 지원하는 기기에서 ARCore는 이 프레임 속도를 지원하는 카메라 구성에 우선순위를 지정합니다. 60fps를 지원하는 모든 카메라 구성을 필터링하려면
TargetFps.TARGET_FPS_30
를 사용하여setTargetFps
로 필터를 적용합니다.Java
// Return only camera configs that target 30 FPS camera capture frame rate. filter.setTargetFps(EnumSet.of(CameraConfig.TargetFps.TARGET_FPS_30));
Kotlin
// Return only camera configs that target 30 FPS camera capture frame rate. filter.targetFps = EnumSet.of(CameraConfig.TargetFps.TARGET_FPS_30)
ARCore가 깊이 센서를 사용하지 못하도록 방지 ARCore는 지원되는 깊이 센서가 있는 기기에서 깊이 센서를 사용하는 카메라 구성을 우선합니다. 깊이 센서를 사용하는 모든 카메라 구성을 필터링하려면
DepthSensorUsage.DO_NOT_USE
를 사용하여setDepthSensorUsage
필터를 적용합니다.Java
// Return only camera configs that will not use the depth sensor. filter.setDepthSensorUsage(EnumSet.of(CameraConfig.DepthSensorUsage.DO_NOT_USE));
Kotlin
// Return only camera configs that will not use the depth sensor. filter.depthSensorUsage = EnumSet.of(CameraConfig.DepthSensorUsage.DO_NOT_USE)
대체 GPU 텍스처 해상도 선택 지원되는 기기에서는 ARCore가 GPU 텍스처 해상도를 추가로 제공할 수 있습니다. 저해상도 GPU 텍스처를 선택하면 GPU 부하를 줄이고 메모리 대역폭 요구사항을 줄여 앱 성능을 개선하는 데 도움이 될 수 있지만 모든 경우에 성능이 개선되는 것은 아닙니다.
카메라 구성 필터 사용
앱에서 카메라 구성을 필터링하도록 사용 설정하려면 다음 단계를 따르세요.
Java
// Create a camera config filter for the session. CameraConfigFilter filter = new CameraConfigFilter(session); // Return only camera configs that target 30 fps camera capture frame rate. filter.setTargetFps(EnumSet.of(CameraConfig.TargetFps.TARGET_FPS_30)); // Return only camera configs that will not use the depth sensor. filter.setDepthSensorUsage(EnumSet.of(CameraConfig.DepthSensorUsage.DO_NOT_USE)); // Get list of configs that match filter settings. // In this case, this list is guaranteed to contain at least one element, // because both TargetFps.TARGET_FPS_30 and DepthSensorUsage.DO_NOT_USE // are supported on all ARCore supported devices. List<CameraConfig> cameraConfigList = session.getSupportedCameraConfigs(filter); // Use element 0 from the list of returned camera configs. This is because // it contains the camera config that best matches the specified filter // settings. session.setCameraConfig(cameraConfigList.get(0));
Kotlin
// Create a camera config filter for the session. val filter = CameraConfigFilter(session) // Return only camera configs that target 30 fps camera capture frame rate. filter.targetFps = EnumSet.of(CameraConfig.TargetFps.TARGET_FPS_30) // Return only camera configs that will not use the depth sensor. filter.depthSensorUsage = EnumSet.of(CameraConfig.DepthSensorUsage.DO_NOT_USE) // Get list of configs that match filter settings. // In this case, this list is guaranteed to contain at least one element, // because both TargetFps.TARGET_FPS_30 and DepthSensorUsage.DO_NOT_USE // are supported on all ARCore supported devices. val cameraConfigList = session.getSupportedCameraConfigs(filter) // Use element 0 from the list of returned camera configs. This is because // it contains the camera config that best matches the specified filter // settings. session.cameraConfig = cameraConfigList[0]
집중 모드
세션 구성에서 포커스 모드를 설정할 수도 있습니다. 고정 초점은 일반적으로 추적에 더 적합하며 대부분의 기기에서 ARCore 기본값입니다. 녹화, 사진, 동영상 촬영을 하거나 주변 피사체에 초점을 맞춰야 할 때 자동 초점이 필요합니다.
자세한 내용은 Config.FocusMode
를 참고하세요.