0

谢谢你来我的问题。

我想用 UWP 去除视频中的绿色背景。色键的定时是点击【删除】按钮。(请看下图)

在此处输入图像描述

我知道很多人为图像做了色键效果。但我找不到任何关于视频色键的网站。

我在 UWP 中制作了 webRTC 应用程序(您可以在 Microsoft 的github中找到示例),然后我想做 chromakey。

这个应用程序使用 MediaplayerElement 来显示视频。

我的想法是...

  1. 获取视频帧,因为视频是一系列图像。

  2. 删除每个图像的绿色背景。

    这时,我们可以使用多种库。(位图、Win2D、OpenCVSharp、Magick.NET...)

  3. 显示它们。

在 HTML 和 JavaScript 中,我们可以使用 video 和 canvas 元素,然后我们可以轻松地做这些事情。但我不能在 C# 中完成它们。

请帮我...

(XAML 代码)

<Page
x:Class="Holo_X_AppDes.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Holo_X_AppDes"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

<Grid>
    <Grid.Background>
        <ImageBrush ImageSource="Assets/背景写真.jpg"/>
    </Grid.Background>
    <Image HorizontalAlignment="Left" Height="144" Margin="34,32,0,0" VerticalAlignment="Top" Width="643" Source="Assets/Holo-Xのタイトル.png"/>
    <Image HorizontalAlignment="Left" Height="442" Margin="63,156,0,0" VerticalAlignment="Top" Width="640" Source="Assets/待機中.PNG" Stretch="Fill"/>
    <MediaPlayerElement x:Name="remoteVideoPlayerElement"  Margin="63,156,797,402" />
    <MediaPlayerElement x:Name="localVideoPlayerElement" Height="442" Width="640" Margin="783,157,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" HorizontalContentAlignment="Center" RenderTransformOrigin="0.5,0.5" Stretch="Fill"/>
    <Image HorizontalAlignment="Left" Height="102" Margin="546,621,0,0" VerticalAlignment="Top" Width="98" Source="Assets/発信.png"/>
    <Image HorizontalAlignment="Left" Height="100" Margin="848,621,0,0" VerticalAlignment="Top" Width="100" Source="Assets/退室.png"/>
    <Button Name="Delete" Content="Delete" Margin="687,644,0,0" VerticalAlignment="Top" Height="51" Width="117" Background="#FF46D49F" FontSize="25" BorderBrush="#FF46D49F" Click="Button_Click"/>
    <Button Name="createOfferButton" Content="Create offer" Click="CreateOfferButtonClicked" Background="#FF46D49F" FontSize="25" BorderBrush="#FF46D49F" Margin="295,644,0,0" VerticalAlignment="Top" Height="65" Width="175"/>
    <TextBox HorizontalAlignment="Left" Margin="983,656,0,0" Text="IDを入力してください&quot; TextWrapping="Wrap" VerticalAlignment="Top" Height="39" Width="168"/>
</Grid>

(参考)

・<a href="https://github.com/microsoft/MixedReality-WebRTC" rel="nofollow noreferrer">MixedReality-WebRTC 这是我的应用程序的基础。

・<a href="https://docs.microsoft.com/ja-jp/windows/uwp/audio-video-camera/play-audio-and-video-with-mediaplayer" rel="nofollow noreferrer">如何播放 MediaPlayerElement

・<a href="https://docs.microsoft.com/ja-jp/windows/uwp/audio-video-camera/basic-photo-video-and-audio-capture-with-mediacapture#capture-a- video" rel="nofollow noreferrer">捕获视频

・<a href="https://docs.microsoft.com/ja-jp/windows/uwp/audio-video-camera/media-compositions-and-editing#add-effects-to-a-media-clip" rel="nofollow noreferrer">为媒体剪辑添加效果

・<a href="https://stackoverflow.com/questions/20901093/c-sharp-net-green-screen-background-remove">c#.NET绿屏背景移除

4

0 回答 0