[null,null,["最后更新时间 (UTC):2025-07-26。"],[[["\u003cp\u003e\u003ccode\u003eCameraConfig\u003c/code\u003e describes the properties of the underlying camera sensor used by ARCore, such as camera ID, depth sensor usage, facing direction, FPS range, and dimensions.\u003c/p\u003e\n"],["\u003cp\u003eARCore automatically selects the best camera configuration but allows developers to filter these configurations based on specific needs like limiting frame rate or disabling depth sensor usage.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can use \u003ccode\u003eCameraConfigFilter\u003c/code\u003e to narrow down the available camera configurations by filtering based on criteria like target FPS and depth sensor usage.\u003c/p\u003e\n"],["\u003cp\u003eWhile ARCore prioritizes higher frame rates and depth sensor usage by default, developers can modify these preferences using the provided filtering mechanisms.\u003c/p\u003e\n"],["\u003cp\u003eFocus mode can also be adjusted in the session configuration, with fixed focus generally preferred for tracking and auto focus required for recording or focusing on nearby objects.\u003c/p\u003e\n"]]],[],null,["# Configuring the camera\n\n| **Key Point:** To configure additional custom GPU textures, use the (Java) [shared camera](/ar/develop/java/camera-sharing) feature.\n\n[`CameraConfig`](/ar/reference/java/com/google/ar/core/CameraConfig) describes the properties of the\nunderlying camera sensor, including:\n\n- The camera ID\n- If available, whether a depth sensor will be used\n- The direction the camera is facing:\n - front-facing (selfie)\n - rear-facing (world)\n- FPS (frames per second) range\n- CPU image dimensions\n- GPU texture dimension\n- If present, whether the device's [stereo multi-camera](https://source.android.com/devices/camera/multi-camera) will be used\n\nWhen creating a new ARCore session, ARCore uses\n[`setCameraConfig`](/ar/reference/java/com/google/ar/core/Session#setCameraConfig(com.google.ar.core.CameraConfig)) to set the camera config\nthat best matches the list of available configs returned by\n[`getSupportedCameraConfigs(CameraConfigFilter)`](/ar/reference/java/com/google/ar/core/Session#getSupportedCameraConfigs(com.google.ar.core.CameraConfigFilter)).\nYour app can use [`CameraConfigFilter`](/ar/reference/java/com/google/ar/core/CameraConfigFilter)\nto narrow down the available camera configs for a given device at runtime by\nfiltering based on your app's needs.\n\nCommon use cases for filtering include:\n\n- **Limiting camera capture frame rate to 30 fps** . On devices that support\n 60 fps, ARCore will prioritize camera configs that support that\n frame rate. To filter out all camera configs that support 60 fps,\n apply a filter with [`setTargetFps`](/ar/reference/java/com/google/ar/core/CameraConfigFilter#setTargetFps(java.util.EnumSet\u003ccom.google.ar.core.CameraConfig.TargetFps\u003e))\n using `TargetFps.TARGET_FPS_30`.\n\n\n ### Java\n\n ```java\n // Return only camera configs that target 30 FPS camera capture frame rate.\n filter.setTargetFps(EnumSet.of(CameraConfig.TargetFps.TARGET_FPS_30));\n ```\n\n ### Kotlin\n\n ```kotlin\n // Return only camera configs that target 30 FPS camera capture frame rate.\n filter.targetFps = EnumSet.of(CameraConfig.TargetFps.TARGET_FPS_30)\n ```\n\n \u003cbr /\u003e\n\n \u003cbr /\u003e\n\n- **Prevent ARCore from using the depth sensor** . On devices that have a\n supported depth sensor, ARCore prioritizes camera configs that use the depth\n sensor. To filter out all camera configs that use the depth sensor, apply the\n [`setDepthSensorUsage`](/ar/reference/java/com/google/ar/core/CameraConfigFilter#setDepthSensorUsage(java.util.EnumSet\u003ccom.google.ar.core.CameraConfig.DepthSensorUsage\u003e))\n filter using `DepthSensorUsage.DO_NOT_USE`.\n\n\n ### Java\n\n ```java\n // Return only camera configs that will not use the depth sensor.\n filter.setDepthSensorUsage(EnumSet.of(CameraConfig.DepthSensorUsage.DO_NOT_USE));\n ```\n\n ### Kotlin\n\n ```kotlin\n // Return only camera configs that will not use the depth sensor.\n filter.depthSensorUsage = EnumSet.of(CameraConfig.DepthSensorUsage.DO_NOT_USE)\n ```\n\n \u003cbr /\u003e\n\n \u003cbr /\u003e\n\n- **Selecting an alternate GPU texture resolution** . On\n [supported devices](/ar/discover/supported-devices), ARCore may provide\n additional GPU texture resolutions. Selecting a lower resolution GPU texture\n may help improve app performance by reducing GPU load and lowering memory\n bandwidth requirements, although is not guaranteed to improve performance in\n all cases.\n\nUsing camera config filters\n---------------------------\n\nFollow these steps to enable your app to filter camera configs. \n\n### Java\n\n```java\n// Create a camera config filter for the session.\nCameraConfigFilter filter = new CameraConfigFilter(session);\n\n// Return only camera configs that target 30 fps camera capture frame rate.\nfilter.setTargetFps(EnumSet.of(CameraConfig.TargetFps.TARGET_FPS_30));\n\n// Return only camera configs that will not use the depth sensor.\nfilter.setDepthSensorUsage(EnumSet.of(CameraConfig.DepthSensorUsage.DO_NOT_USE));\n\n// Get list of configs that match filter settings.\n// In this case, this list is guaranteed to contain at least one element,\n// because both TargetFps.TARGET_FPS_30 and DepthSensorUsage.DO_NOT_USE\n// are supported on all ARCore supported devices.\nList\u003cCameraConfig\u003e cameraConfigList = session.getSupportedCameraConfigs(filter);\n\n// Use element 0 from the list of returned camera configs. This is because\n// it contains the camera config that best matches the specified filter\n// settings.\nsession.setCameraConfig(cameraConfigList.get(0));\n```\n\n### Kotlin\n\n```kotlin\n// Create a camera config filter for the session.\nval filter = CameraConfigFilter(session)\n\n// Return only camera configs that target 30 fps camera capture frame rate.\nfilter.targetFps = EnumSet.of(CameraConfig.TargetFps.TARGET_FPS_30)\n\n// Return only camera configs that will not use the depth sensor.\nfilter.depthSensorUsage = EnumSet.of(CameraConfig.DepthSensorUsage.DO_NOT_USE)\n\n// Get list of configs that match filter settings.\n// In this case, this list is guaranteed to contain at least one element,\n// because both TargetFps.TARGET_FPS_30 and DepthSensorUsage.DO_NOT_USE\n// are supported on all ARCore supported devices.\nval cameraConfigList = session.getSupportedCameraConfigs(filter)\n\n// Use element 0 from the list of returned camera configs. This is because\n// it contains the camera config that best matches the specified filter\n// settings.\nsession.cameraConfig = cameraConfigList[0]\n```\n\nFocus mode\n----------\n\nYou can also set the focus mode in the session configuration. Fixed focus is generally better for tracking (and is the ARCore default on most devices).\nAuto focus is required for recording, photography, videography, and when nearby objects need to be in focus.\n\nSee [`Config.FocusMode`](/ar/reference/java/com/google/ar/core/Config.FocusMode)\nfor details."]]