Skip to content

Commit 3f6f44e

Browse files
committed
Add basic UI for Azure Kinect Sensor
1 parent a47f389 commit 3f6f44e

File tree

6 files changed

+408
-5
lines changed

6 files changed

+408
-5
lines changed
Lines changed: 359 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,359 @@
1+
<UserControl
2+
x:Class="OpenSense.WPF.Components.AzureKinect.Sensor.AzureKinectSensorConfigurationControl"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
6+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
7+
xmlns:local="clr-namespace:OpenSense.WPF.Components.AzureKinect.Sensor"
8+
xmlns:util="clr-namespace:OpenSense.WPF.Components.Utilities;assembly=OpenSense.WPF.Components.Contracts"
9+
xmlns:sensor="clr-namespace:Microsoft.Azure.Kinect.Sensor;assembly=Microsoft.Azure.Kinect.Sensor"
10+
xmlns:comp="clr-namespace:OpenSense.Components.AzureKinect.Sensor;assembly=OpenSense.Components.AzureKinect.Sensor"
11+
mc:Ignorable="d"
12+
Loaded="UserControl_Loaded"
13+
d:DesignHeight="700"
14+
d:DesignWidth="800">
15+
<d:UserControl.DataContext>
16+
<comp:AzureKinectSensorConfiguration />
17+
</d:UserControl.DataContext>
18+
<Grid>
19+
<Grid.ColumnDefinitions>
20+
<ColumnDefinition
21+
Width="auto" />
22+
<ColumnDefinition />
23+
</Grid.ColumnDefinitions>
24+
<Grid.RowDefinitions>
25+
<RowDefinition
26+
Height="auto" />
27+
<RowDefinition
28+
Height="auto" />
29+
<RowDefinition
30+
Height="auto" />
31+
<RowDefinition
32+
Height="auto" />
33+
<RowDefinition
34+
Height="auto" />
35+
<RowDefinition
36+
Height="auto" />
37+
<RowDefinition
38+
Height="auto" />
39+
<RowDefinition
40+
Height="auto" />
41+
<RowDefinition
42+
Height="auto" />
43+
<RowDefinition
44+
Height="auto" />
45+
<RowDefinition
46+
Height="auto" />
47+
<RowDefinition
48+
Height="auto" />
49+
<RowDefinition
50+
Height="auto" />
51+
<RowDefinition
52+
Height="auto" />
53+
<RowDefinition
54+
Height="auto" />
55+
<RowDefinition
56+
Height="auto" />
57+
<RowDefinition
58+
Height="auto" />
59+
<RowDefinition
60+
Height="auto" />
61+
<RowDefinition
62+
Height="auto" />
63+
<RowDefinition
64+
Height="auto" />
65+
<RowDefinition
66+
Height="auto" />
67+
<RowDefinition
68+
Height="auto" />
69+
<RowDefinition
70+
Height="auto" />
71+
<RowDefinition
72+
Height="auto" />
73+
<RowDefinition
74+
Height="auto" />
75+
</Grid.RowDefinitions>
76+
77+
<Label
78+
Grid.Row="0"
79+
Grid.Column="0">
80+
Device Index
81+
</Label>
82+
<Grid
83+
Grid.Row="0"
84+
Grid.Column="1">
85+
<Grid.ColumnDefinitions>
86+
<ColumnDefinition />
87+
<ColumnDefinition
88+
Width="auto" />
89+
<ColumnDefinition
90+
Width="auto" />
91+
</Grid.ColumnDefinitions>
92+
<TextBox
93+
Grid.Column="0"
94+
Text="{Binding DeviceIndex}" />
95+
<TextBlock
96+
Grid.Column="1">
97+
Available Count:
98+
</TextBlock>
99+
<TextBlock
100+
Grid.Column="2"
101+
Name="TextBlockInstalledDeviceCount"/>
102+
</Grid>
103+
104+
<Label
105+
Grid.Row="1"
106+
Grid.Column="0">
107+
Color Resolution
108+
</Label>
109+
<ComboBox
110+
Grid.Row="1"
111+
Grid.Column="1"
112+
SelectedItem="{Binding ColorResolution}"
113+
ItemsSource="{Binding Source={util:EnumBindingSource {x:Type sensor:ColorResolution}}, Mode=OneTime}" />
114+
115+
<Label
116+
Grid.Row="2"
117+
Grid.Column="0">
118+
Color Format
119+
</Label>
120+
<ComboBox
121+
Grid.Row="2"
122+
Grid.Column="1"
123+
SelectedItem="{Binding ColorFormat}"
124+
ItemsSource="{Binding Source={util:EnumBindingSource {x:Type sensor:ImageFormat}}, Mode=OneTime}" />
125+
126+
<Label
127+
Grid.Row="3"
128+
Grid.Column="0">
129+
Camera Frame Rate
130+
</Label>
131+
<ComboBox
132+
Grid.Row="3"
133+
Grid.Column="1"
134+
SelectedItem="{Binding CameraFrameRate}"
135+
ItemsSource="{Binding Source={util:EnumBindingSource {x:Type sensor:FPS}}, Mode=OneTime}" />
136+
137+
<Label
138+
Grid.Row="4"
139+
Grid.Column="0">
140+
Depth &amp; Passive IR Mode (Resolution)
141+
</Label>
142+
<ComboBox
143+
Grid.Row="4"
144+
Grid.Column="1"
145+
SelectedItem="{Binding DepthMode}"
146+
ItemsSource="{Binding Source={util:EnumBindingSource {x:Type sensor:DepthMode}}, Mode=OneTime}" />
147+
148+
<Label
149+
Grid.Row="5"
150+
Grid.Column="0">
151+
Depth Delay Off Color
152+
</Label>
153+
<TextBlock
154+
Grid.Row="5"
155+
Grid.Column="1">
156+
TODO: TimeSpan type
157+
</TextBlock>
158+
159+
<Label
160+
Grid.Row="6"
161+
Grid.Column="0">
162+
Synchronized Images Only
163+
</Label>
164+
<CheckBox
165+
Grid.Row="6"
166+
Grid.Column="1"
167+
IsChecked="{Binding SynchronizedImagesOnly}" />
168+
169+
<Label
170+
Grid.Row="7"
171+
Grid.Column="0">
172+
Capture Thread Priority
173+
</Label>
174+
<ComboBox
175+
Grid.Row="7"
176+
Grid.Column="1"
177+
SelectedItem="{Binding CaptureThreadPriority}"
178+
ItemsSource="{x:Static local:ThreadPriorityEnumHelper.Values}" />
179+
180+
<Label
181+
Grid.Row="8"
182+
Grid.Column="0">
183+
Capture Thread Join Timeout
184+
</Label>
185+
<TextBlock
186+
Grid.Row="8"
187+
Grid.Column="1">
188+
TODO: TimeSpan type
189+
</TextBlock>
190+
191+
<Label
192+
Grid.Row="9"
193+
Grid.Column="0">
194+
Enable IMU
195+
</Label>
196+
<CheckBox
197+
Grid.Row="9"
198+
Grid.Column="1"
199+
IsChecked="{Binding EnableImu}" />
200+
201+
<Label
202+
Grid.Row="10"
203+
Grid.Column="0">
204+
IMU Thread Priority
205+
</Label>
206+
<ComboBox
207+
Grid.Row="10"
208+
Grid.Column="1"
209+
SelectedItem="{Binding ImuThreadPriority}"
210+
ItemsSource="{x:Static local:ThreadPriorityEnumHelper.Values}" />
211+
212+
<Label
213+
Grid.Row="11"
214+
Grid.Column="0">
215+
IMU Sample Timeout
216+
</Label>
217+
<TextBlock
218+
Grid.Row="11"
219+
Grid.Column="1">
220+
TODO: TimeSpan type
221+
</TextBlock>
222+
223+
<Label
224+
Grid.Row="12"
225+
Grid.Column="0">
226+
IMU Thread Join Timeout
227+
</Label>
228+
<TextBlock
229+
Grid.Row="12"
230+
Grid.Column="1">
231+
TODO: TimeSpan type
232+
</TextBlock>
233+
234+
<Label
235+
Grid.Row="13"
236+
Grid.Column="0">
237+
Wired Sync Mode
238+
</Label>
239+
<ComboBox
240+
Grid.Row="13"
241+
Grid.Column="1"
242+
SelectedItem="{Binding WiredSyncMode}"
243+
ItemsSource="{Binding Source={util:EnumBindingSource {x:Type sensor:WiredSyncMode}}, Mode=OneTime}" />
244+
245+
<Label
246+
Grid.Row="14"
247+
Grid.Column="0">
248+
Suboridinate Delay Off Master
249+
</Label>
250+
<TextBlock
251+
Grid.Row="14"
252+
Grid.Column="1">
253+
TODO: TimeSpan type
254+
</TextBlock>
255+
256+
<Label
257+
Grid.Row="15"
258+
Grid.Column="0">
259+
Exposure Time (0:auto)
260+
</Label>
261+
<TextBox
262+
Grid.Row="15"
263+
Grid.Column="1"
264+
Text="{Binding ExposureTime}" />
265+
266+
<Label
267+
Grid.Row="16"
268+
Grid.Column="0">
269+
Brightness
270+
</Label>
271+
<TextBox
272+
Grid.Row="16"
273+
Grid.Column="1"
274+
Text="{Binding Brightness}" />
275+
276+
<Label
277+
Grid.Row="17"
278+
Grid.Column="0">
279+
Contrast
280+
</Label>
281+
<TextBox
282+
Grid.Row="17"
283+
Grid.Column="1"
284+
Text="{Binding Contrast}" />
285+
286+
<Label
287+
Grid.Row="18"
288+
Grid.Column="0">
289+
Saturation
290+
</Label>
291+
<TextBox
292+
Grid.Row="18"
293+
Grid.Column="1"
294+
Text="{Binding Saturation}" />
295+
296+
<Label
297+
Grid.Row="19"
298+
Grid.Column="0">
299+
Sharpness
300+
</Label>
301+
<TextBox
302+
Grid.Row="19"
303+
Grid.Column="1"
304+
Text="{Binding Sharpness}" />
305+
306+
<Label
307+
Grid.Row="20"
308+
Grid.Column="0">
309+
White Balance (0:auto)
310+
</Label>
311+
<TextBox
312+
Grid.Row="20"
313+
Grid.Column="1"
314+
Text="{Binding WhiteBalance}" />
315+
316+
<Label
317+
Grid.Row="21"
318+
Grid.Column="0">
319+
Backlight Compensation
320+
</Label>
321+
<ComboBox
322+
Grid.Row="21"
323+
Grid.Column="1"
324+
SelectedItem="{Binding BacklightCompensation}"
325+
ItemsSource="{Binding Source={util:EnumBindingSource {x:Type comp:BacklightCompensation}}, Mode=OneTime}" />
326+
327+
<Label
328+
Grid.Row="22"
329+
Grid.Column="0">
330+
Gain
331+
</Label>
332+
<TextBox
333+
Grid.Row="22"
334+
Grid.Column="1"
335+
Text="{Binding Gain}" />
336+
337+
<Label
338+
Grid.Row="23"
339+
Grid.Column="0">
340+
Powerline Frequency
341+
</Label>
342+
<ComboBox
343+
Grid.Row="23"
344+
Grid.Column="1"
345+
SelectedItem="{Binding PowerlineFrequency}"
346+
ItemsSource="{Binding Source={util:EnumBindingSource {x:Type comp:PowerlineFrequency}}, Mode=OneTime}" />
347+
348+
<Label
349+
Grid.Row="24"
350+
Grid.Column="0">
351+
Streaming Indicator
352+
</Label>
353+
<CheckBox
354+
Grid.Row="24"
355+
Grid.Column="1"
356+
IsChecked="{Binding StreamingIndicator}" />
357+
358+
</Grid>
359+
</UserControl>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using System.Windows.Controls;
2+
using Microsoft.Azure.Kinect.Sensor;
3+
4+
namespace OpenSense.WPF.Components.AzureKinect.Sensor {
5+
public sealed partial class AzureKinectSensorConfigurationControl : UserControl {
6+
7+
public AzureKinectSensorConfigurationControl() {
8+
InitializeComponent();
9+
}
10+
11+
private void UserControl_Loaded(object sender, System.Windows.RoutedEventArgs e) {
12+
TextBlockInstalledDeviceCount.Text = Device.GetInstalledCount().ToString();
13+
}
14+
}
15+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using System.Composition;
2+
using OpenSense.Components;
3+
using System.Windows;
4+
using OpenSense.Components.AzureKinect.Sensor;
5+
6+
namespace OpenSense.WPF.Components.AzureKinect.Sensor {
7+
[Export(typeof(IConfigurationControlCreator))]
8+
public sealed class AzureKinectSensorConfigurationControlCreator : IConfigurationControlCreator {
9+
10+
public bool CanCreate(ComponentConfiguration configuration) => configuration is AzureKinectSensorConfiguration;
11+
12+
public UIElement Create(ComponentConfiguration configuration) => new AzureKinectSensorConfigurationControl() {
13+
DataContext = configuration
14+
};
15+
}
16+
}

0 commit comments

Comments
 (0)