自己动手写Kinect程序(一)

    xiaoxiao2023-05-26  3

    第一步:环境的搭建,比较简单,不做介绍(win8及以上、VS2013、Kinect V2)

    第二步:新建空项目,然后我们将一个Demo中的stdafx.h中的内容拷贝过来

    //------------------------------------------------------------------------------ // <copyright file="stdafx.h" company="Microsoft"> // Copyright (c) Microsoft Corporation. All rights reserved. // </copyright> //------------------------------------------------------------------------------ // include file for standard system and project includes #pragma once #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers //不包含Windows中很少使用的头文件 #endif // Windows Header Files #include <windows.h> #include <Shlobj.h> // Direct2D Header Files #include <d2d1.h> // Kinect Header files #include <Kinect.h> #pragma comment (lib, "d2d1.lib") #ifdef _UNICODE #if defined _M_IX86 //manifest dependency清单依赖 //processor Architecture处理器架构 #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"") #elif defined _M_X64 #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"") #else #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") #endif #endif // Safe release for interfaces // 安全释放接口 template<class Interface> inline void SafeRelease(Interface *& pInterfaceToRelease) { if (pInterfaceToRelease != NULL) { pInterfaceToRelease->Release(); pInterfaceToRelease = NULL; } }

    如果此时不做任何操作,仅仅写一个主函数,会发现有错误无法打开包括文件“Kinect.h”

    因为系统无法找到Kinect.h,所以此时需要对项目进行配置。

    项目->属性->C/C++->常规->附加包含目录中添加$(KINECTSDK20_DIR)\inc;链接器->常规->附加库目录中添加$(KINECTSDK20_DIR)\Lib\x86链接器->输入->附加依赖项中添加kinect20.lib 此时编译运行,程序应该通得过!

    转载请注明原文地址: https://ju.6miu.com/read-1260729.html
    最新回复(0)