Captured photo with stripes

杀马特。学长 韩版系。学妹 提交于 2019-12-17 13:22:38

问题


I'm using MediaCapture class to take a photo with Windows Phone 8.1 Runtime. The code, where I take a picture looks like this:

// create a file
StorageFile photoFile = await ApplicationData.Current.LocalFolder.CreateFileAsync("myFirstPhoto.jpg", CreationCollisionOption.ReplaceExisting);

// take a photo with choosen Encoding
await captureManager.CapturePhotoToStorageFileAsync(ImageEncodingProperties.CreateJpeg(), photoFile);

The code is working quite fine, as I get a picture, but with strange stripes on left and right side:

I'm trying to find a solution for this problem, but without success. Am I missing something?

EDIT - Photos takes from build-in app are without stripes, so this seems not to be a problem with hardware.


回答1:


Ok I've figured it out myself - it's a problem with resolution which is set as default when using MediaCapture. If you set maximum resolution just after Initializing MediaCapture then there will be no stripes:

// just after initialization
var maxResolution = captureManager.VideoDeviceController.GetAvailableMediaStreamProperties(MediaStreamType.Photo).Aggregate(
                    (i1, i2) => (i1 as VideoEncodingProperties).Width > (i2 as VideoEncodingProperties).Width ? i1 : i2);
await captureManager.VideoDeviceController.SetMediaStreamPropertiesAsync(MediaStreamType.Photo, maxResolution);



回答2:


I tried with the lowest resolution it gets the same stripes. From MS Advance Camera sample, they use MediaCapture for preview but SilverLight API for capturing!

The MediaCapture has also memory leak issue each time when you call CapturePhotoToXXX API.

I wonder if they already know MediaCapture is badly managed on WindowsPhone 8.1 and this is the reason why they don't provide a Camera MediaCapture sample with RT APIs.



来源:https://stackoverflow.com/questions/23709547/captured-photo-with-stripes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!