Skip to content

Commit fbe40f3

Browse files
Intial design, needs some tweaks to be more responsive
1 parent de1a05e commit fbe40f3

File tree

5 files changed

+168
-2
lines changed

5 files changed

+168
-2
lines changed
277 KB
Loading
228 KB
Loading

Samples/StyleTransfer/MainPage.xaml

Lines changed: 159 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,165 @@
77
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
88
mc:Ignorable="d"
99
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
10+
<Page.Resources>
11+
<DataTemplate x:Key="ModelSelectionStyle">
12+
<TextBlock FontSize="12" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock>
13+
</DataTemplate>
14+
<Style x:Key="TextBlockStyling" TargetType="TextBlock">
15+
<Setter Property="Foreground" Value="Black"/>
16+
</Style>
17+
</Page.Resources>
1018

11-
<Grid>
19+
<RelativePanel Margin="10,0,0,10" >
20+
<TextBlock x:Name="TitleTextBlock" Text="Style Transfer Demo" FontSize="24" Width="223" Margin="24,0,0,24"/>
21+
<Grid Name="InputControlGrid" RelativePanel.Below="TitleTextBlock" HorizontalAlignment="Center" RelativePanel.AlignHorizontalCenterWithPanel="True" Padding="10,0,10,0" >
22+
<Grid.ColumnDefinitions>
23+
<ColumnDefinition Width="Auto"/>
24+
<ColumnDefinition Width="Auto" />
25+
<ColumnDefinition Width="Auto"/>
26+
</Grid.ColumnDefinitions>
27+
<Grid.RowDefinitions>
28+
<RowDefinition Height="Auto" />
29+
<RowDefinition Height="Auto" />
30+
</Grid.RowDefinitions>
1231

