使用wp8的前置摄像头翻转图像 [英] flipped images with front camera for wp8
问题描述
我在Windows Phone应用中使用lumia Imaging SDK.我主要使用前置摄像头.同时使用VideoBrush
捕获图像.当我尝试使用前置摄像头拍照时,它可以正常工作,但是当捕获图像时,图像将被翻转并保存(如镜面效果).
I am using lumia imaging sdk for my windows phone app. I mainly use the front camera for it. Also am using the VideoBrush
to capture the images. When I am trying to take picture with front camera, it works perfectly but when the image is captured, the image is flipped and saved(like a mirror effect).
<Canvas x:Name="VideoCanvas" Width="480" Height="640" RenderTransformOrigin="0.5,0.5">
<Canvas.RenderTransform>
<CompositeTransform ScaleX="-1"/>
</Canvas.RenderTransform>
<Canvas.Background>
<VideoBrush x:Name="videoBrush"/>
</Canvas.Background>
</Canvas>
上面的Scale="-1"
有助于初始化相机,但是捕获任务会将其存储为镜像.下面是用于捕获图像的代码.可以在这里操纵这种镜像效果吗?
The Scale="-1"
above is helpful for initializing the camera but the capture task storing it as its mirror image. Below is the code that is used to capture the image. Is this mirror effect can be manipulated here?
private async Task Capture()
{
if (!_capturing)
{
_capturing = true;
MemoryStream stream = new MemoryStream();
CameraCaptureSequence sequence = _dataContext.Device.CreateCaptureSequence(1);
sequence.Frames[0].CaptureStream = stream.AsOutputStream();
await _dataContext.Device.PrepareCaptureSequenceAsync(sequence);
await sequence.StartCaptureAsync();
_dataContext.ImageStream = stream;
_capturing = false;
}
}
还是有什么方法可以翻转并保存捕获的图像(就像 LumiaSelfie 应用一样)?请帮我解决一下这个.预先感谢.
Or is there any way to flip and save the captured image(like the LumiaSelfie app does)? Please help me with this. Thanks in advance.
推荐答案
在Lumia Imaging SDK渲染链中,您可以添加Flipfilter:
In your Lumia Imaging SDK rendering chain you can add a Flipfilter: https://msdn.microsoft.com/en-us/library/lumia.imaging.transforms.flipfilter.aspx
示例:
using (var source = ...)
using (var effect = new FilterEffect(source))
using (var renderer = new JpegRenderer(effect))
{
effect.Filters = new [] { new FlipFilter(FlipMode.Horizontal) };
var result = await renderer.RenderAsync();
}
这篇关于使用wp8的前置摄像头翻转图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!