我正在寻找一种方法来提高Lumia 920手机上的图像捕捉率。我做了一些测试,似乎图像捕获步骤在全分辨率(8 MP)下大约需要1300 ms。我用iPhone 5进行了类似的测试,图像捕获步骤在全分辨率(8 MP)下在不到400毫秒内完成。这是一个很大的区别!这是我的代码:
public async Task TakePictures()
{
IReadOnlyList<Windows.Foundation.Size> captureResolutions = PhotoCaptureDevice.GetAvailableCaptureResolutions(CameraSensorLocation.Back);
PhotoCaptureDevice camera = await PhotoCaptureDevice.OpenAsync(CameraSensorLocation.Back, captureResolutions[0]);
CameraCaptureSequence captureSequence = camera.CreateCaptureSequence(1);
MemoryStream captureStream = new MemoryStream();
captureSequence.Frames[0].CaptureStream = captureStream.AsOutputStream();
await camera.PrepareCaptureSequenceAsync(captureSequence);
StorageFolder localFolder = ApplicationData.Current.LocalFolder;
// take a bunch of images
for (int i = 0; i < 20; i++)
{
TimeSpan t1 = DateTime.Now.TimeOfDay;
await captureSequence.StartCaptureAsync();
TimeSpan t2 = DateTime.Now.TimeOfDay;
// could save file here
Debug.WriteLine("image capture time = {0} ms", t2.TotalMilliseconds - t1.TotalMilliseconds);
}
}
关于为什么StartCaptureAsync()
方法可能需要这么长时间的任何想法?我已经修复了ISO,曝光时间,焦距和白平衡等参数,因此相机不需要为每次拍摄重新校准这些设置。
我想到的一件事是使用本机代码API described here,但我对Windows Phone开发这么新,我对此并不了解。
有什么想法吗?谢谢!