VB.NET中的Kinect SDK v1示例



有人知道我在哪里可以找到VB中新Kinect SDK的示例,更具体地说,还有KinectExplorer示例的端口吗?

我已经在VB中移植了整个WPFViewers项目,但它在XAML上有错误。

.net框架和所有其他CLR语言的一个优点是,您可以很容易地在两者之间进行转换。

http://www.developerfusion.com/tools/convert/csharp-to-vb/

只需在这里复制你在VB中想要的代码,它就会翻译它。

KinectWindow.cs文件的翻译示例:

'------------------------------------------------------------------------------
' <copyright file="KinectWindow.cs" company="Microsoft">
'     Copyright (c) Microsoft Corporation.  All rights reserved.
' </copyright>
'------------------------------------------------------------------------------
Imports System.Windows
Imports Microsoft.Kinect
Imports Microsoft.Samples.Kinect.WpfViewers
Namespace Microsoft.Samples.Kinect.KinectExplorer
    ''' <summary>
    ''' This is the core kinect window.
    ''' </summary>
    Public Class KinectWindow
        Inherits Window
        #Region "Private state"
        Private ReadOnly kinectDiagnosticViewer As KinectDiagnosticViewer
        Private m_kinect As KinectSensor
        #End Region
        Public Sub New()
            Me.kinectDiagnosticViewer = New KinectDiagnosticViewer()
            Me.kinectDiagnosticViewer.KinectColorViewer.CollectFrameRate = True
            Me.kinectDiagnosticViewer.KinectDepthViewer.CollectFrameRate = True
            Content = Me.kinectDiagnosticViewer
            Width = 1024
            Height = 600
            Title = "Kinect Explorer"
            AddHandler Me.Closed, AddressOf Me.KinectWindowClosed
        End Sub
        Public Property Kinect() As KinectSensor
            Get
                Return Me.m_kinect
            End Get
            Set
                Me.m_kinect = value
                Me.kinectDiagnosticViewer.Kinect = Me.m_kinect
            End Set
        End Property
        Public Sub StatusChanged()
            Me.kinectDiagnosticViewer.StatusChanged()
        End Sub
        Private Sub KinectWindowClosed(sender As Object, e As System.EventArgs)
            ' KinectDiagnosticViewer will call kinectSensor.Stop() so we properly release its use.
            Me.Kinect = Nothing
        End Sub
    End Class
End Namespace

至于XAML:

<kv:ImageViewer x:Class="TC.Samples.Kinect.WpfViewers.KinectSkeletonViewer"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:kv="clr-namespace:TC.Samples.Kinect.WpfViewers.TC.Samples.Kinect.WpfViewers"
             d:DesignHeight="480" d:DesignWidth="640">
    <Grid>
        <kv:KinectSkeleton x:Name="skeletonCanvas1" ClipToBounds="true">
        </kv:KinectSkeleton>
        <kv:KinectSkeleton x:Name="skeletonCanvas2" ClipToBounds="true">
        </kv:KinectSkeleton>
        <kv:KinectSkeleton x:Name="skeletonCanvas3" ClipToBounds="true">
        </kv:KinectSkeleton>
        <kv:KinectSkeleton x:Name="skeletonCanvas4" ClipToBounds="true">
        </kv:KinectSkeleton>
        <kv:KinectSkeleton x:Name="skeletonCanvas5" ClipToBounds="true">
        </kv:KinectSkeleton>
        <kv:KinectSkeleton x:Name="skeletonCanvas6" ClipToBounds="true">
        </kv:KinectSkeleton>
    </Grid>
</kv:ImageViewer>

最新更新