I am displaying a viewfinder for a Dell Venue 8 Pro tablet camera using a MediaCapture instance. The tablet is running Windows 8.1 Pro. The issue I am facing is that the camera seems to be slow at focusing and adjusting according to the lighting in the room. The preview can flash between too dark and too bright very quickly and seems to struggle to get the optimal lighting setting. Using the stock camera app has no trouble focusing. Here is the code I am using to initialize the camera.
// Attempt to get the back camera if one is available, but use any camera device if not
var cameraDevice = await FindCameraDeviceByPanelAsync(Windows.Devices.Enumeration.Panel.Back);
if (cameraDevice == null)
{
Debug.WriteLine("No camera device found!");
return;
}
var settings = new MediaCaptureInitializationSettings {
VideoDeviceId = cameraDevice.Id,
AudioDeviceId = "",
StreamingCaptureMode = StreamingCaptureMode.Video,
PhotoCaptureSource = PhotoCaptureSource.VideoPreview
};
//setup media capture
mediaCapture = new MediaCapture();
await mediaCapture.InitializeAsync(settings);
mediaCapture.VideoDeviceController.PrimaryUse = CaptureUse.Photo;
ViewFinder.Source = mediaCapture;
mediaCapture.SetPreviewRotation(VideoRotation.Clockwise90Degrees);
await mediaCapture.StartPreviewAsync();
How can I optimize the MediaCapture to be quick at focusing? (The app needs the MediaCapture for decoding a QR code)