none
Kinect Visual studio Hand pointer RRS feed

  • Question

  • Hi Guys, im new at this forum :)

    I have a Question, im trying out some things with my Kinect V2 and Visual Studio 2015 in the Grid App, did follow a tutorial and after spending now  1 day already in it i just can't get it to work
    Here's what i did

    The Tutorial link http://blogs.msdn.com/b/cdndevs/archive/2014/10/31/kinect-with-me-part-2-tracking-bodies-and-overlaying-shapes-on-infrared-data.aspx

    And  https://channel9.msdn.com/Series/Programming-Kinect-for-Windows-v2/03

    The app starts normally up, the kinect see's me but i cannot use my hand for the kinect, have no cursor etcc.

    Please help me out, im getting tired of this
    My following code's are  :

    App.xaml.cs

    using App15.Common;
    
    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;
    using System.Runtime.InteropServices.WindowsRuntime;
    using Windows.ApplicationModel;
    using Windows.ApplicationModel.Activation;
    using Windows.Foundation;
    using Windows.Foundation.Collections;
    using Windows.UI.Xaml;
    using Windows.UI.Xaml.Controls;
    using Windows.UI.Xaml.Controls.Primitives;
    using Windows.UI.Xaml.Data;
    using Windows.UI.Xaml.Input;
    using Windows.UI.Xaml.Media;
    using Windows.UI.Xaml.Navigation;
    using Microsoft.Kinect.Xaml.Controls;
    
    // The Grid App template is documented at http://go.microsoft.com/fwlink/?LinkId=234226
    
    namespace App15
    {
        /// <summary>
        /// Provides application-specific behavior to supplement the default Application class.
        /// </summary>
        sealed partial class App : Application
        {
            /// <summary>
            /// Initializes the singleton Application object.  This is the first line of authored code
            /// executed, and as such is the logical equivalent of main() or WinMain().
            /// </summary>
            public App()
            {
                this.InitializeComponent();
                this.Suspending += OnSuspending;
            }
    
            /// <summary>
            /// Invoked when the application is launched normally by the end user.  Other entry points
            /// will be used such as when the application is launched to open a specific file.
            /// </summary>
            /// <param name="e">Details about the launch request and process.</param>
            protected override async void OnLaunched(LaunchActivatedEventArgs e)
            {
    
    #if DEBUG
                // Show graphics profiling information while debugging.
                if (System.Diagnostics.Debugger.IsAttached)
                {
                    // Display the current frame rate counters
                    this.DebugSettings.EnableFrameRateCounter = true;
                }
    #endif
    
                Frame rootFrame = Window.Current.Content as Frame;
    
                // Do not repeat app initialization when the Window already has content,
                // just ensure that the window is active
    
                if (rootFrame == null)
                {
                    // Create a Frame to act as the navigation context and navigate to the first page
                    rootFrame = new Frame();
                    //Associate the frame with a SuspensionManager key                                
                    SuspensionManager.RegisterFrame(rootFrame, "AppFrame");
                    // Set the default language
                    rootFrame.Language = Windows.Globalization.ApplicationLanguages.Languages[0];
    
                    rootFrame.NavigationFailed += OnNavigationFailed;
    
                    if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                    {
                        // Restore the saved session state only when appropriate
                        try
                        {
                            await SuspensionManager.RestoreAsync();
                        }
                        catch (SuspensionManagerException)
                        {
                            //Something went wrong restoring state.
                            //Assume there is no state and continue
                        }
                    }
    
                    KinectUserViewer kinectUserViewer = new KinectUserViewer()
    
                    {
    
                        HorizontalAlignment = HorizontalAlignment.Center,
    
                        VerticalAlignment = VerticalAlignment.Top,
    
                        Height = 100,
    
                        Width = 121,
    
                    };
    
                    KinectRegion kinectRegion = new KinectRegion();
    
                    Grid grid = new Grid();
    
                    grid.Children.Add(kinectRegion);
    
                    grid.Children.Add(kinectUserViewer);
    
                    kinectRegion.Content = rootFrame;
    
    
    
                    // Place the frame in the current Window
    
                    Window.Current.Content = grid;
                }
                if (rootFrame.Content == null)
                {
                    // When the navigation stack isn't restored navigate to the first page,
                    // configuring the new page by passing required information as a navigation
                    // parameter
                    rootFrame.Navigate(typeof(GroupedItemsPage), e.Arguments);
                }
                // Ensure the current window is active
                Window.Current.Activate();
            }
    
            /// <summary>
            /// Invoked when Navigation to a certain page fails
            /// </summary>
            /// <param name="sender">The Frame which failed navigation</param>
            /// <param name="e">Details about the navigation failure</param>
            void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
            {
                throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
            }
    
            /// <summary>
            /// Invoked when application execution is being suspended.  Application state is saved
            /// without knowing whether the application will be terminated or resumed with the contents
            /// of memory still intact.
            /// </summary>
            /// <param name="sender">The source of the suspend request.</param>
            /// <param name="e">Details about the suspend request.</param>
            private async void OnSuspending(object sender, SuspendingEventArgs e)
            {
                var deferral = e.SuspendingOperation.GetDeferral();
                await SuspensionManager.SaveAsync();
                deferral.Complete();
            }
        }
    }
    
    App.xaml
    <Application
        x:Class="App15.App"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="using:App15"
        xmlns:localData="using:App15.Data">
    
        <Application.Resources>
    
            <!-- Application-specific resources -->
    
            <x:String x:Key="AppName">App15</x:String>
    
        </Application.Resources>
    </Application>
    

    GroupDetailedpage.xaml

    Page
        x:Name="pageRoot"
        x:Class="App15.GroupDetailPage"
        DataContext="{Binding DefaultViewModel, RelativeSource={RelativeSource Self}}"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="using:App15"
        xmlns:data="using:App15.Data"
        xmlns:common="using:App15.Common"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        mc:Ignorable="d">
    
        <Page.Resources>
            <!-- Collection of items displayed by this page -->
            <CollectionViewSource
                x:Name="itemsViewSource"
                Source="{Binding Items}"
                d:Source="{Binding Groups[0].Items, Source={d:DesignData Source=/DataModel/SampleData.json, Type=data:SampleDataSource}}"/>
        </Page.Resources>
    
        <!--
            This grid acts as a root panel for the page that defines two rows:
            * Row 0 contains the back button and page title
            * Row 1 contains the rest of the page layout
        -->
        <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
            DataContext="{Binding Group}"
            d:DataContext="{Binding Groups[0], Source={d:DesignData Source=/DataModel/SampleData.json, Type=data:SampleDataSource}}">
            <Grid.ChildrenTransitions>
                <TransitionCollection>
                    <EntranceThemeTransition/>
                </TransitionCollection>
            </Grid.ChildrenTransitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="140"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
    
            <!-- Horizontal scrolling grid -->
    
            <GridView
                x:Name="itemGridView"
                AutomationProperties.AutomationId="ItemGridView"
                AutomationProperties.Name="Items In Group"
                TabIndex="1"
                Grid.RowSpan="2"
                Padding="120,126,120,50"
                ItemsSource="{Binding Source={StaticResource itemsViewSource}}"
                SelectionMode="None"
                IsSwipeEnabled="false"
                IsItemClickEnabled="True"
                ItemClick="ItemView_ItemClick">
                <GridView.ItemTemplate>
                    <DataTemplate>
                        <Grid Height="110" Width="480" Margin="10">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            <Border Background="{ThemeResource ListViewItemPlaceholderBackgroundThemeBrush}" Width="110" Height="110">
                                <Image Source="{Binding ImagePath}" Stretch="UniformToFill" AutomationProperties.Name="{Binding Title}"/>
                            </Border>
                            <StackPanel Grid.Column="1" VerticalAlignment="Top" Margin="10,0,0,0">
                                <TextBlock Text="{Binding Title}" Style="{StaticResource TitleTextBlockStyle}" TextWrapping="NoWrap"/>
                                <TextBlock Text="{Binding Subtitle}" Style="{StaticResource CaptionTextBlockStyle}" TextWrapping="NoWrap"/>
                                <TextBlock Text="{Binding Description}" Style="{StaticResource BodyTextBlockStyle}" MaxHeight="60"/>
                            </StackPanel>
                        </Grid>
                    </DataTemplate>
                </GridView.ItemTemplate>
                <GridView.Header>
                    <StackPanel Width="480" Margin="0,4,14,0">
                        <TextBlock Text="{Binding Subtitle}" Margin="0,0,0,20" Style="{StaticResource SubheaderTextBlockStyle}" MaxHeight="60"/>
                        <Image Source="{Binding ImagePath}" Height="400" Margin="0,0,0,20" Stretch="UniformToFill" AutomationProperties.Name="{Binding Title}"/>
                        <TextBlock Text="{Binding Description}" Margin="0,0,0,0" Style="{StaticResource BodyTextBlockStyle}"/>
                    </StackPanel>
                </GridView.Header>
                <GridView.ItemContainerStyle>
                    <Style TargetType="FrameworkElement">
                        <Setter Property="Margin" Value="52,0,0,2"/>
                    </Style>
                </GridView.ItemContainerStyle>
            </GridView>
    
            <!-- Back button and page title -->
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="120"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <Button x:Name="backButton" Margin="39,59,39,0" Command="{Binding NavigationHelper.GoBackCommand, ElementName=pageRoot}"
                            Style="{StaticResource NavigationBackButtonNormalStyle}"
                            VerticalAlignment="Top"
                            AutomationProperties.Name="Back"
                            AutomationProperties.AutomationId="BackButton"
                            AutomationProperties.ItemType="Navigation Button"/>
                <TextBlock x:Name="pageTitle" Text="{Binding Title}" Style="{StaticResource HeaderTextBlockStyle}" Grid.Column="1" 
                            IsHitTestVisible="false" TextWrapping="NoWrap" VerticalAlignment="Bottom" Margin="0,0,30,40"/>
            </Grid>
        </Grid>
    </Page>
    



    • Edited by Gerritcarel Wednesday, August 12, 2015 9:17 AM
    • Moved by Shu 2017 Thursday, August 13, 2015 3:04 AM from VC++ forum
    Wednesday, August 12, 2015 9:12 AM

All replies

  • Hi Gerritcarel,

    Thanks for posting in MSDN forum.

    From your post, it seems there is no C++ code and I cannot see any C++ questions. So your post is off-topic in VC++ forum.

    For Kinect v2 SDK development issue, I suggest you ask to Kinect for Windows v2 SDK forum. This forum discusses dedicated to programming with the Kinect for Windows v2 SDK, so I will move to a better forum. Thanks for your understanding.

    Best regards,

    Shu 


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, August 13, 2015 3:01 AM