How to create camera mask in C# for UWP

萝らか妹 提交于 2019-12-11 01:19:01

问题


I have searched the net but can't find an answer and need some help. I am creating a mobile HR program and need to provide a profile mask to the camera so that the user knows what distance to be at to take a picture of the person and to ensure all photos look the same.

What I would like to do is when the user clicks a button show the camera and have an area blacked out so that only the transparent section shows the focus of the camera in the desired shape.

If anyone knows where sample code is or a good tutorial on this subject is I would appreciate it.


回答1:


For your requirement, you could use MediaCapture class to display the camera preview. And cover CaptureElement with human shape image just like the following.

MainPage.xaml

<Grid>
    <CaptureElement Name="PreviewControl" Stretch="Uniform" Height="400" Width="400" >
    </CaptureElement>
    <Image Source="head.png" Height="400" Width="400" />
</Grid>



来源:https://stackoverflow.com/questions/45148846/how-to-create-camera-mask-in-c-sharp-for-uwp

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