// Return only camera configs that target 30 FPS camera capture frame// rate.ArCameraConfigFilter_setTargetFps(session,filter,AR_CAMERA_CONFIG_TARGET_FPS_30);
// Create an ARCore session.ArSession*session;ArSession_create(env,context,&session);// Create a camera config list and filter for the session.ArCameraConfig*selected_config;ArCameraConfigList*configs;ArCameraConfigFilter*filter;ArCameraConfig_create(session,&selected_config);ArCameraConfigList_create(session,&configs);ArCameraConfigFilter_create(session,&filter);// Return only camera configs that target 30 fps camera capture frame rate.ArCameraConfigFilter_setTargetFps(session,filter,AR_CAMERA_CONFIG_TARGET_FPS_30);// Return only camera configs that will not use the depth sensor.ArCameraConfigFilter_setDepthSensorUsage(session,filter,AR_CAMERA_CONFIG_DEPTH_SENSOR_USAGE_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.ArSession_getSupportedCameraConfigsWithFilter(session,filter,configs);// 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.ArCameraConfigList_getItem(session,configs,0,selected_config);// Set the camera config to use selected_config.ArSession_setCameraConfig(session,selected_config);// Free memory.ArCameraConfigFilter_destroy(filter);ArCameraConfigList_destroy(configs);
[null,null,["最后更新时间 (UTC):2025-07-26。"],[[["\u003cp\u003e\u003ccode\u003eArCameraConfig\u003c/code\u003e allows developers to control camera properties like ID, depth sensor usage, direction, FPS, and dimensions.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can filter available camera configurations based on their app's needs, such as limiting frame rate or disabling the depth sensor.\u003c/p\u003e\n"],["\u003cp\u003eARCore prioritizes camera configs with 60 fps and depth sensor usage, but developers can override these defaults using filters.\u003c/p\u003e\n"],["\u003cp\u003eSelecting a lower GPU texture resolution can potentially improve app performance by reducing GPU load, but it's not always guaranteed.\u003c/p\u003e\n"],["\u003cp\u003eThe focus mode can be set to either fixed (better for tracking) or auto (required for recording and 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[`ArCameraConfig`](/ar/reference/c/group/cameraconfig#arcameraconfig) 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[`ArSession_setCameraConfig()`](/ar/reference/c/group/session#arsession_setcameraconfig) to set the camera config\nthat best matches the list of available configs returned by\n[`ArSession_getSupportedCameraConfigsWithFilter()`](/ar/reference/c/group/session#arsession_getsupportedcameraconfigswithfilter).\nYour app can use [`ArCameraConfigFilter`](/ar/reference/c/group/session#arsession_getsupportedcameraconfigswithfilter)\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 [`ArCameraConfigFilter_setTargetFps()`](/ar/reference/c/group/cameraconfig#arcameraconfigtargetfps)\n using `AR_CAMERA_CONFIG_TARGET_FPS_30`.\n\n \u003cbr /\u003e\n\n\n ```c\n // Return only camera configs that target 30 FPS camera capture frame\n // rate.\n ArCameraConfigFilter_setTargetFps(session, filter,\n AR_CAMERA_CONFIG_TARGET_FPS_30);\n ```\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 [`ArCameraConfigFilter_setDepthSensorUsage()`](/ar/reference/c/group/cameraconfig#arcameraconfigdepthsensorusage)\n filter using `AR_CAMERA_CONFIG_DEPTH_SENSOR_USAGE_DO_NOT_USE`.\n\n \u003cbr /\u003e\n\n\n ```c\n ArCameraConfigFilter_setDepthSensorUsage(\n session, filter, AR_CAMERA_CONFIG_DEPTH_SENSOR_USAGE_DO_NOT_USE);\n ```\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```c\n// Create an ARCore session.\nArSession* session;\nArSession_create(env, context, &session);\n\n// Create a camera config list and filter for the session.\nArCameraConfig* selected_config;\nArCameraConfigList* configs;\nArCameraConfigFilter* filter;\nArCameraConfig_create(session, &selected_config);\nArCameraConfigList_create(session, &configs);\nArCameraConfigFilter_create(session, &filter);\n\n// Return only camera configs that target 30 fps camera capture frame rate.\nArCameraConfigFilter_setTargetFps(session, filter,\n AR_CAMERA_CONFIG_TARGET_FPS_30);\n\n// Return only camera configs that will not use the depth sensor.\nArCameraConfigFilter_setDepthSensorUsage(\n session, filter, AR_CAMERA_CONFIG_DEPTH_SENSOR_USAGE_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.\nArSession_getSupportedCameraConfigsWithFilter(session, filter, configs);\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.\nArCameraConfigList_getItem(session, configs, 0, selected_config);\n\n// Set the camera config to use selected_config.\nArSession_setCameraConfig(session, selected_config);\n\n// Free memory.\nArCameraConfigFilter_destroy(filter);\nArCameraConfigList_destroy(configs);\n```\n\nFocus mode\n----------\n\nYou can also set the focus mode in the session config. Fixed focus is generally better for tracking (and is the ARCore default on most devices). Auto focus is required for recording, photography, videography, and when nearby objects need\nto be in focus.\n\nSee\n[`ArConfig_setFocusMode()`](/ar/reference/c/group/ar-config#arconfig_setfocusmode)\nfor details."]]