카메라 구성하기

CameraConfig는 기본 카메라 센서:

  • 카메라 ID
  • 가능한 경우 심도 센서 사용 여부
  • 카메라가 향하는 방향: <ph type="x-smartling-placeholder">
      </ph>
    • 전면 (셀카)
    • 후면 (전 세계)
  • FPS (초당 프레임 수) 범위
  • CPU 이미지 크기
  • GPU 텍스처 크기
  • 있는 경우 기기의 스테레오 멀티 카메라를 사용할지 여부입니다.

새 ARCore 세션을 만들 때 ARCore에서는 setCameraConfig: 카메라 구성을 설정합니다. 포드에서 반환한 사용 가능한 구성 목록과 가장 getSupportedCameraConfigs(CameraConfigFilter) 앱에서 CameraConfigFilter를 사용할 수 있음 런타임 시 특정 기기에 사용 가능한 카메라 구성의 범위를 앱 요구사항에 맞게 필터링할 수 있습니다

필터링의 일반적인 사용 사례는 다음과 같습니다.

  • 카메라 캡처 프레임 속도를 30fps로 제한. 다음을 지원하는 기기 ARCore는 60fps를 지원하는 카메라 구성에 우선순위를 두고 있으며 지정할 수도 있습니다 60fps를 지원하는 모든 카메라 구성을 필터링하려면 setTargetFps 필터를 적용합니다. (TargetFps.TARGET_FPS_30 사용)

    자바

    // 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가 깊이 센서를 지원함, ARCore가 깊이를 사용하는 카메라 구성에 우선순위를 둠 센서에 있습니다. 심도 센서를 사용하는 모든 카메라 구성을 필터링하려면 setDepthSensorUsage 드림 DepthSensorUsage.DO_NOT_USE를 사용하여 필터링합니다.

    자바

    // 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 부하를 줄이고 메모리를 줄여 앱 성능을 개선하는 데 도움이 될 수 있습니다. 100% 업타임 체크의 성능을 향상하지 않을 수도 있지만 발생할 수 있습니다.

카메라 구성 필터 사용

앱에서 카메라 구성을 필터링하도록 사용 설정하려면 다음 단계를 따르세요.

자바

// 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를 참고하세요. 참조하세요.