Use an externally connected camera with Vuforia Engine on UWP Windows and iPadOS devices.
UWP Devices
Vuforia Engine supports MediaFramework-compatible cameras connected to your UWP device. Provide Vuforia Engine with camera-intrinsic parameters to accommodate the variety of lenses available. Use a JSON file to specify your camera parameters for an external camera.
The external camera must be connected via USB and compatible with Media Foundation.
NOTE: This way of using camera intrinsics does not support a device's built-in back- or front cameras.
For more support on Vuforia UWP apps using custom cameras with the DirectShow or vendor-specific APIs, see Vuforia Camera Bridge.
iOS Devices
Vuforia Engine supports external cameras connected to iOS devices running iOS 17 or newer. Provide Vuforia Engine with camera-intrinsic parameters in a JSON file to accommodate the variety of lenses available.
For Vuforia Engine to recognize the external camera, disable in the Vuforia Engine Configuration.
The following code snippet disables the Platform Fusion Provider and, consequently, ARKit.
12345Copyauto fusionConfig = vuFusionProviderConfigDefault();
fusionConfig.usePlatformFusionProvider = VU_FALSE;
VuEngineConfigSet* configSet;
vuEngineConfigSetAddFusionProviderConfig(configSet, &fusionConfig);
Vuforia Engine prioritizes an externally connected camera over the built-in camera.
Camera JSON Configuration
Vuforia Engine selects a camera by prioritizing that order. Vuforia Engine determines which camera parameters should be applied when an external camera is connected, but these can be overwritten by sideloading camera intrinsics from a JSON file.
Sideload custom camera settings and intrinsics for external cameras by creating a JSON file named vuforia-camera.json and the following elements in a single object.
frameRate |
Camera frame rate. |
resolution |
Camera image resolution. |
focalLength |
Focal length in x and y direction. |
principalPoint |
Principal point. |
Distortion (Optional) |
Camera distortion parameters. Float array of up to 8 values. The number of values determines the distortion model:
The values are in the following order (r = radial, t = tangential): |
Add the array in the root of vuforia-camera.json:
123456789101112131415161718Copy[
{
"frameRate": 30,
"resolution": {
"width": 1920,
"height": 1080
},
"focalLength": {
"x": 1024,
"y": 1024
},
"principalPoint": {
"x": 960,
"y": 540
},
"distortion": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
}
]
For UWP devices, place vuforia-camera.json in the directory C:\Users\USER\AppData\Local\Packages\<APPLICATION>\LocalState\vuforia-camera.json.
For iOS devices, place vuforia-camera.json in <APPLICATION>/Documents/vuforia-camera.json.
The Vuforia Engine will not start if the external camera does not support the framerate or resolution properties specified in the vuforia-camera.json file.
When starting Vuforia Engine with the external camera connected and recognized by the device, the vuforia-camera.json with camera intrinsics is automatically loaded.
See Troubleshooting for UWP if your built-in camera is prioritized.