forked from AnilOsmanTur/SignRecorderAU
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPreviewWindow.xaml.cs
94 lines (75 loc) · 2.62 KB
/
PreviewWindow.xaml.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Interop;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace KinectRecorder
{
/// <summary>
/// Interaction logic for preview.xaml
/// </summary>
public partial class PreviewWindow : Window
{
private ImageSource colorPreviewBitmap;
private WriteableBitmap depthPreviewBitmap;
private WriteableBitmap infraredPreviewBitmap;
private ImageSource bodyIndexPreviewBitmap;
private DrawingImage skeletalImage = null;
private ColorHandler ch;
private DepthHandler dh;
private InfraredHandler ih;
private SkeletonHandler sh;
private BodyIndexHandler bh;
private int count = 0;
public PreviewWindow()
{
InitializeComponent();
ch = ColorHandler.Instance;
ch.openReader();
bh = BodyIndexHandler.Instance;
bh.openReader();
dh = DepthHandler.Instance;
dh.startReading();
ih = InfraredHandler.Instance;
ih.startReading();
sh = SkeletonHandler.Instance;
sh.openReader();
depthPreviewBitmap = new WriteableBitmap(dh.Width, dh.Height, 96.0, 96.0, PixelFormats.Gray16, null);
infraredPreviewBitmap = new WriteableBitmap(ih.Width, ih.Height, 96.0, 96.0, PixelFormats.Gray16, null);
ComponentDispatcher.ThreadIdle += new System.EventHandler(ComponentDispatcher_ThreadIdle);
}
private void OK_Click(object sender, RoutedEventArgs e)
{
this.DialogResult = true;
ch.closeReader();
bh.closeReader();
sh.closeReader();
}
void ComponentDispatcher_ThreadIdle(object sender, EventArgs e)
{
if (count < ch.readerFrameCount)
{
color_preview.Source = ch.Read();
bodyIndex_preview.Source = bh.Read();
dh.Read(ref depthPreviewBitmap);
depth_preview.Source = depthPreviewBitmap;
ih.Read(ref infraredPreviewBitmap);
infrared_preview.Source = infraredPreviewBitmap;
sh.Read();
skeletal_preview.Source = sh.getPreviewImageSource();
count++;
}
}
}
}