【发布时间】:2016-06-07 07:01:39
【问题描述】:
我在 windows phone 8.1 上使用视频预览来拍照。没有旋转,预览没有黑边。旋转 90 度后,捕获元素上出现条纹。
这是我的屏幕截图和 XAML,c# 代码。
XAML
CaptureElement x:Name="capturePreview" Stretch="UniformToFill" Margin="27,158,10,10" Grid.ColumnSpan="2" />
C#
public async void preview()
{
DeviceInformationCollection webcamList = await DeviceInformation.FindAllAsync(DeviceClass.VideoCapture);
DeviceInformation backWebcam = (from webcam in webcamList
where webcam.EnclosureLocation != null
&& webcam.EnclosureLocation.Panel == Windows.Devices.Enumeration.Panel.Back
select webcam).FirstOrDefault();
newCapture = new MediaCapture();
await newCapture.InitializeAsync(new MediaCaptureInitializationSettings
{
VideoDeviceId = backWebcam.Id,
AudioDeviceId = "",
StreamingCaptureMode = StreamingCaptureMode.Video,
PhotoCaptureSource = PhotoCaptureSource.VideoPreview
});
await newCapture.StartPreviewAsync();
newCapture.SetPreviewRotation(VideoRotation.Clockwise90Degrees);
}
图片旋转
无旋转
【问题讨论】:
标签: c# xaml camera windows-phone-8.1