none
INuiInstance errors RRS feed

  • Question

  • hello. i'm new in the development with the sdk for the kinect capture system.

    my program will be very simple. i will capture the depth frame from the kinect camera for save a little movie.

    now i have two problems with INuiInstance... here is my code

    kinectsensor.h

    #pragma once

    #include <MSR_NuiApi.h>
    #include <Windows.h>
    #include <vector>

    #include <cv.h>
    #include <cxcore.h>
    #include <highgui.h>

    interface INuiInstance;

    class InstanceInfo
        {
        public:
            INuiInstance * instance;
            HANDLE handle;
        };

    class KinectSensor
    {
    public:
        KinectSensor();
        virtual ~KinectSensor();

        bool    isDeviceOK();
        char*    GetDeviceName();
    protected:
        void Finalize();
        InstanceInfo * GetInstance();
        InstanceInfo instanceInfo;
    };

    kinectsensor.cpp

    #include "kinectSDK.h"
    #include "stdafx.h"

    KinectSensor::KinectSensor( )
    {
        instanceInfo.instance = NULL;
    }

    KinectSensor::~KinectSensor( )
    {
        Finalize( );
    }

    InstanceInfo * KinectSensor::GetInstance()
    {
        if( !instanceInfo.instance )
        {
            if( !( MSR_NuiCreateInstanceByIndex( 0 , &instanceInfo.instance ) ) )
            {
                instanceInfo.handle = NULL;
                return &instanceInfo;
            }
        }
        return NULL;
    }

    void KinectSensor::Finalize( )
    {
        if ( instanceInfo.instance ) instanceInfo.instance->NuiShutdown();
        MSR_NuiDestroyInstance( instanceInfo.instance );
    }

    char* KinectSensor::GetDeviceName()
    {
        char* result;

        DWORD size;

        //InstanceInfo* info = GetInstanceByIndex( index );

        if( instanceInfo.instance != NULL )
        {
    //        INuiInstance * instance = pInstance;
            if( instanceInfo.instance->MSR_NuiGetProbsBlob( MsrNui::INDEX_UNIQUE_DEVICE_NAME, &result, &size )
            {
                return result;
            }
        }

        return "Unknown Kinect Sensor";
    }

    bool KinectSensor::isDeviceOK()
    {
        return GetInstance( ) != NULL;
    }

     

    my first error is the following:

    in this code line : if ( instanceInfo.instance ) instanceInfo.instance->NuiShutdown(); |||| my compiler says "error: pointer to incomplete class type is not allowed

    the second is here:

    MSR_NuiDestroyInstance( instanceInfo.instance ); |||| "Error: expression must have (pointer-to-) function type

    i search for a long time in the internet but still nothing found. i hope that anybody here has a little input how i can resolve my problems...

    sincerly

    westloser86

    Thursday, November 3, 2011 3:55 PM

Answers

  • I'm not sure what your problem would be. I added your

    class InstanceInfo
         { 
        public:
             INuiInstance * instance;
             HANDLE handle; 
        };
     

    declaration to a program and used it without generating compiler errors. If you don't know what's going on, you should start with a smaller application that works but does only a part of what you want, and incrementally add functionality making sure it works at each step. That way you know exactly where the problem was introduced.

    Eddy


    I'm here to help
    Friday, November 4, 2011 7:35 PM