I have a simple photo capture functionality made for windows phone 10 in C#.
Capture setup:
_captureManager = new MediaCapture();
await _captureManager.InitializeAsync(new MediaCaptureInitializationSettings
{
StreamingCaptureMode = StreamingCaptureMode.Video,
PhotoCaptureSource = PhotoCaptureSource.Photo,
AudioDeviceId = string.Empty,
VideoDeviceId = cameraId
});
var resolutions = captureManager.VideoDeviceController.GetAvailableMediaStreamProperties(MediaStreamType.Photo);
// Here I choose same resolution as native camera does
await _captureManager.VideoDeviceController.SetMediaStreamPropertiesAsync(MediaStreamType.Photo, resolutions[3]);
And I capture photo:
using (var imageStream = new InMemoryRandomAccessStream())
{
var format = ImageEncodingProperties.CreateJpeg();
var capturefile = await _storeFolder.CreateFileAsync(photoName, CreationCollisionOption.GenerateUniqueName);
await _captureManager.CapturePhotoToStreamAsync(format, imageStream);
.....
}
However on CapturePhotoToStreamAsync my picture gets cropped. This does not happen when I remove SetMediaStreamPropertiesAsync, but it selects different resolution then my native camera does.
Does anyone know what could be the cause of this problem?