13-
</Grid>
32+
<TextBlock Text="Input Device" FontSize="16" Grid.Row="0" HorizontalAlignment="Center" VerticalAlignment="Bottom"/>
33+
<TextBlock Text="Input Media" FontSize="16" Grid.Row="0" Grid.Column="1" HorizontalAlignment="Center" />
34+
<TextBlock Text="Input Model" FontSize="16" Grid.Row="0" Grid.Column="2" HorizontalAlignment="Center" />
35+
36+
<ListBox Name="UIStyleList" HorizontalAlignment="Center" Grid.Row="1" Grid.Column="2" ItemsSource="{x:Bind modelFileNames}" Margin="5,0,5,0">
37+
<ListBox.ItemsPanel>
38+
<ItemsPanelTemplate>
39+
<VirtualizingStackPanel Orientation="Horizontal"/>
40+
</ItemsPanelTemplate>
41+
</ListBox.ItemsPanel>
42+
</ListBox>
43+
44+
<StackPanel Orientation="Horizontal" Grid.Row="1" Grid.Column="1" HorizontalAlignment="Center" Width="154" VerticalAlignment="Top" Height="{Binding ActualHeight, ElementName=UIStyleList}" Margin="5,0,5,0">
45+
<Button Name="UIButtonLiveStream"
46+
ToolTipService.ToolTip="Camera preview">
47+
<Button.Content>
48+
<SymbolIcon Symbol="Video"/>
49+
</Button.Content>
50+
</Button>
51+
<Button Name="UIButtonAcquireImage"
52+
ToolTipService.ToolTip="Take a photo">
53+
<Button.Content>
54+
<SymbolIcon Symbol="Camera"/>
55+
</Button.Content>
56+
</Button>
57+
<Button Name="UIButtonFilePick"
58+
ToolTipService.ToolTip="Select an image from a file">
59+
<Button.Content>
60+
<SymbolIcon Symbol="OpenFile"/>
61+
</Button.Content>
62+
</Button>
63+
<Button Name="UIButtonInking"
64+
ToolTipService.ToolTip="Draw on a canvas">
65+
<Button.Content>
66+
<SymbolIcon Symbol="Edit"/>
67+
</Button.Content>
68+
</Button>
69+
</StackPanel>
70+
<ToggleSwitch Name="UIToggleInferenceDevice"
71+
OnContent="GPU"
72+
OffContent="CPU"
73+
IsOn="True" HorizontalContentAlignment="Center" Width="100" VerticalAlignment="Top" Grid.Row="1" HorizontalAlignment="Center" />
74+
</Grid>
75+
<Grid RelativePanel.Below="InputControlGrid" RelativePanel.AlignHorizontalCenterWithPanel="True" Margin="0,25,0,0" Name="MediaDisplayGrid">
76+
<Grid.ColumnDefinitions>
77+
<ColumnDefinition Width="200*"/>
78+
<ColumnDefinition Width="200*"/>
79+
</Grid.ColumnDefinitions>
80+
<Grid.RowDefinitions>
81+
<RowDefinition Height="300*"></RowDefinition>
82+
</Grid.RowDefinitions>
83+
84+
<Viewbox Stretch="Uniform">
85+
<StackPanel Name="UIInkControls"
86+
Visibility="Collapsed"
87+
Grid.Column="0">
88+
<InkToolbar TargetInkCanvas="{x:Bind UIInkCanvasInput}" VerticalAlignment="Top" />
89+
90+
<!--inking canvas-->
91+
<Viewbox Stretch="Uniform"
92+
MaxWidth="720"
93+
MaxHeight="720">
94+
<Grid BorderBrush="Black"
95+
BorderThickness="1">
96+
<Grid Name="UIInkGrid"
97+
Background="Black"
98+
MinWidth="200"
99+
MinHeight="200"
100+
MaxWidth="720"
101+
MaxHeight="720">
102+
<InkCanvas Name="UIInkCanvasInput"/>
103+
</Grid>
104+
</Grid>
105+
</Viewbox>
106+
</StackPanel>
107+
</Viewbox>
108+
109+
<Viewbox Stretch="Uniform" Grid.Column="0">
110+
<Image Name="UIInputImage"
111+
Grid.Column="0"
112+
Stretch="Uniform"
113+
MaxHeight="720"
114+
MaxWidth="720" Source="/Assets/Input.jpg"/>
115+
</Viewbox>
116+
<Viewbox Stretch="Uniform" Grid.Column="0" VerticalAlignment="Stretch">
117+
<MediaPlayerElement Name="UIMediaPlayerElement"
118+
Stretch="Uniform"
119+
AreTransportControlsEnabled="False"
120+
Canvas.ZIndex="-1"
121+
Grid.Column="0"
122+
MaxHeight="720"
123+
MaxWidth="720"/>
124+
</Viewbox>
125+
126+
<Viewbox Stretch="Uniform" Grid.Column="1">
127+
<Image Name="UIResultImage"
128+
Grid.Column="1"
129+
Stretch="Uniform"
130+
Source="/Assets/Output.jpg"
131+
MaxHeight="720"
132+
MaxWidth="720"/>
133+
</Viewbox>
134+
</Grid>
135+
<StackPanel Name="UICameraSelectionControls" Orientation="vertical" Visibility="Collapsed" VerticalAlignment="Bottom" HorizontalAlignment="Left" RelativePanel.Below="MediaDisplayGrid" RelativePanel.AlignLeftWithPanel="True">
136+
<TextBlock Text="Camera: " Style="{StaticResource TextBlockStyling}"/>
137+
<ComboBox Name="UICmbCamera" Foreground="White" >
138+
<ComboBox.Background>
139+
<SolidColorBrush Color="Black" Opacity="0.3"/>
140+
</ComboBox.Background>
141+
</ComboBox>
142+
<TextBlock Text="Preview resolution: " Style="{StaticResource TextBlockStyling}"/>
143+
<TextBlock Name="UITxtBlockPreviewProperties" Text="0x0" Style="{StaticResource TextBlockStyling}"/>
144+
</StackPanel>
145+
146+
<Button Name="UIButtonSaveImage"
147+
ToolTipService.ToolTip="Save the image result to a file"
148+
IsEnabled="false"
149+
Background="#FF939393"
150+
HorizontalAlignment="Right" VerticalAlignment="Top" RelativePanel.Below="MediaDisplayGrid" RelativePanel.AlignRightWithPanel="True">
151+
<Button.Content>
152+
<SymbolIcon Symbol="Save"/>
153+
</Button.Content>
154+
</Button>
155+
<Grid Name="FPSDisplayGrid" RelativePanel.Below="MediaDisplayGrid" HorizontalAlignment="Center" RelativePanel.AlignHorizontalCenterWithPanel="True" Padding="10,0,10,0" >
156+
<Grid.ColumnDefinitions>
157+
<ColumnDefinition Width="Auto"/>
158+
<ColumnDefinition Width="Auto" />
159+
</Grid.ColumnDefinitions>
160+
<Grid.RowDefinitions>
161+
<RowDefinition Height="Auto" />
162+
<RowDefinition Height="Auto" />
163+
</Grid.RowDefinitions>
164+
<TextBlock Grid.Row="0" Grid.Column="0">Capture FPS</TextBlock>
165+
<TextBlock Grid.Row="1" Grid.Column="0" Text="{x:Bind dummyFPS}"></TextBlock>
166+
167+
<TextBlock Grid.Row="0" Grid.Column="1">Render FPS</TextBlock>
168+
<TextBlock Grid.Row="1" Grid.Column="1" Text="{x:Bind dummyFPS}"></TextBlock>
169+
</Grid>
170+
</RelativePanel>
14171
</Page>

Samples/StyleTransfer/MainPage.xaml.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@ namespace StyleTransfer
2323
/// </summary>
2424
public sealed partial class MainPage : Page
2525
{
26+
public int dummyFPS = 10;
27+
public List<string> modelFileNames = new List<string>
28+
{"candy",
29+
"mosaic",
30+
"la_muse",
31+
"udnie"
32+
};
2633
public MainPage()
2734
{
2835
this.InitializeComponent();

Samples/StyleTransfer/StyleTransfer.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@
130130
</AppxManifest>
131131
</ItemGroup>
132132
<ItemGroup>
133+
<Content Include="Assets\Input.jpg" />
134+
<Content Include="Assets\Output.jpg" />
133135
<Content Include="Properties\Default.rd.xml" />
134136
<Content Include="Assets\LockScreenLogo.scale-200.png" />
135137
<Content Include="Assets\SplashScreen.scale-200.png" />

0 commit comments

Comments
 (0)