Showing preview only (244K chars total). Download the full file or copy to clipboard to get everything.
Repository: elliotwoods/ofxKinectForWindows2
Branch: master
Commit: ce6e3a924854
Files: 81
Total size: 223.1 KB
Directory structure:
gitextract_6bj2llpn/
├── .gitignore
├── README.md
├── addon_config.mk
├── example/
│ ├── addons.make
│ ├── example.sln
│ ├── example.vcxproj
│ ├── example.vcxproj.filters
│ ├── icon.rc
│ └── src/
│ ├── main.cpp
│ ├── ofApp.cpp
│ └── ofApp.h
├── exampleBodyIndexColor/
│ ├── addons.make
│ ├── exampleBodyIndexColor.sln
│ ├── exampleBodyIndexColor.vcxproj
│ ├── exampleBodyIndexColor.vcxproj.filters
│ ├── icon.rc
│ └── src/
│ ├── main.cpp
│ ├── ofApp.cpp
│ └── ofApp.h
├── exampleBodyIndexShader/
│ ├── addons.make
│ ├── example-bodyIndex.sln
│ ├── example-bodyIndex.vcxproj
│ ├── example-bodyIndex.vcxproj.filters
│ ├── icon.rc
│ └── src/
│ ├── main.cpp
│ ├── ofApp.cpp
│ └── ofApp.h
├── exampleDepthMeshShader/
│ ├── README.md
│ ├── addons.make
│ ├── exampleDepthMeshShader.sln
│ ├── exampleDepthMeshShader.vcxproj
│ ├── exampleDepthMeshShader.vcxproj.filters
│ ├── icon.rc
│ └── src/
│ ├── MeshUtils.h
│ ├── main.cpp
│ ├── ofApp.cpp
│ └── ofApp.h
├── exampleDepthToCameraTable/
│ ├── addons.make
│ ├── exampleDepthToCameraTable.sln
│ ├── exampleDepthToCameraTable.vcxproj
│ ├── exampleDepthToCameraTable.vcxproj.filters
│ ├── icon.rc
│ └── src/
│ ├── main.cpp
│ ├── ofApp.cpp
│ └── ofApp.h
├── exampleWithGui/
│ ├── addons.make
│ ├── example.sln
│ ├── example.vcxproj
│ ├── example.vcxproj.filters
│ ├── icon.rc
│ ├── src/
│ │ ├── main.cpp
│ │ ├── ofApp.cpp
│ │ └── ofApp.h
│ └── ~AutoRecover.example.vcxproj
├── ofxKinectForWindows2.props
├── ofxKinectForWindows2Lib/
│ ├── ofxKinectForWindows2Lib.vcxproj
│ └── ofxKinectForWindows2Lib.vcxproj.filters
└── src/
├── ofxKinectForWindows2/
│ ├── Data/
│ │ ├── Body.cpp
│ │ ├── Body.h
│ │ ├── Joint.cpp
│ │ └── Joint.h
│ ├── Device.cpp
│ ├── Device.h
│ ├── Source/
│ │ ├── Base.h
│ │ ├── BaseImage.cpp
│ │ ├── BaseImage.h
│ │ ├── Body.cpp
│ │ ├── Body.h
│ │ ├── BodyIndex.cpp
│ │ ├── BodyIndex.h
│ │ ├── Color.cpp
│ │ ├── Color.h
│ │ ├── Depth.cpp
│ │ ├── Depth.h
│ │ ├── Infrared.cpp
│ │ ├── Infrared.h
│ │ ├── LongExposureInfraRed.cpp
│ │ └── LongExposureInfrared.h
│ ├── Utils.cpp
│ └── Utils.h
└── ofxKinectForWindows2.h
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
libs/
docs/
*.depend
*.layout
*.mode*v3
*.pbxuser
*.app*
*.DS_*
._*.*
.svn/
obj/
bin/
build/
!data/
xcuserdata/
ipch/
*.suo
*.opensdf
*.vcxproj.user
*.db
*.opendb
*.obj
*.tlog
*.sdf
*.pdb
*.idb
*.pch
Debug/
Release/
*~.xml
!exampleDepthMeshShader/bin/data/
================================================
FILE: README.md
================================================
ofxKinectForWindows2
====================

Implementation of Kinect For Windows v2 API using COM (not KinectCommonBridge)
## Important notes
The current version is designed for the upcoming oF 0.10.0 available from GitHub, and works with Visual Studio 2015 (it is not compatible with non-windows platforms).
- If you are working with an 0.9.x release, please use the [`0.9.0` tag](https://github.com/elliotwoods/ofxKinectForWindows2/tree/0.9.0)
- If you are working with an 0.8.x release, please use the [`0.8.4` branch](https://github.com/elliotwoods/ofxKinectForWindows2/tree/0.8.4)
## Features
Currently lets you:
* Grab all the image streams (color, depth, IR, long exposure IR, body index)
* Generate a 3D ofMesh (point cloud or stitched mesh) with texture coordinates
* Track bodies (skeleton points, bone maps)
* Transfer coordinates
Currently doesn't support:
* Audio
* Some remapping functions
## License
MIT License
http://en.wikipedia.org/wiki/MIT_License
## Usage
First install the [Kinect for Windows SDK 2.0](https://www.microsoft.com/en-gb/download/details.aspx?id=44561) installed __(you will need to restart after installing this before all system paths are correctly set)__.
Try the examples to see if they build and run. Then try with your own project:
1. Make your project with Project Generator, but do __not__ select ofxKinectForWindows2 as an addon at this stage
2. Open the solution, and add the ofxKinectForWindows2Lib.vcxproj to your solution (right click on the Solution and choose `Add > Existing Project...`)
3. In `Property Manager` (open it from `View -> Other Windows -> Property Manager`), right click on your project to select `Add Existing Property Sheet...` and select the `ofxKinectForWindows2.props` file.
4. Go back to `Solution Explorer`, right click on your project (e.g. 'mySketch') and select 'Add Reference...', and add a reference to `ofxKinectForWindows2Lib`.
### Alternative Usage with OF Project Generator
This method requires the [OF nightly build](http://ci.openframeworks.cc/nightlybuilds.html) of Project Generator. It will not work with the Project Generator from OF 0.9.8 or earlier.
1. Make your project with Project Generator, **including** the ofxKinectForWindows2 addon, and open in IDE (Visual Studio 2015)
2. In `Property Manager` (open it from `View -> Other Windows -> Property Manager`), right click on your project to select `Add Existing Property Sheet...` and select the `ofxKinectForWindows2.props` file.
## Notes
0. The depth image comes in as 'RAW' mm values (i'm not amplifying the values), so it may appear dark. Look closely :)
1. This addon does not ship with any libraries, it'll look locally on your system for them
2. You'll need to get a copy of the Kinect v2 SDK (i'm testing with v1404 April release)
# Troubleshooting
## Can't find `Kinect.h` or `ofxKinectForWindows2.h`
First, please check that you have the Kinect SDK installed. The `Kinect.h` file should be here on your drive:

Second check that one of the examples shipped with ofxKinectForWindows2 builds and runs.
Third please make sure you're using standard paths, e.g.:
```
addons/ofxKinectForWindows2
apps/myAppFolder/myApp/myApp.sln
```
**If you're using your own path structure then ofxKinectForWindows2 may not work.**
Check that your Solution Explorer has the right settings, e.g.:

Check that the `.props` file has been added correctly, e.g.:

## Make sure the file path to your project isn't too long.
If you encounter errors like `The specified task executable CL.exe could not be run` (or similarly ambiguous errors) it may be that the path to your project is too long for Visual Studio to compile (e.g. if your `openFrameworks` folder is in a subfolder on your Desktop). While there are many solutions to making a shorter path, one easy solution is to move your openFrameworks root directory to something like `C:\of`. [reference](https://github.com/elliotwoods/ofxKinectForWindows2/issues/72).
## Platform
This addon should work with both x86 and x64 platform settings. However, I'm mostly testing with x64 so I'd suggest you use that if you're having issues. Try changing the platfrom setting near the top of the Visual Studio window if you are having troubles.
================================================
FILE: addon_config.mk
================================================
# All variables and this file are optional, if they are not present the PG and the
# makefiles will try to parse the correct values from the file system.
#
# Variables that specify exclusions can use % as a wildcard to specify that anything in
# that position will match. A partial path can also be specified to, for example, exclude
# a whole folder from the parsed paths from the file system
#
# Variables can be specified using = or +=
# = will clear the contents of that variable both specified from the file or the ones parsed
# from the file system
# += will add the values to the previous ones in the file or the ones parsed from the file
# system
#
# The PG can be used to detect errors in this file, just create a new project with this addon
# and the PG will write to the console the kind of error and in which line it is
meta:
# ADDON_NAME =
# ADDON_DESCRIPTION =
# ADDON_AUTHOR =
# ADDON_TAGS =
# ADDON_URL =
common:
# dependencies with other addons, a list of them separated by spaces
# or use += in several lines
# ADDON_DEPENDENCIES =
# include search paths, this will be usually parsed from the file system
# but if the addon or addon libraries need special search paths they can be
# specified here separated by spaces or one per line using +=
# any special flag that should be passed to the compiler when using this
# addon
# ADDON_CFLAGS =
# any special flag that should be passed to the linker when using this
# addon, also used for system libraries with -lname
# ADDON_LDFLAGS =
# linux only, any library that should be included in the project using
# pkg-config
# ADDON_PKG_CONFIG_LIBRARIES =
# osx/iOS only, any framework that should be included in the project
# ADDON_FRAMEWORKS =
# source files, these will be usually parsed from the file system looking
# in the src folders in libs and the root of the addon. if your addon needs
# to include files in different places or a different set of files per platform
# they can be specified here
# ADDON_SOURCES =
# some addons need resources to be copied to the bin/data folder of the project
# specify here any files that need to be copied, you can use wildcards like * and ?
# ADDON_DATA =
# when parsing the file system looking for libraries exclude this for all or
# a specific platform
# ADDON_LIBS_EXCLUDE =
vs:
ADDON_INCLUDES += $(KINECTSDK20_DIR)inc
ADDON_LIBS += $(KINECTSDK20_DIR)Lib\$(PlatformTarget)\Kinect20.lib
linux64:
# binary libraries, these will be usually parsed from the file system but some
# libraries need to passed to the linker in a specific order/
#
# For example in the ofxOpenCV addon we do something like this:
#
# ADDON_LIBS =
# ADDON_LIBS += libs/opencv/lib/linuxarmv6l/libopencv_legacy.a
# ADDON_LIBS += libs/opencv/lib/linuxarmv6l/libopencv_calib3d.a
# ...
linux:
win_cb:
linuxarmv6l:
linuxarmv7l:
android/armeabi:
android/armeabi-v7a:
================================================
FILE: example/addons.make
================================================
================================================
FILE: example/example.sln
================================================
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example", "example.vcxproj", "{7FD42DF7-442E-479A-BA76-D0022F99702A}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openframeworksLib", "..\..\..\libs\openFrameworksCompiled\project\vs\openframeworksLib.vcxproj", "{5837595D-ACA9-485C-8E76-729040CE4B0B}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ofxKinectForWindows2Lib", "..\ofxKinectForWindows2Lib\ofxKinectForWindows2Lib.vcxproj", "{F6008D6A-6D39-4B68-840E-E7AC8ED855DA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|Win32.ActiveCfg = Debug|Win32
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|Win32.Build.0 = Debug|Win32
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|x64.ActiveCfg = Debug|x64
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|x64.Build.0 = Debug|x64
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|Win32.ActiveCfg = Release|Win32
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|Win32.Build.0 = Release|Win32
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|x64.ActiveCfg = Release|x64
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|x64.Build.0 = Release|x64
{5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|Win32.ActiveCfg = Debug|Win32
{5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|Win32.Build.0 = Debug|Win32
{5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|x64.ActiveCfg = Debug|x64
{5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|x64.Build.0 = Debug|x64
{5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|Win32.ActiveCfg = Release|Win32
{5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|Win32.Build.0 = Release|Win32
{5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|x64.ActiveCfg = Release|x64
{5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|x64.Build.0 = Release|x64
{F6008D6A-6D39-4B68-840E-E7AC8ED855DA}.Debug|Win32.ActiveCfg = Debug|Win32
{F6008D6A-6D39-4B68-840E-E7AC8ED855DA}.Debug|Win32.Build.0 = Debug|Win32
{F6008D6A-6D39-4B68-840E-E7AC8ED855DA}.Debug|x64.ActiveCfg = Debug|x64
{F6008D6A-6D39-4B68-840E-E7AC8ED855DA}.Debug|x64.Build.0 = Debug|x64
{F6008D6A-6D39-4B68-840E-E7AC8ED855DA}.Release|Win32.ActiveCfg = Release|Win32
{F6008D6A-6D39-4B68-840E-E7AC8ED855DA}.Release|Win32.Build.0 = Release|Win32
{F6008D6A-6D39-4B68-840E-E7AC8ED855DA}.Release|x64.ActiveCfg = Release|x64
{F6008D6A-6D39-4B68-840E-E7AC8ED855DA}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
================================================
FILE: example/example.vcxproj
================================================
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{7FD42DF7-442E-479A-BA76-D0022F99702A}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>example</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\ofxKinectForWindows2.props" />
<Import Project="..\..\..\libs\openFrameworksCompiled\project\vs\openFrameworksRelease.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\libs\openFrameworksCompiled\project\vs\openFrameworksRelease.props" />
<Import Project="..\ofxKinectForWindows2.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\libs\openFrameworksCompiled\project\vs\openFrameworksDebug.props" />
<Import Project="..\ofxKinectForWindows2.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\libs\openFrameworksCompiled\project\vs\openFrameworksDebug.props" />
<Import Project="..\ofxKinectForWindows2.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>bin\</OutDir>
<IntDir>obj\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)_debug</TargetName>
<LinkIncremental>true</LinkIncremental>
<GenerateManifest>true</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<TargetName>$(ProjectName)_debug</TargetName>
<LinkIncremental>true</LinkIncremental>
<GenerateManifest>true</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>bin\</OutDir>
<IntDir>obj\$(Configuration)\</IntDir>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<AdditionalIncludeDirectories>..\..\..\addons\ofxKinectForWindows2\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalIncludeDirectories>..\..\..\addons\ofxKinectForWindows2\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WholeProgramOptimization>false</WholeProgramOptimization>
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<AdditionalIncludeDirectories>..\..\..\addons\ofxKinectForWindows2\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<Link>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<GenerateDebugInformation>false</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WholeProgramOptimization>false</WholeProgramOptimization>
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<AdditionalIncludeDirectories>..\..\..\addons\ofxKinectForWindows2\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<Link>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<GenerateDebugInformation>false</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="src\main.cpp" />
<ClCompile Include="src\ofApp.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\ofApp.h" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\libs\openFrameworksCompiled\project\vs\openframeworksLib.vcxproj">
<Project>{5837595d-aca9-485c-8e76-729040ce4b0b}</Project>
</ProjectReference>
<ProjectReference Include="..\ofxKinectForWindows2Lib\ofxKinectForWindows2Lib.vcxproj">
<Project>{f6008d6a-6d39-4b68-840e-e7ac8ed855da}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="icon.rc">
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">/D_DEBUG %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">/D_DEBUG %(AdditionalOptions)</AdditionalOptions>
</ResourceCompile>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
</Project>
================================================
FILE: example/example.vcxproj.filters
================================================
<?xml version="1.0"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="src\ofApp.cpp">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="src\main.cpp">
<Filter>src</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Filter Include="src">
<UniqueIdentifier>{d8376475-7454-4a24-b08a-aac121d3ad6f}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\ofApp.h">
<Filter>src</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="icon.rc" />
</ItemGroup>
</Project>
================================================
FILE: example/icon.rc
================================================
// Icon Resource Definition
#define MAIN_ICON 102
#if defined(_DEBUG)
MAIN_ICON ICON "..\..\..\libs\openFrameworksCompiled\project\vs\icon_debug.ico"
#else
MAIN_ICON ICON "..\..\..\libs\openFrameworksCompiled\project\vs\icon.ico"
#endif
================================================
FILE: example/src/main.cpp
================================================
#include "ofApp.h"
//========================================================================
int main( ){
ofSetupOpenGL(1024,768,OF_WINDOW); // <-------- setup the GL context
// this kicks off the running of my app
// can be OF_WINDOW or OF_FULLSCREEN
// pass in width and height too:
ofRunApp(new ofApp());
}
================================================
FILE: example/src/ofApp.cpp
================================================
#include "ofApp.h"
int previewWidth = 640;
int previewHeight = 480;
//--------------------------------------------------------------
void ofApp::setup(){
kinect.open();
kinect.initDepthSource();
kinect.initColorSource();
kinect.initInfraredSource();
kinect.initBodySource();
kinect.initBodyIndexSource();
ofSetWindowShape(previewWidth * 2, previewHeight * 2);
}
//--------------------------------------------------------------
void ofApp::update(){
kinect.update();
//--
//Getting joint positions (skeleton tracking)
//--
//
{
auto bodies = kinect.getBodySource()->getBodies();
for (auto body : bodies) {
for (auto joint : body.joints) {
//now do something with the joints
}
}
}
//
//--
//--
//Getting bones (connected joints)
//--
//
{
// Note that for this we need a reference of which joints are connected to each other.
// We call this the 'boneAtlas', and you can ask for a reference to this atlas whenever you like
auto bodies = kinect.getBodySource()->getBodies();
auto boneAtlas = ofxKinectForWindows2::Data::Body::getBonesAtlas();
for (auto body : bodies) {
for (auto bone : boneAtlas) {
auto firstJointInBone = body.joints[bone.first];
auto secondJointInBone = body.joints[bone.second];
//now do something with the joints
}
}
}
//
//--
}
//--------------------------------------------------------------
void ofApp::draw(){
kinect.getDepthSource()->draw(0, 0, previewWidth, previewHeight); // note that the depth texture is RAW so may appear dark
// Color is at 1920x1080 instead of 512x424 so we should fix aspect ratio
float colorHeight = previewWidth * (kinect.getColorSource()->getHeight() / kinect.getColorSource()->getWidth());
float colorTop = (previewHeight - colorHeight) / 2.0;
kinect.getColorSource()->draw(previewWidth, 0 + colorTop, previewWidth, colorHeight);
kinect.getBodySource()->drawProjected(previewWidth, 0 + colorTop, previewWidth, colorHeight);
kinect.getInfraredSource()->draw(0, previewHeight, previewWidth, previewHeight);
kinect.getBodyIndexSource()->draw(previewWidth, previewHeight, previewWidth, previewHeight);
kinect.getBodySource()->drawProjected(previewWidth, previewHeight, previewWidth, previewHeight, ofxKFW2::ProjectionCoordinates::DepthCamera);
}
//--------------------------------------------------------------
void ofApp::keyPressed(int key){
}
//--------------------------------------------------------------
void ofApp::keyReleased(int key){
}
//--------------------------------------------------------------
void ofApp::mouseMoved(int x, int y){
}
//--------------------------------------------------------------
void ofApp::mouseDragged(int x, int y, int button){
}
//--------------------------------------------------------------
void ofApp::mousePressed(int x, int y, int button){
}
//--------------------------------------------------------------
void ofApp::mouseReleased(int x, int y, int button){
}
//--------------------------------------------------------------
void ofApp::windowResized(int w, int h){
}
//--------------------------------------------------------------
void ofApp::gotMessage(ofMessage msg){
}
//--------------------------------------------------------------
void ofApp::dragEvent(ofDragInfo dragInfo){
}
================================================
FILE: example/src/ofApp.h
================================================
#pragma once
#include "ofxKinectForWindows2.h"
#include "ofMain.h"
class ofApp : public ofBaseApp{
public:
void setup();
void update();
void draw();
void keyPressed(int key);
void keyReleased(int key);
void mouseMoved(int x, int y );
void mouseDragged(int x, int y, int button);
void mousePressed(int x, int y, int button);
void mouseReleased(int x, int y, int button);
void windowResized(int w, int h);
void dragEvent(ofDragInfo dragInfo);
void gotMessage(ofMessage msg);
ofxKFW2::Device kinect;
};
================================================
FILE: exampleBodyIndexColor/addons.make
================================================
================================================
FILE: exampleBodyIndexColor/exampleBodyIndexColor.sln
================================================
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "exampleBodyIndexColor", "exampleBodyIndexColor.vcxproj", "{7FD42DF7-442E-479A-BA76-D0022F99702A}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openframeworksLib", "..\..\..\libs\openFrameworksCompiled\project\vs\openframeworksLib.vcxproj", "{5837595D-ACA9-485C-8E76-729040CE4B0B}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ofxKinectForWindows2Lib", "..\ofxKinectForWindows2Lib\ofxKinectForWindows2Lib.vcxproj", "{F6008D6A-6D39-4B68-840E-E7AC8ED855DA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|Win32.ActiveCfg = Debug|Win32
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|Win32.Build.0 = Debug|Win32
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|x64.ActiveCfg = Debug|x64
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|x64.Build.0 = Debug|x64
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|Win32.ActiveCfg = Release|Win32
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|Win32.Build.0 = Release|Win32
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|x64.ActiveCfg = Release|x64
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|x64.Build.0 = Release|x64
{5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|Win32.ActiveCfg = Debug|Win32
{5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|Win32.Build.0 = Debug|Win32
{5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|x64.ActiveCfg = Debug|x64
{5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|x64.Build.0 = Debug|x64
{5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|Win32.ActiveCfg = Release|Win32
{5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|Win32.Build.0 = Release|Win32
{5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|x64.ActiveCfg = Release|x64
{5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|x64.Build.0 = Release|x64
{F6008D6A-6D39-4B68-840E-E7AC8ED855DA}.Debug|Win32.ActiveCfg = Debug|Win32
{F6008D6A-6D39-4B68-840E-E7AC8ED855DA}.Debug|Win32.Build.0 = Debug|Win32
{F6008D6A-6D39-4B68-840E-E7AC8ED855DA}.Debug|x64.ActiveCfg = Debug|x64
{F6008D6A-6D39-4B68-840E-E7AC8ED855DA}.Debug|x64.Build.0 = Debug|x64
{F6008D6A-6D39-4B68-840E-E7AC8ED855DA}.Release|Win32.ActiveCfg = Release|Win32
{F6008D6A-6D39-4B68-840E-E7AC8ED855DA}.Release|Win32.Build.0 = Release|Win32
{F6008D6A-6D39-4B68-840E-E7AC8ED855DA}.Release|x64.ActiveCfg = Release|x64
{F6008D6A-6D39-4B68-840E-E7AC8ED855DA}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
================================================
FILE: exampleBodyIndexColor/exampleBodyIndexColor.vcxproj
================================================
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{7FD42DF7-442E-479A-BA76-D0022F99702A}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>exampleBodyIndexColor</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\libs\openFrameworksCompiled\project\vs\openFrameworksRelease.props" />
<Import Project="..\ofxKinectForWindows2.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\libs\openFrameworksCompiled\project\vs\openFrameworksRelease.props" />
<Import Project="..\ofxKinectForWindows2.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\libs\openFrameworksCompiled\project\vs\openFrameworksDebug.props" />
<Import Project="..\ofxKinectForWindows2.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\libs\openFrameworksCompiled\project\vs\openFrameworksDebug.props" />
<Import Project="..\ofxKinectForWindows2.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>bin\</OutDir>
<IntDir>obj\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)_debug</TargetName>
<LinkIncremental>true</LinkIncremental>
<GenerateManifest>true</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>bin\</OutDir>
<IntDir>obj\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)_debug</TargetName>
<LinkIncremental>true</LinkIncremental>
<GenerateManifest>true</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>bin\</OutDir>
<IntDir>obj\$(Configuration)\</IntDir>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>bin\</OutDir>
<IntDir>obj\$(Configuration)\</IntDir>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<PostBuildEvent />
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CompileAs>CompileAsCpp</CompileAs>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<PostBuildEvent />
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WholeProgramOptimization>false</WholeProgramOptimization>
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CompileAs>CompileAsCpp</CompileAs>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<GenerateDebugInformation>false</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<PostBuildEvent />
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WholeProgramOptimization>false</WholeProgramOptimization>
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<Link>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<GenerateDebugInformation>false</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<PostBuildEvent />
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="src\main.cpp" />
<ClCompile Include="src\ofApp.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\ofApp.h" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(OF_ROOT)\libs\openFrameworksCompiled\project\vs\openframeworksLib.vcxproj">
<Project>{5837595d-aca9-485c-8e76-729040ce4b0b}</Project>
</ProjectReference>
<ProjectReference Include="..\ofxKinectForWindows2Lib\ofxKinectForWindows2Lib.vcxproj">
<Project>{f6008d6a-6d39-4b68-840e-e7ac8ed855da}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="icon.rc">
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">/D_DEBUG %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">/D_DEBUG %(AdditionalOptions)</AdditionalOptions>
<AdditionalIncludeDirectories>$(OF_ROOT)\libs\openFrameworksCompiled\project\vs</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ProjectExtensions>
<VisualStudio>
<UserProperties RESOURCE_FILE="icon.rc" />
</VisualStudio>
</ProjectExtensions>
</Project>
================================================
FILE: exampleBodyIndexColor/exampleBodyIndexColor.vcxproj.filters
================================================
<?xml version="1.0"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="src\ofApp.cpp">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="src\main.cpp">
<Filter>src</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Filter Include="src">
<UniqueIdentifier>{d8376475-7454-4a24-b08a-aac121d3ad6f}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\ofApp.h">
<Filter>src</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="icon.rc" />
</ItemGroup>
</Project>
================================================
FILE: exampleBodyIndexColor/icon.rc
================================================
// Icon Resource Definition
#define MAIN_ICON 102
#if defined(_DEBUG)
MAIN_ICON ICON "icon_debug.ico"
#else
MAIN_ICON ICON "icon.ico"
#endif
================================================
FILE: exampleBodyIndexColor/src/main.cpp
================================================
#include "ofApp.h"
//========================================================================
int main( ){
ofSetupOpenGL(1024,768,OF_WINDOW); // <-------- setup the GL context
// this kicks off the running of my app
// can be OF_WINDOW or OF_FULLSCREEN
// pass in width and height too:
ofRunApp(new ofApp());
}
================================================
FILE: exampleBodyIndexColor/src/ofApp.cpp
================================================
// This example shows how to work with the BodyIndex image in order to create
// a green screen effect. Note that this isn't super fast, but is helpful
// in understanding how the different image types & coordinate spaces work
// together. If you need performance, you will probably want to do this with shaders!
#include "ofApp.h"
#define DEPTH_WIDTH 512
#define DEPTH_HEIGHT 424
#define DEPTH_SIZE DEPTH_WIDTH * DEPTH_HEIGHT
#define COLOR_WIDTH 1920
#define COLOR_HEIGHT 1080
//--------------------------------------------------------------
void ofApp::setup() {
ofSetWindowShape(DEPTH_WIDTH * 2, DEPTH_HEIGHT);
kinect.open();
kinect.initDepthSource();
kinect.initColorSource();
kinect.initInfraredSource();
kinect.initBodySource();
kinect.initBodyIndexSource();
if (kinect.getSensor()->get_CoordinateMapper(&coordinateMapper) < 0) {
ofLogError() << "Could not acquire CoordinateMapper!";
}
numBodiesTracked = 0;
bHaveAllStreams = false;
bodyIndexImg.allocate(DEPTH_WIDTH, DEPTH_HEIGHT, OF_IMAGE_COLOR);
foregroundImg.allocate(DEPTH_WIDTH, DEPTH_HEIGHT, OF_IMAGE_COLOR);
colorCoords.resize(DEPTH_WIDTH * DEPTH_HEIGHT);
}
//--------------------------------------------------------------
void ofApp::update() {
kinect.update();
// Get pixel data
auto& depthPix = kinect.getDepthSource()->getPixels();
auto& bodyIndexPix = kinect.getBodyIndexSource()->getPixels();
auto& colorPix = kinect.getColorSource()->getPixels();
// Make sure there's some data here, otherwise the cam probably isn't ready yet
if (!depthPix.size() || !bodyIndexPix.size() || !colorPix.size()) {
bHaveAllStreams = false;
return;
} else {
bHaveAllStreams = true;
}
// Count number of tracked bodies
numBodiesTracked = 0;
auto& bodies = kinect.getBodySource()->getBodies();
for (auto& body : bodies) {
if (body.tracked) {
numBodiesTracked++;
}
}
// Do the depth space -> color space mapping
// More info here:
// https://msdn.microsoft.com/en-us/library/windowspreview.kinect.coordinatemapper.mapdepthframetocolorspace.aspx
// https://msdn.microsoft.com/en-us/library/dn785530.aspx
coordinateMapper->MapDepthFrameToColorSpace(DEPTH_SIZE, (UINT16*) depthPix.getPixels(), DEPTH_SIZE, (ColorSpacePoint*) colorCoords.data());
// Loop through the depth image
for (int y = 0; y < DEPTH_HEIGHT; y++) {
for (int x = 0; x < DEPTH_WIDTH; x++) {
int index = (y * DEPTH_WIDTH) + x;
bodyIndexImg.setColor(x, y, ofColor::white);
foregroundImg.setColor(x, y, ofColor::white);
// This is the check to see if a given pixel is inside a tracked body or part of the background.
// If it's part of a body, the value will be that body's id (0-5), or will > 5 if it's
// part of the background
// More info here:
// https://msdn.microsoft.com/en-us/library/windowspreview.kinect.bodyindexframe.aspx
float val = bodyIndexPix[index];
if (val >= bodies.size()) {
continue;
}
// Give each tracked body a color value so we can tell
// them apart on screen
ofColor c = ofColor::fromHsb(val * 255 / bodies.size(), 200, 255);
bodyIndexImg.setColor(x, y, c);
// For a given (x,y) in the depth image, lets look up where that point would be
// in the color image
ofVec2f mappedCoord = colorCoords[index];
// Mapped x/y coordinates in the color can come out as floats since it's not a 1:1 mapping
// between depth <-> color spaces i.e. a pixel at (100, 100) in the depth image could map
// to (405.84637, 238.13828) in color space
// So round the x/y values down to ints so that we can look up the nearest pixel
mappedCoord.x = floor(mappedCoord.x);
mappedCoord.y = floor(mappedCoord.y);
// Make sure it's within some sane bounds, and skip it otherwise
if (mappedCoord.x < 0 || mappedCoord.y < 0 || mappedCoord.x >= COLOR_WIDTH || mappedCoord.y >= COLOR_HEIGHT) {
continue;
}
// Finally, pull the color from the color image based on its coords in
// the depth image
foregroundImg.setColor(x, y, colorPix.getColor(mappedCoord.x, mappedCoord.y));
}
}
// Update the images since we manipulated the pixels manually. This uploads to the
// pixel data to the texture on the GPU so it can get drawn to screen
bodyIndexImg.update();
foregroundImg.update();
}
//--------------------------------------------------------------
void ofApp::draw() {
bodyIndexImg.draw(0, 0);
foregroundImg.draw(DEPTH_WIDTH, 0);
stringstream ss;
ss << "fps : " << ofGetFrameRate() << endl;
ss << "Tracked bodies: " << numBodiesTracked;
if (!bHaveAllStreams) ss << endl << "Not all streams detected!";
ofDrawBitmapStringHighlight(ss.str(), 20, 20);
}
//--------------------------------------------------------------
void ofApp::keyPressed(int key){
}
//--------------------------------------------------------------
void ofApp::keyReleased(int key){
}
//--------------------------------------------------------------
void ofApp::mouseMoved(int x, int y ){
}
//--------------------------------------------------------------
void ofApp::mouseDragged(int x, int y, int button){
}
//--------------------------------------------------------------
void ofApp::mousePressed(int x, int y, int button){
}
//--------------------------------------------------------------
void ofApp::mouseReleased(int x, int y, int button){
}
//--------------------------------------------------------------
void ofApp::mouseEntered(int x, int y){
}
//--------------------------------------------------------------
void ofApp::mouseExited(int x, int y){
}
//--------------------------------------------------------------
void ofApp::windowResized(int w, int h){
}
//--------------------------------------------------------------
void ofApp::gotMessage(ofMessage msg){
}
//--------------------------------------------------------------
void ofApp::dragEvent(ofDragInfo dragInfo){
}
================================================
FILE: exampleBodyIndexColor/src/ofApp.h
================================================
#pragma once
#include "ofxKinectForWindows2.h"
#include "ofMain.h"
class ofApp : public ofBaseApp{
public:
void setup();
void update();
void draw();
void keyPressed(int key);
void keyReleased(int key);
void mouseMoved(int x, int y );
void mouseDragged(int x, int y, int button);
void mousePressed(int x, int y, int button);
void mouseReleased(int x, int y, int button);
void mouseEntered(int x, int y);
void mouseExited(int x, int y);
void windowResized(int w, int h);
void dragEvent(ofDragInfo dragInfo);
void gotMessage(ofMessage msg);
ofxKFW2::Device kinect;
ICoordinateMapper* coordinateMapper;
ofImage bodyIndexImg, foregroundImg;
vector<ofVec2f> colorCoords;
int numBodiesTracked;
bool bHaveAllStreams;
};
================================================
FILE: exampleBodyIndexShader/addons.make
================================================
================================================
FILE: exampleBodyIndexShader/example-bodyIndex.sln
================================================
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openframeworksLib", "..\..\..\libs\openFrameworksCompiled\project\vs\openframeworksLib.vcxproj", "{5837595D-ACA9-485C-8E76-729040CE4B0B}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ofxKinectForWindows2Lib", "..\ofxKinectForWindows2Lib\ofxKinectForWindows2Lib.vcxproj", "{F6008D6A-6D39-4B68-840E-E7AC8ED855DA}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example-bodyIndex", "example-bodyIndex.vcxproj", "{7FD42DF7-442E-479A-BA76-D0022F99702A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|Win32.ActiveCfg = Debug|Win32
{5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|Win32.Build.0 = Debug|Win32
{5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|x64.ActiveCfg = Debug|x64
{5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|x64.Build.0 = Debug|x64
{5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|Win32.ActiveCfg = Release|Win32
{5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|Win32.Build.0 = Release|Win32
{5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|x64.ActiveCfg = Release|x64
{F6008D6A-6D39-4B68-840E-E7AC8ED855DA}.Debug|Win32.ActiveCfg = Debug|Win32
{F6008D6A-6D39-4B68-840E-E7AC8ED855DA}.Debug|Win32.Build.0 = Debug|Win32
{F6008D6A-6D39-4B68-840E-E7AC8ED855DA}.Debug|x64.ActiveCfg = Debug|x64
{F6008D6A-6D39-4B68-840E-E7AC8ED855DA}.Debug|x64.Build.0 = Debug|x64
{F6008D6A-6D39-4B68-840E-E7AC8ED855DA}.Release|Win32.ActiveCfg = Release|Win32
{F6008D6A-6D39-4B68-840E-E7AC8ED855DA}.Release|Win32.Build.0 = Release|Win32
{F6008D6A-6D39-4B68-840E-E7AC8ED855DA}.Release|x64.ActiveCfg = Release|x64
{F6008D6A-6D39-4B68-840E-E7AC8ED855DA}.Release|x64.Build.0 = Release|x64
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|Win32.ActiveCfg = Debug|Win32
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|Win32.Build.0 = Debug|Win32
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|x64.ActiveCfg = Debug|x64
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|x64.Build.0 = Debug|x64
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|Win32.ActiveCfg = Release|Win32
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|Win32.Build.0 = Release|Win32
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|x64.ActiveCfg = Release|x64
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
================================================
FILE: exampleBodyIndexShader/example-bodyIndex.vcxproj
================================================
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{7FD42DF7-442E-479A-BA76-D0022F99702A}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>example</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\ofxKinectForWindows2.props" />
<Import Project="..\..\..\libs\openFrameworksCompiled\project\vs\openFrameworksRelease.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\libs\openFrameworksCompiled\project\vs\openFrameworksRelease.props" />
<Import Project="..\ofxKinectForWindows2.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\libs\openFrameworksCompiled\project\vs\openFrameworksDebug.props" />
<Import Project="..\ofxKinectForWindows2.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\libs\openFrameworksCompiled\project\vs\openFrameworksDebug.props" />
<Import Project="..\ofxKinectForWindows2.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>bin\</OutDir>
<IntDir>obj\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)_debug</TargetName>
<LinkIncremental>true</LinkIncremental>
<GenerateManifest>true</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<TargetName>$(ProjectName)_debug</TargetName>
<LinkIncremental>true</LinkIncremental>
<GenerateManifest>true</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>bin\</OutDir>
<IntDir>obj\$(Configuration)\</IntDir>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<AdditionalIncludeDirectories>..\..\..\addons\ofxKinectForWindows2\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalIncludeDirectories>..\..\..\addons\ofxKinectForWindows2\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WholeProgramOptimization>false</WholeProgramOptimization>
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<AdditionalIncludeDirectories>..\..\..\addons\ofxKinectForWindows2\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<Link>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<GenerateDebugInformation>false</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WholeProgramOptimization>false</WholeProgramOptimization>
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<AdditionalIncludeDirectories>..\..\..\addons\ofxKinectForWindows2\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<Link>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<GenerateDebugInformation>false</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="src\main.cpp" />
<ClCompile Include="src\ofApp.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\ofApp.h" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\libs\openFrameworksCompiled\project\vs\openframeworksLib.vcxproj">
<Project>{5837595d-aca9-485c-8e76-729040ce4b0b}</Project>
</ProjectReference>
<ProjectReference Include="..\ofxKinectForWindows2Lib\ofxKinectForWindows2Lib.vcxproj">
<Project>{f6008d6a-6d39-4b68-840e-e7ac8ed855da}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="icon.rc">
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">/D_DEBUG %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">/D_DEBUG %(AdditionalOptions)</AdditionalOptions>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<None Include="bin\data\shaders\bodyIndex.frag" />
<None Include="bin\data\shaders\bodyIndex.vert" />
<None Include="bin\data\shaders_gl3\bodyIndex.frag" />
<None Include="bin\data\shaders_gl3\bodyIndex.vert" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
</Project>
================================================
FILE: exampleBodyIndexShader/example-bodyIndex.vcxproj.filters
================================================
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="src\ofApp.cpp">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="src\main.cpp">
<Filter>src</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Filter Include="src">
<UniqueIdentifier>{d8376475-7454-4a24-b08a-aac121d3ad6f}</UniqueIdentifier>
</Filter>
<Filter Include="shaders">
<UniqueIdentifier>{8112424a-9e0b-4e75-931f-a6d5cdf47e1f}</UniqueIdentifier>
</Filter>
<Filter Include="shaders_gl3">
<UniqueIdentifier>{2875c5c0-c98f-40e0-bd5a-23769bd78f9a}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\ofApp.h">
<Filter>src</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="icon.rc" />
</ItemGroup>
<ItemGroup>
<None Include="bin\data\shaders\bodyIndex.vert">
<Filter>shaders</Filter>
</None>
<None Include="bin\data\shaders\bodyIndex.frag">
<Filter>shaders</Filter>
</None>
<None Include="bin\data\shaders_gl3\bodyIndex.frag">
<Filter>shaders_gl3</Filter>
</None>
<None Include="bin\data\shaders_gl3\bodyIndex.vert">
<Filter>shaders_gl3</Filter>
</None>
</ItemGroup>
</Project>
================================================
FILE: exampleBodyIndexShader/icon.rc
================================================
// Icon Resource Definition
#define MAIN_ICON 102
#if defined(_DEBUG)
MAIN_ICON ICON "..\..\..\libs\openFrameworksCompiled\project\vs\icon_debug.ico"
#else
MAIN_ICON ICON "..\..\..\libs\openFrameworksCompiled\project\vs\icon.ico"
#endif
================================================
FILE: exampleBodyIndexShader/src/main.cpp
================================================
#include "ofApp.h"
//--------------------------------------------------------------
int main(){
#ifdef USE_PROGRAMMABLE_PIPELINE
ofGLWindowSettings settings;
settings.setGLVersion(4,3);
settings.width = 1024;
settings.height = 768;
ofCreateWindow(settings);
#else
ofSetupOpenGL(1024, 768, OF_WINDOW);
#endif
ofRunApp(new ofApp());
}
================================================
FILE: exampleBodyIndexShader/src/ofApp.cpp
================================================
#include "ofApp.h"
//--------------------------------------------------------------
void ofApp::setup(){
kinect.open();
kinect.initDepthSource();
kinect.initColorSource();
kinect.initBodySource();
kinect.initBodyIndexSource();
bStitchFaces = false;
bDrawBodies = true;
if (ofIsGLProgrammableRenderer()) {
shader.load("shaders_gl3/bodyIndex");
}
else {
shader.load("shaders/bodyIndex");
}
}
//--------------------------------------------------------------
void ofApp::update(){
kinect.update();
}
//--------------------------------------------------------------
void ofApp::draw(){
cam.begin();
ofPushMatrix();
ofScale(100, 100, 100);
shader.begin();
shader.setUniform1i("uWidth", kinect.getBodyIndexSource()->getWidth());
if (ofIsGLProgrammableRenderer()) {
shader.setUniformTexture("uBodyIndexTex", kinect.getBodyIndexSource()->getTexture(), 1);
shader.setUniformTexture("uColorTex", kinect.getColorSource()->getTexture(), 2);
}
else {
// TEMP: Until OF master fixes texture binding for old pipeline.
shader.setUniform1i("uBodyIndexTex", 1);
kinect.getBodyIndexSource()->getTexture().bind(1);
shader.setUniform1i("uColorTex", 2);
kinect.getColorSource()->getTexture().bind(2);
}
ofSetColor(255);
ofMesh mesh = kinect.getDepthSource()->getMesh(bStitchFaces, ofxKFW2::Source::Depth::PointCloudOptions::ColorCamera);
mesh.draw();
if (!ofIsGLProgrammableRenderer()) {
// TEMP: Until OF master fixes texture binding for old pipeline.
kinect.getColorSource()->getTexture().unbind(2);
kinect.getBodyIndexSource()->getTexture().unbind(1);
}
shader.end();
if (bDrawBodies) {
kinect.getBodySource()->drawWorld();
}
ofPopMatrix();
cam.end();
ofSetColor(0);
stringstream ss;
ss << ofToString(ofGetFrameRate(), 2) << " FPS" << endl;
ss << "Stitch [F]aces: " << (bStitchFaces? "ON":"OFF") << endl;
ss << "Draw [B]odies: " << (bDrawBodies? "ON":"OFF") << endl;
ofDrawBitmapString(ss.str(), 10, 20);
}
//--------------------------------------------------------------
void ofApp::keyPressed(int key){
switch (key) {
case 'b':
bDrawBodies ^= 1;
break;
case 'f':
bStitchFaces ^= 1;
break;
}
}
//--------------------------------------------------------------
void ofApp::keyReleased(int key){
}
//--------------------------------------------------------------
void ofApp::mouseMoved(int x, int y){
}
//--------------------------------------------------------------
void ofApp::mouseDragged(int x, int y, int button){
}
//--------------------------------------------------------------
void ofApp::mousePressed(int x, int y, int button){
}
//--------------------------------------------------------------
void ofApp::mouseReleased(int x, int y, int button){
}
//--------------------------------------------------------------
void ofApp::windowResized(int w, int h){
}
//--------------------------------------------------------------
void ofApp::gotMessage(ofMessage msg){
}
//--------------------------------------------------------------
void ofApp::dragEvent(ofDragInfo dragInfo){
}
================================================
FILE: exampleBodyIndexShader/src/ofApp.h
================================================
#pragma once
#define USE_PROGRAMMABLE_PIPELINE 1
#include "ofxKinectForWindows2.h"
#include "ofMain.h"
class ofApp : public ofBaseApp{
public:
void setup();
void update();
void draw();
void keyPressed(int key);
void keyReleased(int key);
void mouseMoved(int x, int y );
void mouseDragged(int x, int y, int button);
void mousePressed(int x, int y, int button);
void mouseReleased(int x, int y, int button);
void windowResized(int w, int h);
void dragEvent(ofDragInfo dragInfo);
void gotMessage(ofMessage msg);
ofxKFW2::Device kinect;
ofEasyCam cam;
ofShader shader;
bool bStitchFaces;
bool bDrawBodies;
};
================================================
FILE: exampleDepthMeshShader/README.md
================================================
ofxKinectForWindows2 (exampleDepthMeshShader)
====================

The author of this example and the accompanying shaders are made by Lesley van Hoek\
https://github.com/lshoek
## Description
This example showcases how to build a mesh from the depth source using shaders. It is able to realize a full-resolution, textured and filtered depth mesh in a steady +/- 1ms on a GTX 1050. This is significantly faster than the `Depth::getDepthMesh()` call, which can quickly become a big bottleneck depending on your application. So this is great if you're looking to get around this!
## How does it work?
The vertices, indices and texture coordinates of the (VBO) mesh are generated on the GPU using compute shaders. First, a depth texture is acquired from the Kinect using the `ofxKinectForWindows2` API. This is then sent to a shader program that transforms each pixel to camera space and writes them to a vertex buffer. This is fast because this data resides on the GPU, so it does not have to be copied to/from the CPU. Another shader program filters the mesh by manipulating the mesh indices in the index buffer. The color frame texture coordinates are also queried from `ofxKinectForWindows2` and sent directly to the texture coordinate buffer of the mesh.
## Notes
If you have any questions or issues running this you're welcome to report them here or to me.
## License
MIT License
http://en.wikipedia.org/wiki/MIT_License
================================================
FILE: exampleDepthMeshShader/addons.make
================================================
================================================
FILE: exampleDepthMeshShader/exampleDepthMeshShader.sln
================================================
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30114.105
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "exampleDepthMeshShader", "exampleDepthMeshShader.vcxproj", "{7FD42DF7-442E-479A-BA76-D0022F99702A}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openframeworksLib", "..\..\..\libs\openFrameworksCompiled\project\vs\openframeworksLib.vcxproj", "{5837595D-ACA9-485C-8E76-729040CE4B0B}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ofxKinectForWindows2Lib", "..\ofxKinectForWindows2Lib\ofxKinectForWindows2Lib.vcxproj", "{F6008D6A-6D39-4B68-840E-E7AC8ED855DA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|Win32.ActiveCfg = Debug|Win32
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|Win32.Build.0 = Debug|Win32
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|x64.ActiveCfg = Debug|x64
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|x64.Build.0 = Debug|x64
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|Win32.ActiveCfg = Release|Win32
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|Win32.Build.0 = Release|Win32
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|x64.ActiveCfg = Release|x64
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|x64.Build.0 = Release|x64
{5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|Win32.ActiveCfg = Debug|Win32
{5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|Win32.Build.0 = Debug|Win32
{5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|x64.ActiveCfg = Debug|x64
{5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|x64.Build.0 = Debug|x64
{5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|Win32.ActiveCfg = Release|Win32
{5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|Win32.Build.0 = Release|Win32
{5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|x64.ActiveCfg = Release|x64
{5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|x64.Build.0 = Release|x64
{F6008D6A-6D39-4B68-840E-E7AC8ED855DA}.Debug|Win32.ActiveCfg = Debug|Win32
{F6008D6A-6D39-4B68-840E-E7AC8ED855DA}.Debug|Win32.Build.0 = Debug|Win32
{F6008D6A-6D39-4B68-840E-E7AC8ED855DA}.Debug|x64.ActiveCfg = Debug|x64
{F6008D6A-6D39-4B68-840E-E7AC8ED855DA}.Debug|x64.Build.0 = Debug|x64
{F6008D6A-6D39-4B68-840E-E7AC8ED855DA}.Release|Win32.ActiveCfg = Release|Win32
{F6008D6A-6D39-4B68-840E-E7AC8ED855DA}.Release|Win32.Build.0 = Release|Win32
{F6008D6A-6D39-4B68-840E-E7AC8ED855DA}.Release|x64.ActiveCfg = Release|x64
{F6008D6A-6D39-4B68-840E-E7AC8ED855DA}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4C20F4FB-30B0-45D7-B223-78E22E27E7FC}
EndGlobalSection
EndGlobal
================================================
FILE: exampleDepthMeshShader/exampleDepthMeshShader.vcxproj
================================================
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{7FD42DF7-442E-479A-BA76-D0022F99702A}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>exampleDepthMeshShader</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\libs\openFrameworksCompiled\project\vs\openFrameworksRelease.props" />
<Import Project="..\ofxKinectForWindows2.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\libs\openFrameworksCompiled\project\vs\openFrameworksRelease.props" />
<Import Project="..\ofxKinectForWindows2.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\libs\openFrameworksCompiled\project\vs\openFrameworksDebug.props" />
<Import Project="..\ofxKinectForWindows2.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\libs\openFrameworksCompiled\project\vs\openFrameworksDebug.props" />
<Import Project="..\ofxKinectForWindows2.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>bin\</OutDir>
<IntDir>obj\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)_debug</TargetName>
<LinkIncremental>true</LinkIncremental>
<GenerateManifest>true</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>bin\</OutDir>
<IntDir>obj\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)_debug</TargetName>
<LinkIncremental>true</LinkIncremental>
<GenerateManifest>true</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>bin\</OutDir>
<IntDir>obj\$(Configuration)\</IntDir>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>bin\</OutDir>
<IntDir>obj\$(Configuration)\</IntDir>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<PostBuildEvent />
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CompileAs>CompileAsCpp</CompileAs>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<PostBuildEvent />
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WholeProgramOptimization>false</WholeProgramOptimization>
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CompileAs>CompileAsCpp</CompileAs>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<GenerateDebugInformation>false</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<PostBuildEvent />
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WholeProgramOptimization>false</WholeProgramOptimization>
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<Link>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<GenerateDebugInformation>false</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<PostBuildEvent />
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="src\main.cpp" />
<ClCompile Include="src\ofApp.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\MeshUtils.h" />
<ClInclude Include="src\ofApp.h" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(OF_ROOT)\libs\openFrameworksCompiled\project\vs\openframeworksLib.vcxproj">
<Project>{5837595d-aca9-485c-8e76-729040ce4b0b}</Project>
</ProjectReference>
<ProjectReference Include="..\ofxKinectForWindows2Lib\ofxKinectForWindows2Lib.vcxproj">
<Project>{f6008d6a-6d39-4b68-840e-e7ac8ed855da}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="icon.rc">
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">/D_DEBUG %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">/D_DEBUG %(AdditionalOptions)</AdditionalOptions>
<AdditionalIncludeDirectories>$(OF_ROOT)\libs\openFrameworksCompiled\project\vs</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ProjectExtensions>
<VisualStudio>
<UserProperties RESOURCE_FILE="icon.rc" />
</VisualStudio>
</ProjectExtensions>
</Project>
================================================
FILE: exampleDepthMeshShader/exampleDepthMeshShader.vcxproj.filters
================================================
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="src\ofApp.cpp">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="src\main.cpp">
<Filter>src</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Filter Include="src">
<UniqueIdentifier>{d8376475-7454-4a24-b08a-aac121d3ad6f}</UniqueIdentifier>
</Filter>
<Filter Include="addons">
<UniqueIdentifier>{184c96a8-f47b-482b-a0f2-764d8d7e6429}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\ofApp.h">
<Filter>src</Filter>
</ClInclude>
<ClInclude Include="src\MeshUtils.h">
<Filter>src</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="icon.rc" />
</ItemGroup>
</Project>
================================================
FILE: exampleDepthMeshShader/icon.rc
================================================
// Icon Resource Definition
#define MAIN_ICON 102
#if defined(_DEBUG)
MAIN_ICON ICON "icon_debug.ico"
#else
MAIN_ICON ICON "icon.ico"
#endif
================================================
FILE: exampleDepthMeshShader/src/MeshUtils.h
================================================
#include "ofMesh.h"
// uses normalized texcoords
static ofMesh gridMesh(int w, int h, float scale)
{
ofMesh mesh;
mesh.setMode(OF_PRIMITIVE_TRIANGLES);
for (int y = 0; y < h; y++) {
for (int x = 0; x < w; x++) {
float x_mesh = x * scale;
float y_mesh = y * scale;
mesh.addVertex(glm::vec3(x_mesh, y_mesh, 0));
mesh.addTexCoord(glm::vec2((float)x / (float)w, (float)y / (float)h));
}
}
for (int y = 0; y < h - 1; y++) {
for (int x = 0; x < w - 1; x++) {
mesh.addIndex(x + y * w); // a
mesh.addIndex((x + 1) + (y + 1) * w); // c
mesh.addIndex(x + (y + 1) * w); // d
mesh.addIndex(x + y * w); // a
mesh.addIndex((x + 1) + y * w); // b
mesh.addIndex((x + 1) + (y + 1) * w); // c
}
}
return mesh;
}
================================================
FILE: exampleDepthMeshShader/src/main.cpp
================================================
#include "ofApp.h"
//========================================================================
int main()
{
ofGLFWWindowSettings settings;
settings.setGLVersion(4, 5);
settings.setSize(1024, 768);
ofCreateWindow(settings);
ofRunApp(new ofApp());
}
================================================
FILE: exampleDepthMeshShader/src/ofApp.cpp
================================================
/*
Author: Lesley van Hoek
https://github.com/lshoek
*/
#include "ofApp.h"
#include "MeshUtils.h"
void ofApp::setup()
{
ofSetVerticalSync(true);
ofLogToConsole();
ofBackground(0x222222);
ofSetHexColor(0xffffff);
ofFill();
kinect.open();
bIsKinectOpen = kinect.isOpen();
ofLog() << (bIsKinectOpen ? "Kinect found!" : "Kinect not found!");
if (bIsKinectOpen) {
kinect.initColorSource();
kinect.initDepthSource();
kinect.getSensor()->get_CoordinateMapper(&coordMapper);
}
else {
OF_EXIT_APP(0);
}
// pointcloud options
pointCloudOpts.textureCoordinates = ofxKFW2::Source::Depth::PointCloudOptions::TextureCoordinates::ColorCamera;
pointCloudOpts.facesMaxLength = 0.0003f;
pointCloudOpts.stitchFaces = true;
pointCloudOpts.steps = 1;
// init cam
cam.setNearClip(0.0001f);
cam.setFarClip(10.0f);
cam.setPosition(0, 0, -.01f);
cam.lookAt(glm::vec3(0));
cam.setUpAxis(glm::vec3(0, 1, 0));
cam.setAutoDistance(false);
meshShader.setupShaderFromFile(GL_COMPUTE_SHADER, "shaders/mesh.glsl");
meshShader.linkProgram();
indexShader.setupShaderFromFile(GL_COMPUTE_SHADER, "shaders/indices.glsl");
indexShader.linkProgram();
}
void ofApp::update()
{
kinect.update();
if (kinect.isFrameNew()) {
auto depthSrc = kinect.getDepthSource();
auto colorSrc = kinect.getColorSource();
// update textures
colorTexture = colorSrc->getTexture();
depthTexture = depthSrc->getTexture();
const int width = depthSrc->getWidth();
const int height = depthSrc->getHeight();
auto frameSize = width * height;
const int w = depthSrc->getWidth() / pointCloudOpts.steps;
const int h = depthSrc->getHeight() / pointCloudOpts.steps;
meshWidth = w;
meshHeight = h;
// do all this once
if (!bMeshDataInitialized) {
// get depth-to-camera transform table
depthSrc->getDepthToWorldTable(depthToCameraSpaceTable);
// start with a base grid
depthVboMesh = gridMesh(w, h, 1.0f);
// allocate buffers
depthToCameraSpaceBuffer.allocate();
depthToCameraSpaceBuffer.setData(frameSize * sizeof(glm::vec2), depthToCameraSpaceTable.getData(), GL_STATIC_READ);
vertexBuffer.allocate(w * h * sizeof(glm::vec4), GL_DYNAMIC_DRAW);
indexBuffer.allocate(w * h * 6 * sizeof(int), GL_DYNAMIC_DRAW);
// set buffers to vbo mesh (vec4 vertices)
depthVboMesh.getVbo().setVertexBuffer(vertexBuffer, 4, 0);
depthVboMesh.getVbo().setIndexBuffer(indexBuffer);
// bind buffers (binding 2 is for depth tex)
depthToCameraSpaceBuffer.bindBase(GL_SHADER_STORAGE_BUFFER, 0);
depthVboMesh.getVbo().getVertexBuffer().bindBase(GL_SHADER_STORAGE_BUFFER, 1);
depthVboMesh.getVbo().getIndexBuffer().bindBase(GL_SHADER_STORAGE_BUFFER, 3);
ofLog() <<
"\nverts: " << depthVboMesh.getNumVertices() <<
"\nindices:" << depthVboMesh.getNumIndices();
bMeshDataInitialized = true;
}
// start timing here
uint64_t start;
start = ofGetElapsedTimeMillis();
// update color-in-depth table
depthSrc->getColorInDepthFrameMapping(colorToDepthSpaceTable);
depthVboMesh.getVbo().updateTexCoordData((glm::vec2*) &colorToDepthSpaceTable[0], w * h);
// update points
depthTexture.bindAsImage(2, GL_READ_ONLY);
meshShader.begin();
meshShader.setUniform1i("steps", pointCloudOpts.steps);
meshShader.setUniform2f("size", glm::vec2(w, h));
meshShader.setUniform2f("size_full", glm::vec2(width, height));
meshShader.dispatchCompute(w/32, h/32, 1);
meshShader.end();
depthTexture.unbind();
// update indices
indexShader.begin();
indexShader.setUniform1f("faces_maxlen", pointCloudOpts.facesMaxLength);
indexShader.setUniform2f("size", glm::vec2(w, h));
indexShader.dispatchCompute(w/32, h/32, 1);
indexShader.end();
// end timer
gpuMeshUpdateTimer = ofGetElapsedTimeMillis() - start;
// Compare other approaches
if (bCompareMeshUpdates) {
start = ofGetElapsedTimeMillis();
depthMesh = kinect.getDepthSource()->getMesh(pointCloudOpts);
cpuMeshUpdateTimer = ofGetElapsedTimeMillis() - start;
}
}
}
void ofApp::draw()
{
ofSetHexColor(0xffffff);
glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);
glCullFace(GL_BACK);
glPrimitiveRestartIndex(0xffffffff);
cam.begin();
ofPushMatrix();
// with texture
if (bFull) {
bool bTex = colorTexture.isAllocated();
if (bTex) {
colorTexture.setTextureWrap(GL_CLAMP_TO_BORDER, GL_CLAMP_TO_BORDER);
colorTexture.bind();
}
depthVboMesh.draw();
if (bTex) {
colorTexture.unbind();
}
}
// wireframe and points
if (bWireFrame) {
depthVboMesh.draw(ofPolyRenderMode::OF_MESH_WIREFRAME);
}
if (bPoints) {
depthVboMesh.draw(ofPolyRenderMode::OF_MESH_POINTS);
}
ofPopMatrix();
cam.end();
glDisable(GL_CULL_FACE);
glDisable(GL_DEPTH_TEST);
ofSetColor(ofColor::fromHex(0x222222), 0x88);;
ofDrawRectangle(0, 0, 512, 128);
ofSetHexColor(0x00ffff);
ofDrawBitmapString("[f] full mesh, [w] wireframe, [p] points, [t] time cpu mesh", margin, margin);
ofDrawBitmapString("cam: " + ofToString(cam.getPosition()), margin, margin * 2);
ofDrawBitmapString("fps: " + ofToString(ofGetFrameRate()), margin, margin * 3);
ofDrawBitmapString("gpu: " + ofToString(gpuMeshUpdateTimer) + "ms", margin, margin * 4);
if (bCompareMeshUpdates) {
ofDrawBitmapString("cpu: " + ofToString(cpuMeshUpdateTimer) + "ms", margin, margin * 5);
}
}
void ofApp::keyPressed(int key)
{
if (key == 'f') {
bFull = !bFull;
}
if (key == 'w') {
bWireFrame = !bWireFrame;
}
if (key == 'p') {
bPoints = !bPoints;
}
if (key == 't') {
bCompareMeshUpdates = !bCompareMeshUpdates;
}
}
//--------------------------------------------------------------
void ofApp::keyReleased(int key){
}
//--------------------------------------------------------------
void ofApp::mouseMoved(int x, int y ){
}
//--------------------------------------------------------------
void ofApp::mouseDragged(int x, int y, int button){
}
//--------------------------------------------------------------
void ofApp::mousePressed(int x, int y, int button){
}
//--------------------------------------------------------------
void ofApp::mouseReleased(int x, int y, int button){
}
//--------------------------------------------------------------
void ofApp::mouseEntered(int x, int y){
}
//--------------------------------------------------------------
void ofApp::mouseExited(int x, int y){
}
//--------------------------------------------------------------
void ofApp::windowResized(int w, int h){
}
//--------------------------------------------------------------
void ofApp::gotMessage(ofMessage msg){
}
//--------------------------------------------------------------
void ofApp::dragEvent(ofDragInfo dragInfo){
}
================================================
FILE: exampleDepthMeshShader/src/ofApp.h
================================================
/*
Author: Lesley van Hoek
https://github.com/lshoek
*/
#pragma once
#include "ofxKinectForWindows2.h"
#include "ofMain.h"
class ofApp : public ofBaseApp
{
public:
void setup();
void update();
void draw();
void keyPressed(int key);
void keyReleased(int key);
void mouseMoved(int x, int y );
void mouseDragged(int x, int y, int button);
void mousePressed(int x, int y, int button);
void mouseReleased(int x, int y, int button);
void mouseEntered(int x, int y);
void mouseExited(int x, int y);
void windowResized(int w, int h);
void dragEvent(ofDragInfo dragInfo);
void gotMessage(ofMessage msg);
ofxKFW2::Device kinect;
ofxKFW2::Source::Depth::PointCloudOptions pointCloudOpts;
ICoordinateMapper* coordMapper;
ofFloatPixels depthToCameraSpaceTable;
ofFloatPixels colorToDepthSpaceTable;
ofTexture colorTexture;
ofTexture depthTexture;
ofShader meshShader;
ofShader indexShader;
ofBufferObject depthToCameraSpaceBuffer;
ofBufferObject vertexBuffer;
ofBufferObject indexBuffer;
ofVboMesh depthVboMesh;
ofMesh depthMesh;
ofEasyCam cam;
uint64_t gpuMeshUpdateTimer;
uint64_t cpuMeshUpdateTimer;
int meshWidth;
int meshHeight;
// config
bool bFull = true;
bool bWireFrame = false;
bool bPoints = false;
bool bCompareMeshUpdates = false;
// app
bool bIsKinectOpen = false;
bool bMeshDataInitialized = false;
const int margin = 20;
};
================================================
FILE: exampleDepthToCameraTable/addons.make
================================================
================================================
FILE: exampleDepthToCameraTable/exampleDepthToCameraTable.sln
================================================
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.24720.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "exampleDepthToCameraTable", "exampleDepthToCameraTable.vcxproj", "{7FD42DF7-442E-479A-BA76-D0022F99702A}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openframeworksLib", "..\..\..\libs\openFrameworksCompiled\project\vs\openframeworksLib.vcxproj", "{5837595D-ACA9-485C-8E76-729040CE4B0B}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ofxKinectForWindows2Lib", "..\ofxKinectForWindows2Lib\ofxKinectForWindows2Lib.vcxproj", "{F6008D6A-6D39-4B68-840E-E7AC8ED855DA}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ofxCvGuiLib", "..\..\ofxCvGui\ofxCvGuiLib\ofxCvGuiLib.vcxproj", "{6F0DDB4F-4014-4433-919B-9D956C034BAD}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|Win32.ActiveCfg = Debug|Win32
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|Win32.Build.0 = Debug|Win32
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|x64.ActiveCfg = Debug|x64
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|x64.Build.0 = Debug|x64
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|Win32.ActiveCfg = Release|Win32
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|Win32.Build.0 = Release|Win32
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|x64.ActiveCfg = Release|x64
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|x64.Build.0 = Release|x64
{5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|Win32.ActiveCfg = Debug|Win32
{5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|Win32.Build.0 = Debug|Win32
{5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|x64.ActiveCfg = Debug|x64
{5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|x64.Build.0 = Debug|x64
{5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|Win32.ActiveCfg = Release|Win32
{5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|Win32.Build.0 = Release|Win32
{5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|x64.ActiveCfg = Release|x64
{5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|x64.Build.0 = Release|x64
{F6008D6A-6D39-4B68-840E-E7AC8ED855DA}.Debug|Win32.ActiveCfg = Debug|Win32
{F6008D6A-6D39-4B68-840E-E7AC8ED855DA}.Debug|Win32.Build.0 = Debug|Win32
{F6008D6A-6D39-4B68-840E-E7AC8ED855DA}.Debug|x64.ActiveCfg = Debug|x64
{F6008D6A-6D39-4B68-840E-E7AC8ED855DA}.Debug|x64.Build.0 = Debug|x64
{F6008D6A-6D39-4B68-840E-E7AC8ED855DA}.Release|Win32.ActiveCfg = Release|Win32
{F6008D6A-6D39-4B68-840E-E7AC8ED855DA}.Release|Win32.Build.0 = Release|Win32
{F6008D6A-6D39-4B68-840E-E7AC8ED855DA}.Release|x64.ActiveCfg = Release|x64
{F6008D6A-6D39-4B68-840E-E7AC8ED855DA}.Release|x64.Build.0 = Release|x64
{6F0DDB4F-4014-4433-919B-9D956C034BAD}.Debug|Win32.ActiveCfg = Debug|Win32
{6F0DDB4F-4014-4433-919B-9D956C034BAD}.Debug|Win32.Build.0 = Debug|Win32
{6F0DDB4F-4014-4433-919B-9D956C034BAD}.Debug|x64.ActiveCfg = Debug|x64
{6F0DDB4F-4014-4433-919B-9D956C034BAD}.Debug|x64.Build.0 = Debug|x64
{6F0DDB4F-4014-4433-919B-9D956C034BAD}.Release|Win32.ActiveCfg = Release|Win32
{6F0DDB4F-4014-4433-919B-9D956C034BAD}.Release|Win32.Build.0 = Release|Win32
{6F0DDB4F-4014-4433-919B-9D956C034BAD}.Release|x64.ActiveCfg = Release|x64
{6F0DDB4F-4014-4433-919B-9D956C034BAD}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
================================================
FILE: exampleDepthToCameraTable/exampleDepthToCameraTable.vcxproj
================================================
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{7FD42DF7-442E-479A-BA76-D0022F99702A}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>exampleDepthToCameraTable</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\libs\openFrameworksCompiled\project\vs\openFrameworksRelease.props" />
<Import Project="..\ofxKinectForWindows2.props" />
<Import Project="..\..\ofxCvGui\ofxCvGuiLib\ofxCvGui.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\libs\openFrameworksCompiled\project\vs\openFrameworksRelease.props" />
<Import Project="..\ofxKinectForWindows2.props" />
<Import Project="..\..\ofxCvGui\ofxCvGuiLib\ofxCvGui.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\libs\openFrameworksCompiled\project\vs\openFrameworksDebug.props" />
<Import Project="..\ofxKinectForWindows2.props" />
<Import Project="..\..\ofxCvGui\ofxCvGuiLib\ofxCvGui.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\libs\openFrameworksCompiled\project\vs\openFrameworksDebug.props" />
<Import Project="..\ofxKinectForWindows2.props" />
<Import Project="..\..\ofxCvGui\ofxCvGuiLib\ofxCvGui.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>bin\</OutDir>
<IntDir>obj\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)_debug</TargetName>
<LinkIncremental>true</LinkIncremental>
<GenerateManifest>true</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>bin\</OutDir>
<IntDir>obj\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)_debug</TargetName>
<LinkIncremental>true</LinkIncremental>
<GenerateManifest>true</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>bin\</OutDir>
<IntDir>obj\$(Configuration)\</IntDir>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>bin\</OutDir>
<IntDir>obj\$(Configuration)\</IntDir>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<PostBuildEvent />
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CompileAs>CompileAsCpp</CompileAs>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<PostBuildEvent />
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WholeProgramOptimization>false</WholeProgramOptimization>
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CompileAs>CompileAsCpp</CompileAs>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<GenerateDebugInformation>false</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<PostBuildEvent />
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WholeProgramOptimization>false</WholeProgramOptimization>
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<Link>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<GenerateDebugInformation>false</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<PostBuildEvent />
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="src\main.cpp" />
<ClCompile Include="src\ofApp.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\ofApp.h" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(OF_ROOT)\libs\openFrameworksCompiled\project\vs\openframeworksLib.vcxproj">
<Project>{5837595d-aca9-485c-8e76-729040ce4b0b}</Project>
</ProjectReference>
<ProjectReference Include="..\..\ofxCvGui\ofxCvGuiLib\ofxCvGuiLib.vcxproj">
<Project>{6f0ddb4f-4014-4433-919b-9d956c034bad}</Project>
</ProjectReference>
<ProjectReference Include="..\ofxKinectForWindows2Lib\ofxKinectForWindows2Lib.vcxproj">
<Project>{f6008d6a-6d39-4b68-840e-e7ac8ed855da}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="icon.rc">
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">/D_DEBUG %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">/D_DEBUG %(AdditionalOptions)</AdditionalOptions>
<AdditionalIncludeDirectories>$(OF_ROOT)\libs\openFrameworksCompiled\project\vs</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ProjectExtensions>
<VisualStudio>
<UserProperties RESOURCE_FILE="icon.rc" />
</VisualStudio>
</ProjectExtensions>
</Project>
================================================
FILE: exampleDepthToCameraTable/exampleDepthToCameraTable.vcxproj.filters
================================================
<?xml version="1.0"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="src\ofApp.cpp">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="src\main.cpp">
<Filter>src</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Filter Include="src">
<UniqueIdentifier>{d8376475-7454-4a24-b08a-aac121d3ad6f}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\ofApp.h">
<Filter>src</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="icon.rc" />
</ItemGroup>
</Project>
================================================
FILE: exampleDepthToCameraTable/icon.rc
================================================
// Icon Resource Definition
#define MAIN_ICON 102
#if defined(_DEBUG)
MAIN_ICON ICON "icon_debug.ico"
#else
MAIN_ICON ICON "icon.ico"
#endif
================================================
FILE: exampleDepthToCameraTable/src/main.cpp
================================================
#include "ofApp.h"
//========================================================================
int main( ){
ofSetupOpenGL(1920,1080,OF_WINDOW); // <-------- setup the GL context
// this kicks off the running of my app
// can be OF_WINDOW or OF_FULLSCREEN
// pass in width and height too:
ofRunApp(new ofApp());
}
================================================
FILE: exampleDepthToCameraTable/src/ofApp.cpp
================================================
#include "ofApp.h"
//--------------------------------------------------------------
void ofApp::setup(){
//suggest running this in Release only (very slow in Debug)
kinect.open();
kinect.initColorSource();
kinect.initDepthSource();
gui.init();
auto mainStrip = gui.addStrip();
mainStrip->setDirection(ofxCvGui::Panels::Groups::Strip::Direction::Vertical);
mainStrip->setCellSizes({ 33, 66 });
auto widgets = ofxCvGui::Panels::makeWidgets();
{
widgets->addFps();
widgets->addToggle(drawNativeWorld);
widgets->addToggle(drawCalculatedWorld);
}
auto leftStrip = ofxCvGui::Panels::Groups::makeStrip();
mainStrip->add(leftStrip);
{
leftStrip->add(widgets);
leftStrip->add(ofxCvGui::Panels::makeBaseDraws(*kinect.getColorSource(), "Color"));
leftStrip->add(ofxCvGui::Panels::makeBaseDraws(*kinect.getDepthSource(), "Depth"));
leftStrip->add(ofxCvGui::Panels::makeBaseDraws(depthToWorldPreview, "Depth to World table"));
}
auto world = ofxCvGui::Panels::makeWorld();
mainStrip->add(world);
world->onDrawWorld += [this](ofCamera &) {
if (this->drawNativeWorld) {
ofPushStyle();
{
ofSetColor(ofColor::white);
this->nativeWorld.drawVertices();
}
ofPopStyle();
}
if (this->drawCalculatedWorld) {
ofPushStyle();
{
ofSetColor(ofColor::red);
this->calculatedWorld.drawVertices();
}
ofPopStyle();
}
};
world->getCamera().setPosition(-1, +1, -2);
world->getCamera().lookAt(ofVec3f(0, 0, 3));
world->getCamera().setCursorDrawEnabled(true);
}
//--------------------------------------------------------------
void ofApp::update(){
kinect.update();
if (kinect.isFrameNew()) {
auto depth = kinect.getDepthSource();
//this next part only needs to happen once
{
//load the depth to world table
depth->getDepthToWorldTable(depthToWorldTable);
//load it into our preview
depthToWorldPreview.loadData(depthToWorldTable);
}
//get the usual mesh
nativeWorld = depth->getMesh();
//build a mesh using the depthToWorldTable
{
auto size = depth->getWidth() * depth->getHeight();
auto depthPixel = depth->getPixels().getData();
auto depthToWorldRay = (ofVec2f*)depthToWorldTable.getData();
this->calculatedWorld.clear();
for (int i = 0; i < size; i++) {
auto z = (float)*depthPixel / 1000.0f;
ofVec3f vertex{
depthToWorldRay->x * z,
depthToWorldRay->y * z,
z
};
calculatedWorld.addVertex(vertex);
depthPixel++;
depthToWorldRay++;
}
}
}
}
//--------------------------------------------------------------
void ofApp::draw(){
}
//--------------------------------------------------------------
void ofApp::keyPressed(int key){
}
//--------------------------------------------------------------
void ofApp::keyReleased(int key){
}
//--------------------------------------------------------------
void ofApp::mouseMoved(int x, int y ){
}
//--------------------------------------------------------------
void ofApp::mouseDragged(int x, int y, int button){
}
//--------------------------------------------------------------
void ofApp::mousePressed(int x, int y, int button){
}
//--------------------------------------------------------------
void ofApp::mouseReleased(int x, int y, int button){
}
//--------------------------------------------------------------
void ofApp::mouseEntered(int x, int y){
}
//--------------------------------------------------------------
void ofApp::mouseExited(int x, int y){
}
//--------------------------------------------------------------
void ofApp::windowResized(int w, int h){
}
//--------------------------------------------------------------
void ofApp::gotMessage(ofMessage msg){
}
//--------------------------------------------------------------
void ofApp::dragEvent(ofDragInfo dragInfo){
}
================================================
FILE: exampleDepthToCameraTable/src/ofApp.h
================================================
#pragma once
#include "ofxKinectForWindows2.h"
#include "ofxCvGui.h"
#include "ofMain.h"
class ofApp : public ofBaseApp{
public:
void setup();
void update();
void draw();
void keyPressed(int key);
void keyReleased(int key);
void mouseMoved(int x, int y );
void mouseDragged(int x, int y, int button);
void mousePressed(int x, int y, int button);
void mouseReleased(int x, int y, int button);
void mouseEntered(int x, int y);
void mouseExited(int x, int y);
void windowResized(int w, int h);
void dragEvent(ofDragInfo dragInfo);
void gotMessage(ofMessage msg);
ofxKinectForWindows2::Device kinect;
ofxCvGui::Builder gui;
ofFloatPixels depthToWorldTable;
ofTexture depthToWorldPreview;
ofMesh nativeWorld;
ofMesh calculatedWorld;
ofParameter<bool> drawNativeWorld{ "Draw native world", false };
ofParameter<bool> drawCalculatedWorld{ "Draw calculated world", true };
};
================================================
FILE: exampleWithGui/addons.make
================================================
================================================
FILE: exampleWithGui/example.sln
================================================
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example", "example.vcxproj", "{7FD42DF7-442E-479A-BA76-D0022F99702A}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openframeworksLib", "..\..\..\libs\openFrameworksCompiled\project\vs\openframeworksLib.vcxproj", "{5837595D-ACA9-485C-8E76-729040CE4B0B}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ofxCvGuiLib", "..\..\..\addons\ofxCvGui\ofxCvGuiLib\ofxCvGuiLib.vcxproj", "{6F0DDB4F-4014-4433-919B-9D956C034BAD}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ofxKinectForWindows2Lib", "..\ofxKinectForWindows2Lib\ofxKinectForWindows2Lib.vcxproj", "{F6008D6A-6D39-4B68-840E-E7AC8ED855DA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|Win32.ActiveCfg = Debug|x64
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|Win32.Build.0 = Debug|x64
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|x64.ActiveCfg = Debug|x64
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|x64.Build.0 = Debug|x64
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|Win32.ActiveCfg = Release|x64
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|Win32.Build.0 = Release|x64
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|x64.ActiveCfg = Release|x64
{7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|x64.Build.0 = Release|x64
{5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|Win32.ActiveCfg = Debug|x64
{5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|Win32.Build.0 = Debug|x64
{5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|x64.ActiveCfg = Debug|x64
{5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|x64.Build.0 = Debug|x64
{5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|Win32.ActiveCfg = Release|x64
{5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|Win32.Build.0 = Release|x64
{5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|x64.ActiveCfg = Release|x64
{5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|x64.Build.0 = Release|x64
{6F0DDB4F-4014-4433-919B-9D956C034BAD}.Debug|Win32.ActiveCfg = Debug|x64
{6F0DDB4F-4014-4433-919B-9D956C034BAD}.Debug|Win32.Build.0 = Debug|x64
{6F0DDB4F-4014-4433-919B-9D956C034BAD}.Debug|x64.ActiveCfg = Debug|x64
{6F0DDB4F-4014-4433-919B-9D956C034BAD}.Debug|x64.Build.0 = Debug|x64
{6F0DDB4F-4014-4433-919B-9D956C034BAD}.Release|Win32.ActiveCfg = Release|x64
{6F0DDB4F-4014-4433-919B-9D956C034BAD}.Release|Win32.Build.0 = Release|x64
{6F0DDB4F-4014-4433-919B-9D956C034BAD}.Release|x64.ActiveCfg = Release|x64
{6F0DDB4F-4014-4433-919B-9D956C034BAD}.Release|x64.Build.0 = Release|x64
{F6008D6A-6D39-4B68-840E-E7AC8ED855DA}.Debug|Win32.ActiveCfg = Debug|Win32
{F6008D6A-6D39-4B68-840E-E7AC8ED855DA}.Debug|Win32.Build.0 = Debug|Win32
{F6008D6A-6D39-4B68-840E-E7AC8ED855DA}.Debug|x64.ActiveCfg = Debug|x64
{F6008D6A-6D39-4B68-840E-E7AC8ED855DA}.Debug|x64.Build.0 = Debug|x64
{F6008D6A-6D39-4B68-840E-E7AC8ED855DA}.Release|Win32.ActiveCfg = Release|Win32
{F6008D6A-6D39-4B68-840E-E7AC8ED855DA}.Release|Win32.Build.0 = Release|Win32
{F6008D6A-6D39-4B68-840E-E7AC8ED855DA}.Release|x64.ActiveCfg = Release|x64
{F6008D6A-6D39-4B68-840E-E7AC8ED855DA}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
================================================
FILE: exampleWithGui/example.vcxproj
================================================
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{7FD42DF7-442E-479A-BA76-D0022F99702A}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>example</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\libs\openFrameworksCompiled\project\vs\openFrameworksRelease.props" />
<Import Project="..\..\..\addons\ofxKinectForWindows2\ofxKinectForWindows2.props" />
<Import Project="..\..\..\addons\ofxCvGui\ofxCvGuiLib\ofxCvGui.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\libs\openFrameworksCompiled\project\vs\openFrameworksRelease.props" />
<Import Project="..\..\..\addons\ofxKinectForWindows2\ofxKinectForWindows2.props" />
<Import Project="..\..\..\addons\ofxCvGui\ofxCvGuiLib\ofxCvGui.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\libs\openFrameworksCompiled\project\vs\openFrameworksDebug.props" />
<Import Project="..\..\..\addons\ofxKinectForWindows2\ofxKinectForWindows2.props" />
<Import Project="..\..\..\addons\ofxCvGui\ofxCvGuiLib\ofxCvGui.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\libs\openFrameworksCompiled\project\vs\openFrameworksDebug.props" />
<Import Project="..\..\..\addons\ofxKinectForWindows2\ofxKinectForWindows2.props" />
<Import Project="..\..\..\addons\ofxCvGui\ofxCvGuiLib\ofxCvGui.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(SolutionDir)bin\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)_debug</TargetName>
<LinkIncremental>true</LinkIncremental>
<GenerateManifest>true</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<TargetName>$(ProjectName)_debug</TargetName>
<LinkIncremental>true</LinkIncremental>
<GenerateManifest>true</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)bin\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<AdditionalIncludeDirectories>..\..\..\addons\ofxKinectForWindows2\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalIncludeDirectories>..\..\..\addons\ofxKinectForWindows2\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WholeProgramOptimization>false</WholeProgramOptimization>
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<AdditionalIncludeDirectories>..\..\..\addons\ofxKinectForWindows2\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<Link>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<GenerateDebugInformation>false</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WholeProgramOptimization>false</WholeProgramOptimization>
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<AdditionalIncludeDirectories>..\..\..\addons\ofxKinectForWindows2\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<Link>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<GenerateDebugInformation>false</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="src\main.cpp" />
<ClCompile Include="src\ofApp.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\ofApp.h" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\libs\openFrameworksCompiled\project\vs\openframeworksLib.vcxproj">
<Project>{5837595d-aca9-485c-8e76-729040ce4b0b}</Project>
</ProjectReference>
<ProjectReference Include="..\..\..\addons\ofxCvGui\ofxCvGuiLib\ofxCvGuiLib.vcxproj">
<Project>{6f0ddb4f-4014-4433-919b-9d956c034bad}</Project>
</ProjectReference>
<ProjectReference Include="..\ofxKinectForWindows2Lib\ofxKinectForWindows2Lib.vcxproj">
<Project>{f6008d6a-6d39-4b68-840e-e7ac8ed855da}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="icon.rc">
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">/D_DEBUG %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">/D_DEBUG %(AdditionalOptions)</AdditionalOptions>
</ResourceCompile>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
</Project>
================================================
FILE: exampleWithGui/example.vcxproj.filters
================================================
<?xml version="1.0"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="src\ofApp.cpp">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="src\main.cpp">
<Filter>src</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Filter Include="src">
<UniqueIdentifier>{d8376475-7454-4a24-b08a-aac121d3ad6f}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\ofApp.h">
<Filter>src</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="icon.rc" />
</ItemGroup>
</Project>
================================================
FILE: exampleWithGui/icon.rc
================================================
// Icon Resource Definition
#define MAIN_ICON 102
#if defined(_DEBUG)
MAIN_ICON ICON "..\..\..\libs\openFrameworksCompiled\project\vs\icon_debug.ico"
#else
MAIN_ICON ICON "..\..\..\libs\openFrameworksCompiled\project\vs\icon.ico"
#endif
================================================
FILE: exampleWithGui/src/main.cpp
================================================
#include "ofApp.h"
//========================================================================
int main( ){
ofGLFWWindowSettings windowSettings;
windowSettings.setGLVersion(3, 2);
windowSettings.width = 1920;
windowSettings.height = 1080;
auto window = ofCreateWindow(windowSettings);
ofRunApp(new ofApp());
}
================================================
FILE: exampleWithGui/src/ofApp.cpp
================================================
#include "ofApp.h"
//--------------------------------------------------------------
void ofApp::setup(){
kinect.open();
kinect.initDepthSource();
kinect.initColorSource();
kinect.initInfraredSource();
kinect.initBodyIndexSource();
kinect.initBodySource();
gui.init();
//setup a gui panel for the widgets at top-left
auto widgets = gui.addWidgets();
widgets->addTitle("ofxKinectForWindows2");
widgets->addFps();
widgets->addMemoryUsage();
//setup a gui panel for the 3D view
auto worldView = gui.addWorld("World");
worldView->onDrawWorld += [this](ofCamera &) {
this->kinect.drawWorld();
};
//setup a gui panel for every kinect source
auto sources = kinect.getSources();
for(auto source : sources) {
auto sourceWithTexture = dynamic_pointer_cast<ofBaseHasTexture>(source);
if (sourceWithTexture) {
auto panel = gui.add(sourceWithTexture->getTexture(), source->getTypeName());
//if it's the colour panel, let's do something special by writing some info on top
auto colorSource = dynamic_pointer_cast<ofxKFW2::Source::Color>(source);
if (colorSource) {
panel->onDraw += [colorSource] (ofxCvGui::DrawArguments &) {
stringstream message;
message << "Exposure : " << colorSource->getExposure() << "us" << endl;
message << "FrameInterval : " << colorSource->getFrameInterval() << "us" << endl;
message << "Gain : " << colorSource->getGain() << endl;
message << "Gamma : " << colorSource->getGamma() << endl;
ofxCvGui::Utils::drawText(message.str(), 20, 60);
};
}
//if it's the depth panel, set some scaling
auto depthSource = dynamic_pointer_cast<ofxKFW2::Source::Depth>(source);
if (depthSource) {
auto style = make_shared<ofxCvGui::Panels::Texture::Style>();
style->rangeMaximum = 0.25f;
panel->setStyle(style);
}
//if it's the body index panel, let's draw the joints on top
auto bodyIndexSource = dynamic_pointer_cast<ofxKFW2::Source::BodyIndex>(source);
if(bodyIndexSource) {
panel->onDrawImage += [this](ofxCvGui::DrawImageArguments & args) {
auto bodySource = this->kinect.getBodySource();
const auto & bodies = bodySource->getBodies();
ofPushStyle();
{
ofColor color(200, 100, 100);
int index = 0;
for (const auto & body : bodies) {
color.setHueAngle((index * 50) % 360);
ofSetColor(color);
for (const auto & joint : body.joints) {
ofDrawCircle(joint.second.getPositionInDepthMap(), 5);
}
index++;
}
}
ofPopStyle();
};
}
}
//add an 'isFrameNew' widget to the panel
widgets->addIndicatorBool(source->getTypeName() + " frame new", [source]() {
return source->isFrameNew();
});
}
//if we press the 'c' key on the World panel, then toggle the camera's cursor. This works best when you fullscreen that panel
worldView->onKeyboard += [this, worldView] (ofxCvGui::KeyboardArguments & args) {
if (args.action == ofxCvGui::KeyboardArguments::Action::Pressed && args.key =='c') {
worldView->getCamera().toggleCursorDrawEnabled();
}
};
}
//--------------------------------------------------------------
void ofApp::update(){
kinect.update();
mesh = kinect.getDepthSource()->getMesh(true, ofxKinectForWindows2::Source::Depth::PointCloudOptions::TextureCoordinates::ColorCamera);
}
//--------------------------------------------------------------
void ofApp::draw(){
}
//--------------------------------------------------------------
void ofApp::keyPressed(int key){
}
//--------------------------------------------------------------
void ofApp::keyReleased(int key){
}
//--------------------------------------------------------------
void ofApp::mouseMoved(int x, int y){
}
//--------------------------------------------------------------
void ofApp::mouseDragged(int x, int y, int button){
}
//--------------------------------------------------------------
void ofApp::mousePressed(int x, int y, int button){
}
//--------------------------------------------------------------
void ofApp::mouseReleased(int x, int y, int button){
}
//--------------------------------------------------------------
void ofApp::windowResized(int w, int h){
}
//--------------------------------------------------------------
void ofApp::gotMessage(ofMessage msg){
}
//--------------------------------------------------------------
void ofApp::dragEvent(ofDragInfo dragInfo){
}
================================================
FILE: exampleWithGui/src/ofApp.h
================================================
#pragma once
#include "ofxKinectForWindows2.h"
#include "ofxCvGui.h"
#include "ofMain.h"
class ofApp : public ofBaseApp{
public:
void setup();
void update();
void draw();
void keyPressed(int key);
void keyReleased(int key);
void mouseMoved(int x, int y );
void mouseDragged(int x, int y, int button);
void mousePressed(int x, int y, int button);
void mouseReleased(int x, int y, int button);
void windowResized(int w, int h);
void dragEvent(ofDragInfo dragInfo);
void gotMessage(ofMessage msg);
ofxKFW2::Device kinect;
ofxCvGui::Builder gui;
ofMesh mesh;
};
================================================
FILE: exampleWithGui/~AutoRecover.example.vcxproj
================================================
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{7FD42DF7-442E-479A-BA76-D0022F99702A}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>example</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v110</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\libs\openFrameworksCompiled\project\vs\openFrameworksRelease.props" />
<Import Project="..\ofxKinectForWindows2.props" />
<Import Project="..\..\ofxCvGui2\ofxCvGuiLib\ofxCvGui.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\ofxKinectForWindows2.props" />
<Import Project="..\..\ofxCvGui2\ofxCvGuiLib\ofxCvGui.props" />
<Import Project="..\..\..\libs\openFrameworksCompiled\project\vs\openFrameworksRelease64.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\libs\openFrameworksCompiled\project\vs\openFrameworksDebug.props" />
<Import Project="..\ofxKinectForWindows2.props" />
<Import Project="..\..\ofxCvGui2\ofxCvGuiLib\ofxCvGui.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\ofxKinectForWindows2.props" />
<Import Project="..\..\ofxCvGui2\ofxCvGuiLib\ofxCvGui.props" />
<Import Project="..\..\..\libs\openFrameworksCompiled\project\vs\openFrameworksDebug64.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>bin\</OutDir>
<IntDir>obj\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)_debug</TargetName>
<LinkIncremental>true</LinkIncremental>
<GenerateManifest>true</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<TargetName>$(ProjectName)_debug</TargetName>
<LinkIncremental>true</LinkIncremental>
<GenerateManifest>true</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>bin\</OutDir>
<IntDir>obj\$(Configuration)\</IntDir>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<AdditionalIncludeDirectories>..\..\..\addons\ofxKinectForWindows2\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalIncludeDirectories>..\..\..\addons\ofxKinectForWindows2\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WholeProgramOptimization>false</WholeProgramOptimization>
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<AdditionalIncludeDirectories>..\..\..\addons\ofxKinectForWindows2\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<Link>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<GenerateDebugInformation>false</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WholeProgramOptimization>false</WholeProgramOptimization>
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<AdditionalIncludeDirectories>..\..\..\addons\ofxKinectForWindows2\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<Link>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<GenerateDebugInformation>false</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="src\main.cpp" />
<ClCompile Include="src\ofApp.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\ofApp.h" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\libs\openFrameworksCompiled\project\vs\openframeworksLib.vcxproj">
<Project>{5837595d-aca9-485c-8e76-729040ce4b0b}</Project>
</ProjectReference>
<ProjectReference Include="..\..\ofxCvGui2\ofxCvGuiLib\ofxCvGuiLib.vcxproj">
<Project>{6f0ddb4f-4014-4433-919b-9d956c034bad}</Project>
</ProjectReference>
<ProjectReference Include="..\ofxKinectForWindows2Lib\ofxKinectForWindows2Lib.vcxproj">
<Project>{f6008d6a-6d39-4b68-840e-e7ac8ed855da}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="icon.rc">
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">/D_DEBUG %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">/D_DEBUG %(AdditionalOptions)</AdditionalOptions>
</ResourceCompile>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
</Project>
================================================
FILE: ofxKinectForWindows2.props
================================================
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>$(KINECTSDK20_DIR)\inc;..\..\..\addons\ofxKinectForWindows2\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ObjectFileName>$(IntDir)\%(Directory)\</ObjectFileName>
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup />
</Project>
================================================
FILE: ofxKinectForWindows2Lib/ofxKinectForWindows2Lib.vcxproj
================================================
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{F6008D6A-6D39-4B68-840E-E7AC8ED855DA}</ProjectGuid>
<RootNamespace>ofxKinectForWindows2Lib</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\libs\openFrameworksCompiled\project\vs\openFrameworksDebug.props" />
<Import Project="..\ofxKinectForWindows2.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\libs\openFrameworksCompiled\project\vs\openFrameworksDebug.props" />
<Import Project="..\ofxKinectForWindows2.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\libs\openFrameworksCompiled\project\vs\openFrameworksRelease.props" />
<Import Project="..\ofxKinectForWindows2.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\libs\openFrameworksCompiled\project\vs\openFrameworksRelease.props" />
<Import Project="..\ofxKinectForWindows2.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<TargetName>$(ProjectName)d</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<MinimalRebuild>false</MinimalRebuild>
<!-- ObjectFileName>$(IntDir)\%(Directory)\</ObjectFileName -->
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<Lib>
<AdditionalDependencies>kinect20.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(KINECTSDK20_DIR)Lib\x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<MinimalRebuild>false</MinimalRebuild>
<!-- ObjectFileName>$(IntDir)\%(Directory)\</ObjectFileName -->
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<Lib>
<AdditionalDependencies>kinect20.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(KINECTSDK20_DIR)Lib\x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<!-- ObjectFileName>$(IntDir)\%(Directory)\</ObjectFileName -->
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
<Lib>
<AdditionalDependencies>kinect20.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(KINECTSDK20_DIR)Lib\x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<!-- ObjectFileName>$(IntDir)\%(Directory)\</ObjectFileName -->
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
<Lib>
<AdditionalDependencies>kinect20.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(KINECTSDK20_DIR)Lib\x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Lib>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="..\src\ofxKinectForWindows2.h" />
<ClInclude Include="..\src\ofxKinectForWindows2\Data\Body.h" />
<ClInclude Include="..\src\ofxKinectForWindows2\Data\Joint.h" />
<ClInclude Include="..\src\ofxKinectForWindows2\Device.h" />
<ClInclude Include="..\src\ofxKinectForWindows2\Source\Base.h" />
<ClInclude Include="..\src\ofxKinectForWindows2\Source\BaseImage.h" />
<ClInclude Include="..\src\ofxKinectForWindows2\Source\Body.h" />
<ClInclude Include="..\src\ofxKinectForWindows2\Source\BodyIndex.h" />
<ClInclude Include="..\src\ofxKinectForWindows2\Source\Color.h" />
<ClInclude Include="..\src\ofxKinectForWindows2\Source\Depth.h" />
<ClInclude Include="..\src\ofxKinectForWindows2\Source\Infrared.h" />
<ClInclude Include="..\src\ofxKinectForWindows2\Source\LongExposureInfrared.h" />
<ClInclude Include="..\src\ofxKinectForWindows2\Utils.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\src\ofxKinectForWindows2\Data\Body.cpp" />
<ClCompile Include="..\src\ofxKinectForWindows2\Data\Joint.cpp" />
<ClCompile Include="..\src\ofxKinectForWindows2\Device.cpp" />
<ClCompile Include="..\src\ofxKinectForWindows2\Source\Body.cpp" />
<ClCompile Include="..\src\ofxKinectForWindows2\Source\BodyIndex.cpp" />
<ClCompile Include="..\src\ofxKinectForWindows2\Source\Color.cpp" />
<ClCompile Include="..\src\ofxKinectForWindows2\Source\Depth.cpp" />
<ClCompile Include="..\src\ofxKinectForWindows2\Source\BaseImage.cpp" />
<ClCompile Include="..\src\ofxKinectForWindows2\Source\Infrared.cpp" />
<ClCompile Include="..\src\ofxKinectForWindows2\Source\LongExposureInfraRed.cpp" />
<ClCompile Include="..\src\ofxKinectForWindows2\Utils.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
================================================
FILE: ofxKinectForWindows2Lib/ofxKinectForWindows2Lib.vcxproj.filters
================================================
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="src">
<UniqueIdentifier>{6233ced8-5481-4a0d-a271-976452c0370e}</UniqueIdentifier>
</Filter>
<Filter Include="src\ofxKinectForWindows2">
<UniqueIdentifier>{86806939-f359-440c-b989-432997725320}</UniqueIdentifier>
</Filter>
<Filter Include="src\ofxKinectForWindows2\Source">
<UniqueIdentifier>{ef038ac8-52e4-450d-b04c-489f6aba359a}</UniqueIdentifier>
</Filter>
<Filter Include="src\ofxKinectForWindows2\Data">
<UniqueIdentifier>{eeab42d3-af56-4576-8e45-79e3ea5610f5}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\src\ofxKinectForWindows2.h">
<Filter>src</Filter>
</ClInclude>
<ClInclude Include="..\src\ofxKinectForWindows2\Device.h">
<Filter>src\ofxKinectForWindows2</Filter>
</ClInclude>
<ClInclude Include="..\src\ofxKinectForWindows2\Utils.h">
<Filter>src\ofxKinectForWindows2</Filter>
</ClInclude>
<ClInclude Include="..\src\ofxKinectForWindows2\Source\Depth.h">
<Filter>src\ofxKinectForWindows2\Source</Filter>
</ClInclude>
<ClInclude Include="..\src\ofxKinectForWindows2\Source\Base.h">
<Filter>src\ofxKinectForWindows2\Source</Filter>
</ClInclude>
<ClInclude Include="..\src\ofxKinectForWindows2\Source\BaseImage.h">
<Filter>src\ofxKinectForWindows2\Source</Filter>
</ClInclude>
<ClInclude Include="..\src\ofxKinectForWindows2\Source\Infrared.h">
<Filter>src\ofxKinectForWindows2\Source</Filter>
</ClInclude>
<ClInclude Include="..\src\ofxKinectForWindows2\Source\LongExposureInfrared.h">
<Filter>src\ofxKinectForWindows2\Source</Filter>
</ClInclude>
<ClInclude Include="..\src\ofxKinectForWindows2\Source\BodyIndex.h">
<Filter>src\ofxKinectForWindows2\Source</Filter>
</ClInclude>
<ClInclude Include="..\src\ofxKinectForWindows2\Source\Color.h">
<Filter>src\ofxKinectForWindows2\Source</Filter>
</ClInclude>
<ClInclude Include="..\src\ofxKinectForWindows2\Source\Body.h">
<Filter>src\ofxKinectForWindows2\Source</Filter>
</ClInclude>
<ClInclude Include="..\src\ofxKinectForWindows2\Data\Body.h">
<Filter>src\ofxKinectForWindows2\Data</Filter>
</ClInclude>
<ClInclude Include="..\src\ofxKinectForWindows2\Data\Joint.h">
<Filter>src\ofxKinectForWindows2\Data</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\src\ofxKinectForWindows2\Device.cpp">
<Filter>src\ofxKinectForWindows2</Filter>
</ClCompile>
<ClCompile Include="..\src\ofxKinectForWindows2\Utils.cpp">
<Filter>src\ofxKinectForWindows2</Filter>
</ClCompile>
<ClCompile Include="..\src\ofxKinectForWindows2\Source\Depth.cpp">
<Filter>src\ofxKinectForWindows2\Source</Filter>
</ClCompile>
<ClCompile Include="..\src\ofxKinectForWindows2\Source\BaseImage.cpp">
<Filter>src\ofxKinectForWindows2\Source</Filter>
</ClCompile>
<ClCompile Include="..\src\ofxKinectForWindows2\Source\Infrared.cpp">
<Filter>src\ofxKinectForWindows2\Source</Filter>
</ClCompile>
<ClCompile Include="..\src\ofxKinectForWindows2\Source\LongExposureInfraRed.cpp">
<Filter>src\ofxKinectForWindows2\Source</Filter>
</ClCompile>
<ClCompile Include="..\src\ofxKinectForWindows2\Source\BodyIndex.cpp">
<Filter>src\ofxKinectForWindows2\Source</Filter>
</ClCompile>
<ClCompile Include="..\src\ofxKinectForWindows2\Source\Color.cpp">
<Filter>src\ofxKinectForWindows2\Source</Filter>
</ClCompile>
<ClCompile Include="..\src\ofxKinectForWindows2\Source\Body.cpp">
<Filter>src\ofxKinectForWindows2\Source</Filter>
</ClCompile>
<ClCompile Include="..\src\ofxKinectForWindows2\Data\Body.cpp">
<Filter>src\ofxKinectForWindows2\Data</Filter>
</ClCompile>
<ClCompile Include="..\src\ofxKinectForWindows2\Data\Joint.cpp">
<Filter>src\ofxKinectForWindows2\Data</Filter>
</ClCompile>
</ItemGroup>
</Project>
================================================
FILE: src/ofxKinectForWindows2/Data/Body.cpp
================================================
#include "Body.h"
#include "ofGraphics.h"
namespace ofxKinectForWindows2 {
namespace Data {
//----------
std::vector<std::pair<JointType, JointType> > * Body::bonesAtlas = 0;
//----------
Body::Body() {
this->bodyId = -1;
this->trackingId = -1;
this->tracked = false;
this->leftHandState = HandState::HandState_Unknown;
this->rightHandState = HandState::HandState_Unknown;
}
//----------
void Body::drawWorld() const {
if (!this->tracked) {
return;
}
const auto & boneAtlas = this->getBonesAtlas();
for(auto & bone : boneAtlas) {
try {
const auto & firstJoint = this->joints.at(bone.first);
const auto & secondJoint = this->joints.at(bone.second);
if (firstJoint.getTrackingState() != TrackingState::TrackingState_NotTracked && secondJoint.getTrackingState() != TrackingState::TrackingState_NotTracked) {
ofDrawLine(firstJoint.getPosition(), secondJoint.getPosition());
}
}
catch (...) {
}
}
}
//----------
void Body::clear() {
joints.clear();
leftHandState = HandState_Unknown;
rightHandState = HandState_Unknown;
tracked = false;
}
//----------
Body Body::operator*(const ofMatrix4x4 & transform) const {
auto copy = *this;
for (auto & joint : copy.joints) {
joint.second = joint.second * transform;
}
return copy;
}
//----------
const std::vector<std::pair<JointType, JointType> > & Body::getBonesAtlas() {
//if pointer isn't valid, let's initialise the atlas
if (!bonesAtlas) {
initBonesAtlas();
}
return * Body::bonesAtlas;
}
//----------
void Body::initBonesAtlas() {
Body::bonesAtlas = new std::vector<std::pair<JointType, JointType> >();
#define BONEDEF_ADD(J1, J2) Body::bonesAtlas->push_back( std::make_pair<JointType, JointType>(JointType_ ## J1, JointType_ ## J2) )
// Torso
BONEDEF_ADD (Head, Neck);
BONEDEF_ADD (Neck, SpineShoulder);
BONEDEF_ADD (SpineShoulder, SpineMid);
BONEDEF_ADD (SpineMid, SpineBase);
BONEDEF_ADD (SpineShoulder, ShoulderRight);
BONEDEF_ADD (SpineShoulder, ShoulderLeft);
BONEDEF_ADD (SpineBase, HipRight);
BONEDEF_ADD (SpineBase, HipLeft);
// Right Arm
BONEDEF_ADD (ShoulderRight, ElbowRight);
BONEDEF_ADD (ElbowRight, WristRight);
BONEDEF_ADD (WristRight, HandRight);
BONEDEF_ADD (HandRight, HandTipRight);
BONEDEF_ADD (WristRight, ThumbRight);
// Left Arm
BONEDEF_ADD (ShoulderLeft, ElbowLeft);
BONEDEF_ADD (ElbowLeft, WristLeft);
BONEDEF_ADD (WristLeft, HandLeft);
BONEDEF_ADD (HandLeft, HandTipLeft);
BONEDEF_ADD (WristLeft, ThumbLeft);
// Right Leg
BONEDEF_ADD (HipRight, KneeRight);
BONEDEF_ADD (KneeRight, AnkleRight);
BONEDEF_ADD (AnkleRight, FootRight);
// Left Leg
BONEDEF_ADD (HipLeft, KneeLeft);
BONEDEF_ADD (KneeLeft, AnkleLeft);
BONEDEF_ADD (AnkleLeft, FootLeft);
#undef BONEDEF_ADD
}
}
}
================================================
FILE: src/ofxKinectForWindows2/Data/Body.h
================================================
#pragma once
#include "Joint.h"
#include <map>
#include <Kinect.h>
#include <vector>
namespace ofxKinectForWindows2 {
namespace Data {
class Body {
public:
Body();
uint8_t bodyId;
uint64_t trackingId;
bool tracked;
HandState leftHandState;
HandState rightHandState;
std::map<JointType, Joint> joints;
std::map<Activity, DetectionResult> activity;
void drawWorld() const;
void clear();
Body operator*(const ofMatrix4x4 &) const;
static const std::vector<std::pair<JointType, JointType> > & getBonesAtlas();
protected:
static void initBonesAtlas();
static std::vector<std::pair<JointType, JointType> > * bonesAtlas;
};
}
}
================================================
FILE: src/ofxKinectForWindows2/Data/Joint.cpp
================================================
#include "Joint.h"
namespace ofxKinectForWindows2 {
namespace Data {
//----------
Joint::Joint(const _Joint& joint, const _JointOrientation& jointOrientation, ICoordinateMapper * coordinateMapper) {
this->set(joint, jointOrientation, coordinateMapper);
}
//----------
Joint::Joint(const _Joint& joint, const _JointOrientation& jointOrientation, const ofVec2f & jointInDepthSpace) {
this->set(joint, jointOrientation, jointInDepthSpace);
}
//----------
void Joint::set(const _Joint& joint, const _JointOrientation& jointOrientation, ICoordinateMapper * coordinateMapper) {
DepthSpacePoint depthSpacePoint;
coordinateMapper->MapCameraPointsToDepthSpace(1, &joint.Position, 1, &depthSpacePoint);
ofVec2f positionInDepthMap(depthSpacePoint.X, depthSpacePoint.Y);
this->set(joint, jointOrientation, positionInDepthMap);
}
//----------
void Joint::set(const _Joint& joint, const _JointOrientation& jointOrientation, const ofVec2f & positionInDepthMap) {
this->joint = joint;
this->positionInWorld.set(joint.Position.X, joint.Position.Y, joint.Position.Z);
this->positionInDepthMap = positionInDepthMap;
this->type = joint.JointType;
this->trackingState = joint.TrackingState;
this->jointOrientation = jointOrientation;
this->orientation.set(jointOrientation.Orientation.x, jointOrientation.Orientation.y, jointOrientation.Orientation.z, jointOrientation.Orientation.w);
}
//----------
JointType Joint::getType() const {
return type;
}
//----------
ofVec3f Joint::getPositionInWorld() const {
return positionInWorld;
}
//----------
ofVec2f Joint::getPositionInDepthMap() const {
return this->positionInDepthMap;
}
//----------
ofVec2f Joint::getProjected(ICoordinateMapper * coordinateMapper, ProjectionCoordinates proj) const {
switch (proj) {
case ColorCamera: {
ColorSpacePoint projected = { 0 };
coordinateMapper->MapCameraPointToColorSpace(joint.Position, &projected);
return ofVec2f(projected.X, projected.Y);
}
case DepthCamera: {
DepthSpacePoint projected = { 0 };
coordinateMapper->MapCameraPointToDepthSpace(joint.Position, &projected);
return ofVec2f(projected.X, projected.Y);
}
default:
return ofVec2f();
}
}
//----------
ofQuaternion Joint::getOrientation() const {
return orientation;
}
//----------
TrackingState Joint::getTrackingState() const {
return trackingState;
}
//----------
_Joint Joint::getRawJoint() const {
return this->joint;
}
//----------
_JointOrientation Joint::getRawJointOrientation() const {
return this->jointOrientation;
}
//----------
Joint Joint::operator*(const ofMatrix4x4 & transform) const {
auto copy = *this;
copy.positionInWorld = copy.positionInWorld * transform;
ofQuaternion rotationTransform;
rotationTransform.set(transform);
copy.orientation = copy.orientation * rotationTransform;
return copy;
}
}
}
================================================
FILE: src/ofxKinectForWindows2/Data/Joint.h
================================================
#pragma once
#define _HAS_STD_BYTE 0
#include "ofVectorMath.h"
// If your compiler is complaining that it can't find Kinect.h, then please make sure:
// 1) You have installed the Kinect SDK (e.g. v2.0_1409 is the latest version as of October 2015)
// 2) You have rebooted since installing the SDK. Some environment variables (e.g. the Kinect SDK folder) are only set after restarting.
#include <Kinect.h>
namespace ofxKinectForWindows2 {
enum ProjectionCoordinates {
DepthCamera,
ColorCamera
};
namespace Data {
class Joint
{
public:
Joint(){}
Joint(const _Joint& joint, const _JointOrientation& jointOrientation, ICoordinateMapper *);
Joint(const _Joint& joint, const _JointOrientation& jointOrientation, const ofVec2f & positionInDepthMap);
void set(const _Joint& joint, const _JointOrientation& jointOrientation, ICoordinateMapper *);
void set(const _Joint& joint, const _JointOrientation& jointOrientation, const ofVec2f & positionInDepthMap);
JointType getType() const;
ofVec3f getPositionInWorld() const;
ofVec2f getPositionInDepthMap() const;
ofVec3f getPosition() const {
return this->getPositionInWorld();
}
ofVec2f getProjected(ICoordinateMapper * coordinateMapper, ProjectionCoordinates proj = ColorCamera) const;
ofQuaternion getOrientation() const;
TrackingState getTrackingState() const;
_Joint getRawJoint() const;
_JointOrientation getRawJointOrientation() const;
Joint operator*(const ofMatrix4x4 &) const;
protected:
ofVec3f positionInWorld;
ofVec2f positionInDepthMap;
ofQuaternion orientation;
JointType type;
TrackingState trackingState;
_Joint joint;
_JointOrientation jointOrientation;
};
}
}
================================================
FILE: src/ofxKinectForWindows2/Device.cpp
================================================
#include "Device.h"
#include "of3dUtils.h"
#include "ofConstants.h"
#include "ofGraphics.h"
#if OF_VERSION_MAJOR > 0 || OF_VERSION_MINOR >= 10
#include "ofAppGLFWWindow.h"
#endif
#define CHECK_OPEN if(!this->sensor) { OFXKINECTFORWINDOWS2_ERROR << "Failed : Sensor is not open"; }
namespace ofxKinectForWindows2 {
//----------
Device::Device() {
this->sensor = nullptr;
this->reader = nullptr;
this->isFrameNewFlag = false;
}
//----------
Device::~Device() {
this->close();
}
//----------
void Device::open() {
try {
if (FAILED(GetDefaultKinectSensor(&this->sensor))) {
throw(Exception("Failed to find sensor"));
}
if (FAILED(this->sensor->Open())) {
throw(Exception("Failed to open sensor"));
}
} catch (std::exception & e) {
OFXKINECTFORWINDOWS2_ERROR << e.what();
this->sensor = nullptr;
}
}
//----------
void Device::close() {
SafeRelease(this->reader);
if (!this->sensor) {
return;
}
//release all sources.
this->sources.clear();
this->sensor->Close();
SafeRelease(this->sensor);
}
//----------
bool Device::isOpen() const {
if (!this->sensor) {
return false;
}
BOOLEAN result;
if (!FAILED(this->sensor->get_IsOpen(&result))) {
return result;
} else {
OFXKINECTFORWINDOWS2_ERROR << "Failed to check if sensor is open";
return false;
}
}
//----------
void Device::initMultiSource(std::initializer_list<FrameSourceTypes> frameSourceTypes) {
CHECK_OPEN;
if (!this->reader) {
DWORD enabledFrameSourceTypes = 0;
for (auto frameSourceType : frameSourceTypes) {
enabledFrameSourceTypes |= frameSourceType;
}
try {
if (!FAILED(this->sensor->OpenMultiSourceFrameReader(enabledFrameSourceTypes, &reader))) {
if (enabledFrameSourceTypes & FrameSourceTypes_Color) {
this->initSource<Source::Color>(false);
}
if (enabledFrameSourceTypes & FrameSourceTypes_Infrared) {
this->initSource<Source::Infrared>(false);
}
if (enabledFrameSourceTypes & FrameSourceTypes_LongExposureInfrared) {
this->initSource<Source::LongExposureInfrared>(false);
}
if (enabledFrameSourceTypes & FrameSourceTypes_Depth) {
this->initSource<Source::Depth>(false);
}
if (enabledFrameSourceTypes & FrameSourceTypes_BodyIndex) {
this->initSource<Source::BodyIndex>(false);
}
if (enabledFrameSourceTypes & FrameSourceTypes_Body) {
this->initSource<Source::Body>(false);
}
}
} catch (std::exception & e) {
OFXKINECTFORWINDOWS2_ERROR << e.what();
}
}
}
//----------
template<typename SourceType>
std::shared_ptr<SourceType> Device::initSource(bool initReader) {
CHECK_OPEN;
//first check if it already exists
{
auto source = this->getSource<SourceType>();
if (source) {
OFXKINECTFORWINDOWS2_WARNING << "Source of type " << typeid(SourceType).name() << " already initialised.";
return source;
}
}
//if not then open it
try {
auto source = MAKE(SourceType);
source->init(this->sensor, initReader);
this->sources.push_back(source);
return source;
} catch (std::exception & e) {
OFXKINECTFORWINDOWS2_ERROR << e.what();
return std::shared_ptr<SourceType>();
}
}
//----------
std::shared_ptr<Source::Depth> Device::initDepthSource() {
return this->initSource<Source::Depth>(true);
}
//----------
std::shared_ptr<Source::Color> Device::initColorSource() {
return this->initSource<Source::Color>(true);
}
//----------
std::shared_ptr<Source::Infrared> Device::initInfraredSource() {
return this->initSource<Source::Infrared>(true);
}
//----------
std::shared_ptr<Source::LongExposureInfrared> Device::initLongExposureInfraredSource() {
return this->initSource<Source::LongExposureInfrared>(true);
}
//----------
std::shared_ptr<Source::BodyIndex> Device::initBodyIndexSource() {
return this->initSource<Source::BodyIndex>(true);
}
//----------
std::shared_ptr<Source::Body> Device::initBodySource() {
return this->initSource<Source::Body>(true);
}
//----------
bool Device::releaseMultiSource() {
// look for sources initialized with MultiSource (those without their own reader)
// and erase them. They are consecutive in the vector
auto first = this->sources.begin();
while (first != this->sources.end() && (*first)->hasReader())
first++;
if (first == this->sources.end()) {
OFXKINECTFORWINDOWS2_WARNING << "No sources initialized with MultiSource.";
return false;
}
auto last = first;
while (last != this->sources.end() && !(*last)->hasReader())
last++;
this->sources.erase(first, last);
return true;
}
//----------
template<typename SourceType>
bool Device::releaseSource() {
CHECK_OPEN;
//check if it already exists
auto source = this->getSource<SourceType>();
if (source && source->hasReader()) {
this->sources.erase(std::remove(this->sources.begin(), this->sources.end(), source), this->sources.end());
return true;
}
//does not exist
OFXKINECTFORWINDOWS2_WARNING << "Source of type " << typeid(SourceType).name() << " not initialised, or in a MultiSource.";
return false;
}
//----------
bool Device::releaseDepthSource() {
return this->releaseSource<Source::Depth>();
}
//----------
bool Device::releaseColorSource() {
return this->releaseSource<Source::Color>();
}
//----------
bool Device::releaseInfraredSource() {
return this->releaseSource<Source::Infrared>();
}
//----------
bool Device::releaseLongExposureInfraredSource() {
return this->releaseSource<Source::LongExposureInfrared>();
}
//----------
bool Device::releaseBodyIndexSource() {
return this->releaseSource<Source::BodyIndex>();
}
//----------
bool Device::releaseBodySource() {
return this->releaseSource<Source::Body>();
}
//----------
void Device::update() {
this->isFrameNewFlag = false;
IMultiSourceFrame * frame = NULL;
if (this->reader) {
try {
//acquire frame
if (FAILED(this->reader->AcquireLatestFrame(&frame))) {
SafeRelease(frame);
return; // we often throw here when no new frame is available
}
} catch (std::exception & e) {
OFXKINECTFORWINDOWS2_ERROR << e.what();
}
}
for (auto source : this->sources) {
if (frame && !source->hasReader())
source->update(frame);
else
source->update();
this->isFrameNewFlag |= source->isFrameNew();
}
SafeRelease(frame);
}
//----------
bool Device::isFrameNew() const {
return this->isFrameNewFlag;
}
//----------
const std::vector<std::shared_ptr<Source::Base>> & Device::getSources() const {
return this->sources;
}
//----------
std::shared_ptr<Source::Depth> Device::getDepthSource() const {
return this->getSource<Source::Depth>();
}
//----------
std::shared_ptr<Source::Color> Device::getColorSource() const {
return this->getSource<Source::Color>();
}
//----------
std::shared_ptr<Source::Infrared> Device::getInfraredSource() const {
return this->getSource<Source::Infrared>();
}
//----------
std::shared_ptr<Source::LongExposureInfrared> Device::getLongExposureInfraredSource() const {
return this->getSource<Source::LongExposureInfrared>();
}
//----------
std::shared_ptr<Source::BodyIndex> Device::getBodyIndexSource() const {
return this->getSource<Source::BodyIndex>();
}
//----------
std::shared_ptr<Source::Body> Device::getBodySource() const {
return this->getSource<Source::Body>();
}
//----------
IKinectSensor * Device::getSensor() {
return this->sensor;
}
//----------
void Device::drawWorld() {
auto colorSource = this->getColorSource();
auto depthSource = this->getDepthSource();
auto bodySource = this->getBodySource();
if (!depthSource) {
ofLogError("ofxKinectForWindows2::Device::drawPrettyMesh") << "No depth source initialised";
return;
}
//point cloud
{
//setup some point cloud properties for kicks
bool usePointSize = true;
#if OF_VERSION_MAJOR > 0 || OF_VERSION_MINOR >= 10
auto mainWindow = std::static_pointer_cast<ofAppGLFWWindow>(ofGetCurrentWindow());
usePointSize = mainWindow ? mainWindow->getSettings().glVersionMajor <= 2 : false;
#endif
usePointSize = false;
if (usePointSize) {
glPushAttrib(GL_POINT_BIT);
glPointSize(5.0f);
glEnable(GL_POINT_SMOOTH);
}
ofPushStyle();
bool useColor = colorSource.get();
if (useColor) {
useColor &= colorSource->getTexture().isAllocated();
}
if (useColor) {
//bind kinect color camera texture and draw mesh from depth (which has texture coordinates)
colorSource->getTexture().bind();
}
auto opts = Source::Depth::PointCloudOptions(true, Source::Depth::PointCloudOptions::TextureCoordinates::ColorCamera);
auto mesh = depthSource->getMesh(opts);
//draw point cloud
mesh.drawVertices();
//draw triangles
ofSetColor(255, 150);
mesh.drawWireframe();
//draw fills faded
ofSetColor(255, 50);
mesh.drawFaces();
if (useColor) {
//unbind colour camera
colorSource->getTexture().unbind();
}
ofPopStyle();
//clear the point cloud drawing attributes
if (usePointSize) {
glPopAttrib();
}
}
//bodies and floor
if (bodySource) {
bodySource->drawWorld();
ofPushMatrix();
ofRotateDeg(90, 0, 0, 1);
ofMultMatrix(bodySource->getFloorTransform());
ofDrawGridPlane(5.0f);
ofPopMatrix();
}
//draw the view cones of depth and colour cameras
ofPushStyle();
ofNoFill();
ofSetLineWidth(2.0f);
ofSetColor(100, 200, 100);
depthSource->drawFrustum();
if (colorSource) {
ofSetColor(200, 100, 100);
colorSource->drawFrustum();
}
ofPopStyle();
}
//----------
void Device::setUseTextures(bool useTexture) {
auto sources = this->getSources();
for (auto source : sources) {
auto imageSource = std::dynamic_pointer_cast<ofBaseHasTexture>(source);
if (imageSource) {
imageSource->setUseTexture(useTexture);
}
}
}
}
================================================
FILE: src/ofxKinectForWindows2/Device.h
================================================
#pragma once
#include "Utils.h"
#include "Source/Depth.h"
#include "Source/Color.h"
#include "Source/Infrared.h"
#include "Source/LongExposureInfrared.h"
#include "Source/BodyIndex.h"
#include "Source/Body.h"
#include <memory>
#include <vector>
namespace ofxKinectForWindows2 {
class Device {
public:
Device();
virtual ~Device();
void open();
void close();
bool isOpen() const;
void initMultiSource(std::initializer_list<FrameSourceTypes> frameSourceTypes);
std::shared_ptr<Source::Depth> initDepthSource();
std::shared_ptr<Source::Color> initColorSource();
std::shared_ptr<Source::Infrared> initInfraredSource();
std::shared_ptr<Source::LongExposureInfrared> initLongExposureInfraredSource();
std::shared_ptr<Source::BodyIndex> initBodyIndexSource();
std::shared_ptr<Source::Body> initBodySource();
bool releaseMultiSource();
bool releaseDepthSource();
bool releaseColorSource();
bool releaseInfraredSource();
bool releaseLongExposureInfraredSource();
bool releaseBodyIndexSource();
bool releaseBodySource();
void update();
bool isFrameNew() const;
template<typename SourceType>
bool hasSource() const {
if (this->getSource<SourceType>()) {
return true;
}
else {
return false;
}
}
template<typename SourceType>
std::shared_ptr<SourceType> getSource() const {
for(auto source : this->sources) {
auto castSource = std::dynamic_pointer_cast<SourceType>(source);
if (castSource) {
return castSource;
}
}
return std::shared_ptr<SourceType>();
}
const std::vector<std::shared_ptr<Source::Base>> & getSources() const;
std::shared_ptr<Source::Depth> getDepthSource() const;
std::shared_ptr<Source::Color> getColorSource() const;
std::shared_ptr<Source::Infrared> getInfraredSource() const;
std::shared_ptr<Source::LongExposureInfrared> getLongExposureInfraredSource() const;
std::shared_ptr<Source::BodyIndex> getBodyIndexSource() const;
std::shared_ptr<Source::Body> getBodySource() const;
IKinectSensor * getSensor();
void drawWorld();
void setUseTextures(bool);
protected:
template<typename SourceType>
std::shared_ptr<SourceType> initSource(bool initReader);
template<typename SourceType>
bool releaseSource();
IKinectSensor * sensor;
IMultiSourceFrameReader * reader;
std::vector<std::shared_ptr<Source::Base>> sources;
bool isFrameNewFlag;
};
}
================================================
FILE: src/ofxKinectForWindows2/Source/Base.h
================================================
#pragma once
#include <string>
#include <Kinect.h>
namespace ofxKinectForWindows2 {
namespace Source {
class Base {
public:
virtual std::string getTypeName() const = 0;
virtual void init(IKinectSensor *, bool) = 0;
virtual void update() = 0;
virtual void update(IMultiSourceFrame *) = 0;
virtual bool isFrameNew() const = 0;
virtual bool hasReader() const = 0;
};
}
}
================================================
FILE: src/ofxKinectForWindows2/Source/BaseImage.cpp
================================================
#include "BaseImage.h"
#include "ofGraphics.h"
#include "ofMesh.h"
#define CHECK_OPEN if(!this->reader) { OFXKINECTFORWINDOWS2_ERROR << "Failed : Reader is not open"; }
namespace ofxKinectForWindows2 {
namespace Source {
#pragma mark BaseFrame
//----------
template <typename ReaderType, typename FrameType>
BaseFrame<typename ReaderType, typename FrameType>::BaseFrame() {
this->reader = NULL;
this->isFrameNewFlag = false;
}
//----------
template <typename ReaderType, typename FrameType>
BaseFrame<typename ReaderType, typename FrameType>::~BaseFrame() {
SafeRelease(this->reader);
}
//----------
template <typename ReaderType, typename FrameType>
void BaseFrame <typename ReaderType, typename FrameType>::init(IKinectSensor * sensor, bool reader) {
if (reader)
initReader(sensor);
}
//----------
template <typename ReaderType, typename FrameType>
bool BaseFrame <typename ReaderType, typename FrameType>::isFrameNew() const {
return this->isFrameNewFlag;
}
//----------
template <typename ReaderType, typename FrameType>
bool BaseFrame <typename ReaderType, typename FrameType>::hasReader() const {
if (this->reader)
return true;
else
return false;
}
//----------
template <typename ReaderType, typename FrameType>
void BaseFrame<typename ReaderType, typename FrameType>::update() {
CHECK_OPEN
this->isFrameNewFlag = false;
FrameType * frame = NULL;
try {
//acquire frame
if (FAILED(this->reader->AcquireLatestFrame(&frame))) {
SafeRelease(frame);
return; // we often throw here when no new frame is available
}
update(frame);
} catch (std::exception & e) {
OFXKINECTFORWINDOWS2_ERROR << e.what();
}
SafeRelease(frame);
}
#pragma mark BaseImage
//----------
template OFXKFW2_BaseImageSimple_TEMPLATE_ARGS
ofMesh BaseImage OFXKFW2_BaseImageSimple_TEMPLATE_ARGS_TRIM::frustumMesh;
//----------
template OFXKFW2_BaseImageSimple_TEMPLATE_ARGS
BaseImage OFXKFW2_BaseImageSimple_TEMPLATE_ARGS_TRIM::BaseImage() {
this->useTexture = true;
this->diagonalFieldOfView = 0.0f;
this->horizontalFieldOfView = 0.0f;
this->verticalFieldOfView = 0.0f;
this->lastFrameTime = 0;
if (this->frustumMesh.getVertices().empty()) {
this->frustumMesh.addVertex(ofVec3f(0.0f, 0.0f, 0.0f));
this->frustumMesh.addVertex(ofVec3f(-1.0f, -1.0f, 1.0f));
this->frustumMesh.addVertex(ofVec3f(-1.0f, +1.0f, 1.0f));
this->frustumMesh.addVertex(ofVec3f(+1.0f, +1.0f, 1.0f));
this->frustumMesh.addVertex(ofVec3f(+1.0f, -1.0f, 1.0f));
const ofIndexType indices[6] = {0, 1, 2, 3, 4, 1};
this->frustumMesh.addIndices(indices, 6);
this->frustumMesh.setMode(ofPrimitiveMode::OF_PRIMITIVE_TRIANGLE_FAN);
}
}
//----------
template OFXKFW2_BaseImageSimple_TEMPLATE_ARGS
ofTexture & BaseImage OFXKFW2_BaseImageSimple_TEMPLATE_ARGS_TRIM::getTexture() {
return this->texture;
}
//----------
template OFXKFW2_BaseImageSimple_TEMPLATE_ARGS
const ofTexture & BaseImage OFXKFW2_BaseImageSimple_TEMPLATE_ARGS_TRIM::getTexture() const {
return this->texture;
}
//----------
template OFXKFW2_BaseImageSimple_TEMPLATE_ARGS
void BaseImage OFXKFW2_BaseImageSimple_TEMPLATE_ARGS_TRIM::setUseTexture(bool useTexture) {
this->useTexture = useTexture;
if (!useTexture) {
this->texture.clear();
}
}
//----------
template OFXKFW2_BaseImageSimple_TEMPLATE_ARGS
ofPixels_<PixelType> & BaseImage OFXKFW2_BaseImageSimple_TEMPLATE_ARGS_TRIM::getPixels() {
return this->pixels;
}
//----------
template OFXKFW2_BaseImageSimple_TEMPLATE_ARGS
const ofPixels_<PixelType> & BaseImage OFXKFW2_BaseImageSimple_TEMPLATE_ARGS_TRIM::getPixels() const {
return this->pixels;
}
//----------
template OFXKFW2_BaseImageSimple_TEMPLATE_ARGS
void BaseImage OFXKFW2_BaseImageSimple_TEMPLATE_ARGS_TRIM::draw(float x, float y) const {
this->texture.draw(x, y);
}
//----------
template OFXKFW2_BaseImageSimple_TEMPLATE_ARGS
void BaseImage OFXKFW2_BaseImageSimple_TEMPLATE_ARGS_TRIM::draw(float x, float y, float width, float height) const {
this->texture.draw(x, y, width, height);
}
//----------
template OFXKFW2_BaseImageSimple_TEMPLATE_ARGS
float BaseImage OFXKFW2_BaseImageSimple_TEMPLATE_ARGS_TRIM::getWidth() const {
return this->pixels.getWidth();
}
//----------
template OFXKFW2_BaseImageSimple_TEMPLATE_ARGS
float BaseImage OFXKFW2_BaseImageSimple_TEMPLATE_ARGS_TRIM::getHeight() const {
return this->pixels.getHeight();
}
//----------
template OFXKFW2_BaseImageSimple_TEMPLATE_ARGS
float BaseImage OFXKFW2_BaseImageSimple_TEMPLATE_ARGS_TRIM::getDiagonalFieldOfView() const {
return this->diagonalFieldOfView;
}
//----------
template OFXKFW2_BaseImageSimple_TEMPLATE_ARGS
float BaseImage OFXKFW2_BaseImageSimple_TEMPLATE_ARGS_TRIM::getHorizontalFieldOfView() const {
return this->horizontalFieldOfView;
}
//----------
template OFXKFW2_BaseImageSimple_TEMPLATE_ARGS
float BaseImage OFXKFW2_BaseImageSimple_TEMPLATE_ARGS_TRIM::getVerticalFieldOfView() const {
return this->verticalFieldOfView;
}
//----------
template OFXKFW2_BaseImageSimple_TEMPLATE_ARGS
void BaseImage OFXKFW2_BaseImageSimple_TEMPLATE_ARGS_TRIM::drawFrustum() const {
ofPushMatrix();
ofScale(tan(DEG_TO_RAD * this->getHorizontalFieldOfView() / 2.0f), tan(DEG_TO_RAD * this->getVerticalFieldOfView() / 2.0f), 1.0f);
if (ofGetStyle().bFill) {
this->frustumMesh.drawFaces();
} else {
this->frustumMesh.drawWireframe();
}
ofPopMatrix();
}
#pragma mark BaseImageSimple
//----------
template OFXKFW2_BaseImageSimple_TEMPLATE_ARGS
void BaseImageSimple OFXKFW2_BaseImageSimple_TEMPLATE_ARGS_TRIM::update(FrameType * frame) {
this->isFrameNewFlag = true;
IFrameDescription * frameDescription = NULL;
try {
INT64 relativeTime = 0;
if (FAILED(frame->get_RelativeTime(&relativeTime))) {
throw Exception("Failed to get relative time");
}
if (relativeTime > this->lastFrameTime) {
relativeTime = this->lastFrameTime;
}
else {
return;
}
//allocate pixels and texture if we need to
if (FAILED(frame->get_FrameDescription(&frameDescription))) {
throw Exception("Failed to get frame description");
}
int width, height;
if (FAILED(frameDescription->get_Width(&width)) || FAILED(frameDescription->get_Height(&height))) {
throw Exception("Failed to get width and height of frame");
}
if (width != this->pixels.getWidth() || height != this->texture.getHeight()) {
this->pixels.allocate(width, height, OF_IMAGE_GRAYSCALE);
this->texture.allocate(this->pixels);
}
//update local assets
if (FAILED(frame->CopyFrameDataToArray(width * height, this->pixels.getData()))) {
throw Exception("Couldn't pull pixel buffer ");
}
if (this->useTexture) {
this->texture.loadData(this->pixels);
}
//update field of view
if (FAILED(frameDescription->get_HorizontalFieldOfView(&this->horizontalFieldOfView))) {
throw Exception("Failed to get horizonal field of view");
}
if (FAILED(frameDescription->get_VerticalFieldOfVie
gitextract_6bj2llpn/
├── .gitignore
├── README.md
├── addon_config.mk
├── example/
│ ├── addons.make
│ ├── example.sln
│ ├── example.vcxproj
│ ├── example.vcxproj.filters
│ ├── icon.rc
│ └── src/
│ ├── main.cpp
│ ├── ofApp.cpp
│ └── ofApp.h
├── exampleBodyIndexColor/
│ ├── addons.make
│ ├── exampleBodyIndexColor.sln
│ ├── exampleBodyIndexColor.vcxproj
│ ├── exampleBodyIndexColor.vcxproj.filters
│ ├── icon.rc
│ └── src/
│ ├── main.cpp
│ ├── ofApp.cpp
│ └── ofApp.h
├── exampleBodyIndexShader/
│ ├── addons.make
│ ├── example-bodyIndex.sln
│ ├── example-bodyIndex.vcxproj
│ ├── example-bodyIndex.vcxproj.filters
│ ├── icon.rc
│ └── src/
│ ├── main.cpp
│ ├── ofApp.cpp
│ └── ofApp.h
├── exampleDepthMeshShader/
│ ├── README.md
│ ├── addons.make
│ ├── exampleDepthMeshShader.sln
│ ├── exampleDepthMeshShader.vcxproj
│ ├── exampleDepthMeshShader.vcxproj.filters
│ ├── icon.rc
│ └── src/
│ ├── MeshUtils.h
│ ├── main.cpp
│ ├── ofApp.cpp
│ └── ofApp.h
├── exampleDepthToCameraTable/
│ ├── addons.make
│ ├── exampleDepthToCameraTable.sln
│ ├── exampleDepthToCameraTable.vcxproj
│ ├── exampleDepthToCameraTable.vcxproj.filters
│ ├── icon.rc
│ └── src/
│ ├── main.cpp
│ ├── ofApp.cpp
│ └── ofApp.h
├── exampleWithGui/
│ ├── addons.make
│ ├── example.sln
│ ├── example.vcxproj
│ ├── example.vcxproj.filters
│ ├── icon.rc
│ ├── src/
│ │ ├── main.cpp
│ │ ├── ofApp.cpp
│ │ └── ofApp.h
│ └── ~AutoRecover.example.vcxproj
├── ofxKinectForWindows2.props
├── ofxKinectForWindows2Lib/
│ ├── ofxKinectForWindows2Lib.vcxproj
│ └── ofxKinectForWindows2Lib.vcxproj.filters
└── src/
├── ofxKinectForWindows2/
│ ├── Data/
│ │ ├── Body.cpp
│ │ ├── Body.h
│ │ ├── Joint.cpp
│ │ └── Joint.h
│ ├── Device.cpp
│ ├── Device.h
│ ├── Source/
│ │ ├── Base.h
│ │ ├── BaseImage.cpp
│ │ ├── BaseImage.h
│ │ ├── Body.cpp
│ │ ├── Body.h
│ │ ├── BodyIndex.cpp
│ │ ├── BodyIndex.h
│ │ ├── Color.cpp
│ │ ├── Color.h
│ │ ├── Depth.cpp
│ │ ├── Depth.h
│ │ ├── Infrared.cpp
│ │ ├── Infrared.h
│ │ ├── LongExposureInfraRed.cpp
│ │ └── LongExposureInfrared.h
│ ├── Utils.cpp
│ └── Utils.h
└── ofxKinectForWindows2.h
SYMBOL INDEX (74 symbols across 36 files)
FILE: example/src/main.cpp
function main (line 4) | int main( ){
FILE: example/src/ofApp.h
function class (line 6) | class ofApp : public ofBaseApp{
FILE: exampleBodyIndexColor/src/main.cpp
function main (line 4) | int main( ){
FILE: exampleBodyIndexColor/src/ofApp.h
function class (line 6) | class ofApp : public ofBaseApp{
FILE: exampleBodyIndexShader/src/main.cpp
function main (line 4) | int main(){
FILE: exampleBodyIndexShader/src/ofApp.h
function class (line 8) | class ofApp : public ofBaseApp{
FILE: exampleDepthMeshShader/src/MeshUtils.h
function ofMesh (line 4) | static ofMesh gridMesh(int w, int h, float scale)
FILE: exampleDepthMeshShader/src/main.cpp
function main (line 4) | int main()
FILE: exampleDepthMeshShader/src/ofApp.h
function class (line 11) | class ofApp : public ofBaseApp
FILE: exampleDepthToCameraTable/src/main.cpp
function main (line 4) | int main( ){
FILE: exampleDepthToCameraTable/src/ofApp.h
function class (line 7) | class ofApp : public ofBaseApp{
FILE: exampleWithGui/src/main.cpp
function main (line 4) | int main( ){
FILE: exampleWithGui/src/ofApp.h
function class (line 7) | class ofApp : public ofBaseApp{
FILE: src/ofxKinectForWindows2/Data/Body.cpp
type ofxKinectForWindows2 (line 5) | namespace ofxKinectForWindows2 {
type Data (line 6) | namespace Data {
function Body (line 48) | Body Body::operator*(const ofMatrix4x4 & transform) const {
FILE: src/ofxKinectForWindows2/Data/Body.h
function namespace (line 9) | namespace ofxKinectForWindows2 {
FILE: src/ofxKinectForWindows2/Data/Joint.cpp
type ofxKinectForWindows2 (line 3) | namespace ofxKinectForWindows2 {
type Data (line 4) | namespace Data {
function JointType (line 38) | JointType Joint::getType() const {
function ofVec3f (line 43) | ofVec3f Joint::getPositionInWorld() const {
function ofVec2f (line 48) | ofVec2f Joint::getPositionInDepthMap() const {
function ofVec2f (line 53) | ofVec2f Joint::getProjected(ICoordinateMapper * coordinateMapper, Pr...
function ofQuaternion (line 71) | ofQuaternion Joint::getOrientation() const {
function TrackingState (line 76) | TrackingState Joint::getTrackingState() const {
function _Joint (line 81) | _Joint Joint::getRawJoint() const {
function _JointOrientation (line 86) | _JointOrientation Joint::getRawJointOrientation() const {
function Joint (line 91) | Joint Joint::operator*(const ofMatrix4x4 & transform) const {
FILE: src/ofxKinectForWindows2/Data/Joint.h
function namespace (line 11) | namespace ofxKinectForWindows2 {
FILE: src/ofxKinectForWindows2/Device.cpp
type ofxKinectForWindows2 (line 12) | namespace ofxKinectForWindows2 {
function IKinectSensor (line 297) | IKinectSensor * Device::getSensor() {
FILE: src/ofxKinectForWindows2/Device.h
function namespace (line 14) | namespace ofxKinectForWindows2 {
FILE: src/ofxKinectForWindows2/Source/Base.h
function namespace (line 6) | namespace ofxKinectForWindows2 {
FILE: src/ofxKinectForWindows2/Source/BaseImage.cpp
type ofxKinectForWindows2 (line 8) | namespace ofxKinectForWindows2 {
type Source (line 9) | namespace Source {
class BaseImageSimple<unsigned short, IDepthFrameReader, IDepthFrame> (line 239) | class BaseImageSimple<unsigned short, IDepthFrameReader, IDepthFrame>
class BaseImageSimple<unsigned short, IInfraredFrameReader, IInfraredFrame> (line 240) | class BaseImageSimple<unsigned short, IInfraredFrameReader, IInfraredF...
class BaseImageSimple<unsigned short, ILongExposureInfraredFrameReader, ILongExposureInfraredFrame> (line 241) | class BaseImageSimple<unsigned short, ILongExposureInfraredFrameReader...
class BaseImageSimple<unsigned char, IBodyIndexFrameReader, IBodyIndexFrame> (line 242) | class BaseImageSimple<unsigned char, IBodyIndexFrameReader, IBodyIndex...
class BaseImage<unsigned short, IDepthFrameReader, IDepthFrame> (line 243) | class BaseImage<unsigned short, IDepthFrameReader, IDepthFrame>
class BaseImage<unsigned short, IInfraredFrameReader, IInfraredFrame> (line 244) | class BaseImage<unsigned short, IInfraredFrameReader, IInfraredFrame>
class BaseImage<unsigned short, ILongExposureInfraredFrameReader, ILongExposureInfraredFrame> (line 245) | class BaseImage<unsigned short, ILongExposureInfraredFrameReader, ILon...
class BaseImage<unsigned char, IBodyIndexFrameReader, IBodyIndexFrame> (line 246) | class BaseImage<unsigned char, IBodyIndexFrameReader, IBodyIndexFrame>
class BaseImage<unsigned char, IColorFrameReader, IColorFrame> (line 247) | class BaseImage<unsigned char, IColorFrameReader, IColorFrame>
class BaseFrame<IBodyFrameReader, IBodyFrame> (line 248) | class BaseFrame<IBodyFrameReader, IBodyFrame>
FILE: src/ofxKinectForWindows2/Source/BaseImage.h
function namespace (line 11) | namespace ofxKinectForWindows2 {
FILE: src/ofxKinectForWindows2/Source/Body.cpp
type ofxKinectForWindows2 (line 6) | namespace ofxKinectForWindows2 {
type Source (line 7) | namespace Source {
function ofMatrix4x4 (line 19) | ofMatrix4x4 Body::getFloorTransform() {
function ICoordinateMapper (line 262) | ICoordinateMapper * Body::getCoordinateMapper() {
FILE: src/ofxKinectForWindows2/Source/Body.h
function namespace (line 11) | namespace ofxKinectForWindows2 {
FILE: src/ofxKinectForWindows2/Source/BodyIndex.cpp
type ofxKinectForWindows2 (line 3) | namespace ofxKinectForWindows2 {
type Source (line 4) | namespace Source {
FILE: src/ofxKinectForWindows2/Source/BodyIndex.h
function namespace (line 5) | namespace ofxKinectForWindows2 {
FILE: src/ofxKinectForWindows2/Source/Color.cpp
type ofxKinectForWindows2 (line 3) | namespace ofxKinectForWindows2 {
type Source (line 4) | namespace Source {
function ofPixels (line 162) | const ofPixels & Color::getYuvPixels() const {
FILE: src/ofxKinectForWindows2/Source/Color.h
function namespace (line 10) | namespace ofxKinectForWindows2 {
FILE: src/ofxKinectForWindows2/Source/Depth.cpp
type ofxKinectForWindows2 (line 3) | namespace ofxKinectForWindows2 {
type Source (line 4) | namespace Source {
function ofMesh (line 102) | ofMesh Depth::getMesh(const PointCloudOptions &opts) {
function ofMesh (line 172) | ofMesh Depth::getMesh(bool stitchFaces, PointCloudOptions::TextureCo...
function ofVbo (line 177) | ofVbo Depth::getVbo(const PointCloudOptions & pointCloudOptions) {
function ICoordinateMapper (line 239) | ICoordinateMapper * Depth::getCoordinateMapper() const {
FILE: src/ofxKinectForWindows2/Source/Depth.h
function namespace (line 9) | namespace ofxKinectForWindows2 {
FILE: src/ofxKinectForWindows2/Source/Infrared.cpp
type ofxKinectForWindows2 (line 3) | namespace ofxKinectForWindows2 {
type Source (line 4) | namespace Source {
FILE: src/ofxKinectForWindows2/Source/Infrared.h
function namespace (line 5) | namespace ofxKinectForWindows2 {
FILE: src/ofxKinectForWindows2/Source/LongExposureInfraRed.cpp
type ofxKinectForWindows2 (line 3) | namespace ofxKinectForWindows2 {
type Source (line 4) | namespace Source {
FILE: src/ofxKinectForWindows2/Source/LongExposureInfrared.h
function namespace (line 5) | namespace ofxKinectForWindows2 {
FILE: src/ofxKinectForWindows2/Utils.cpp
type ofxKinectForWindows2 (line 5) | namespace ofxKinectForWindows2 {
function string (line 22) | string toString(const JointType & jointType) {
FILE: src/ofxKinectForWindows2/Utils.h
function namespace (line 20) | namespace ofxKinectForWindows2 {
Condensed preview — 81 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (254K chars).
[
{
"path": ".gitignore",
"chars": 263,
"preview": "libs/\ndocs/\n\n*.depend\n*.layout\n*.mode*v3\n*.pbxuser\n*.app*\n*.DS_*\n._*.*\n\n.svn/\nobj/\nbin/\nbuild/\n!data/\nxcuserdata/\n\nipch/"
},
{
"path": "README.md",
"chars": 4748,
"preview": "ofxKinectForWindows2\n====================\n\n\nMAIN_ICON ICO"
},
{
"path": "example/src/main.cpp",
"chars": 333,
"preview": "#include \"ofApp.h\"\r\n\r\n//========================================================================\r\nint main( ){\r\n\tofSetup"
},
{
"path": "example/src/ofApp.cpp",
"chars": 3303,
"preview": "#include \"ofApp.h\"\n\nint previewWidth = 640;\nint previewHeight = 480;\n\n//------------------------------------------------"
},
{
"path": "example/src/ofApp.h",
"chars": 556,
"preview": "#pragma once\r\n\r\n#include \"ofxKinectForWindows2.h\"\r\n#include \"ofMain.h\"\r\n\r\nclass ofApp : public ofBaseApp{\r\n\r\n\tpublic:\r\n\t"
},
{
"path": "exampleBodyIndexColor/addons.make",
"chars": 0,
"preview": ""
},
{
"path": "exampleBodyIndexColor/exampleBodyIndexColor.sln",
"chars": 2918,
"preview": "Microsoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 14\nVisualStudioVersion = 14.0.23107.0\nMinimu"
},
{
"path": "exampleBodyIndexColor/exampleBodyIndexColor.vcxproj",
"chars": 10675,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project DefaultTargets=\"Build\" ToolsVersion=\"14.0\" xmlns=\"http://schemas.micros"
},
{
"path": "exampleBodyIndexColor/exampleBodyIndexColor.vcxproj.filters",
"chars": 614,
"preview": "<?xml version=\"1.0\"?>\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n\t<ItemGro"
},
{
"path": "exampleBodyIndexColor/icon.rc",
"chars": 230,
"preview": "// Icon Resource Definition\n#define MAIN_ICON 102\n\n#if defined(_DEBUG)\nMAIN_ICON ICO"
},
{
"path": "exampleBodyIndexColor/src/main.cpp",
"chars": 321,
"preview": "#include \"ofApp.h\"\n\n//========================================================================\nint main( ){\n\tofSetupOpen"
},
{
"path": "exampleBodyIndexColor/src/ofApp.cpp",
"chars": 5872,
"preview": "// This example shows how to work with the BodyIndex image in order to create\n// a green screen effect. Note that this i"
},
{
"path": "exampleBodyIndexColor/src/ofApp.h",
"chars": 762,
"preview": "#pragma once\n\n#include \"ofxKinectForWindows2.h\"\n#include \"ofMain.h\"\n\nclass ofApp : public ofBaseApp{\n\n\tpublic:\n\t\tvoid se"
},
{
"path": "exampleBodyIndexShader/addons.make",
"chars": 0,
"preview": ""
},
{
"path": "exampleBodyIndexShader/example-bodyIndex.sln",
"chars": 2760,
"preview": "Microsoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 2012\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C"
},
{
"path": "exampleBodyIndexShader/example-bodyIndex.vcxproj",
"chars": 10654,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project DefaultTargets=\"Build\" ToolsVersion=\"12.0\" xmlns=\"http://schemas.micros"
},
{
"path": "exampleBodyIndexShader/example-bodyIndex.vcxproj.filters",
"chars": 1356,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuil"
},
{
"path": "exampleBodyIndexShader/icon.rc",
"chars": 326,
"preview": "// Icon Resource Definition\n#define MAIN_ICON 102\n\n#if defined(_DEBUG)\nMAIN_ICON ICO"
},
{
"path": "exampleBodyIndexShader/src/main.cpp",
"chars": 342,
"preview": "#include \"ofApp.h\"\n\n//--------------------------------------------------------------\nint main(){\n#ifdef USE_PROGRAMMABLE"
},
{
"path": "exampleBodyIndexShader/src/ofApp.cpp",
"chars": 3069,
"preview": "#include \"ofApp.h\"\n\n//--------------------------------------------------------------\nvoid ofApp::setup(){\n\tkinect.open()"
},
{
"path": "exampleBodyIndexShader/src/ofApp.h",
"chars": 648,
"preview": "#pragma once\n\n#define USE_PROGRAMMABLE_PIPELINE 1\n\n#include \"ofxKinectForWindows2.h\"\n#include \"ofMain.h\"\n\nclass ofApp : "
},
{
"path": "exampleDepthMeshShader/README.md",
"chars": 1500,
"preview": "ofxKinectForWindows2 (exampleDepthMeshShader)\n====================\n\n\nMAIN_ICON ICO"
},
{
"path": "exampleDepthMeshShader/src/MeshUtils.h",
"chars": 754,
"preview": "#include \"ofMesh.h\"\n\n// uses normalized texcoords\nstatic ofMesh gridMesh(int w, int h, float scale)\n{\n\tofMesh mesh;\n\tmes"
},
{
"path": "exampleDepthMeshShader/src/main.cpp",
"chars": 254,
"preview": "#include \"ofApp.h\"\n\n//========================================================================\nint main()\n{\n\tofGLFWWindo"
},
{
"path": "exampleDepthMeshShader/src/ofApp.cpp",
"chars": 6678,
"preview": "/*\n\tAuthor: Lesley van Hoek\n\thttps://github.com/lshoek\n*/\n\n#include \"ofApp.h\"\n#include \"MeshUtils.h\"\n\nvoid ofApp::setup("
},
{
"path": "exampleDepthMeshShader/src/ofApp.h",
"chars": 1432,
"preview": "/*\n\tAuthor: Lesley van Hoek\n\thttps://github.com/lshoek\n*/\n\n#pragma once\n\n#include \"ofxKinectForWindows2.h\"\n#include \"ofM"
},
{
"path": "exampleDepthToCameraTable/addons.make",
"chars": 0,
"preview": ""
},
{
"path": "exampleDepthToCameraTable/exampleDepthToCameraTable.sln",
"chars": 3760,
"preview": "Microsoft Visual Studio Solution File, Format Version 12.00\r\n# Visual Studio 14\r\nVisualStudioVersion = 14.0.24720.0\r\nMin"
},
{
"path": "exampleDepthToCameraTable/exampleDepthToCameraTable.vcxproj",
"chars": 11326,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project DefaultTargets=\"Build\" ToolsVersion=\"14.0\" xmlns=\"http://schemas.micro"
},
{
"path": "exampleDepthToCameraTable/exampleDepthToCameraTable.vcxproj.filters",
"chars": 614,
"preview": "<?xml version=\"1.0\"?>\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n\t<ItemGro"
},
{
"path": "exampleDepthToCameraTable/icon.rc",
"chars": 238,
"preview": "// Icon Resource Definition\r\n#define MAIN_ICON 102\r\n\r\n#if defined(_DEBUG)\r\nMAIN_ICON "
},
{
"path": "exampleDepthToCameraTable/src/main.cpp",
"chars": 334,
"preview": "#include \"ofApp.h\"\r\n\r\n//========================================================================\r\nint main( ){\r\n\tofSetup"
},
{
"path": "exampleDepthToCameraTable/src/ofApp.cpp",
"chars": 3975,
"preview": "#include \"ofApp.h\"\r\n\r\n//--------------------------------------------------------------\r\nvoid ofApp::setup(){\r\n\t//suggest"
},
{
"path": "exampleDepthToCameraTable/src/ofApp.h",
"chars": 957,
"preview": "#pragma once\r\n\r\n#include \"ofxKinectForWindows2.h\"\r\n#include \"ofxCvGui.h\"\r\n#include \"ofMain.h\"\r\n\r\nclass ofApp : public of"
},
{
"path": "exampleWithGui/addons.make",
"chars": 0,
"preview": ""
},
{
"path": "exampleWithGui/example.sln",
"chars": 3710,
"preview": "Microsoft Visual Studio Solution File, Format Version 12.00\r\n# Visual Studio 14\r\nVisualStudioVersion = 14.0.23107.0\r\nMin"
},
{
"path": "exampleWithGui/example.vcxproj",
"chars": 11437,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project DefaultTargets=\"Build\" ToolsVersion=\"12.0\" xmlns=\"http://schemas.micro"
},
{
"path": "exampleWithGui/example.vcxproj.filters",
"chars": 614,
"preview": "<?xml version=\"1.0\"?>\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n\t<ItemGro"
},
{
"path": "exampleWithGui/icon.rc",
"chars": 326,
"preview": "// Icon Resource Definition\n#define MAIN_ICON 102\n\n#if defined(_DEBUG)\nMAIN_ICON ICO"
},
{
"path": "exampleWithGui/src/main.cpp",
"chars": 331,
"preview": "#include \"ofApp.h\"\r\n\r\n//========================================================================\r\nint main( ){\r\n\tofGLFWW"
},
{
"path": "exampleWithGui/src/ofApp.cpp",
"chars": 4569,
"preview": "#include \"ofApp.h\"\r\n\r\n//--------------------------------------------------------------\r\nvoid ofApp::setup(){\r\n\tkinect.op"
},
{
"path": "exampleWithGui/src/ofApp.h",
"chars": 621,
"preview": "#pragma once\r\n\r\n#include \"ofxKinectForWindows2.h\"\r\n#include \"ofxCvGui.h\"\r\n#include \"ofMain.h\"\r\n\r\nclass ofApp : public of"
},
{
"path": "exampleWithGui/~AutoRecover.example.vcxproj",
"chars": 11146,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project DefaultTargets=\"Build\" ToolsVersion=\"12.0\" xmlns=\"http://schemas.micro"
},
{
"path": "ofxKinectForWindows2.props",
"chars": 575,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbui"
},
{
"path": "ofxKinectForWindows2Lib/ofxKinectForWindows2Lib.vcxproj",
"chars": 9964,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project DefaultTargets=\"Build\" ToolsVersion=\"14.0\" xmlns=\"http://schemas.micro"
},
{
"path": "ofxKinectForWindows2Lib/ofxKinectForWindows2Lib.vcxproj.filters",
"chars": 4227,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbui"
},
{
"path": "src/ofxKinectForWindows2/Data/Body.cpp",
"chars": 3027,
"preview": "#include \"Body.h\"\r\n\r\n#include \"ofGraphics.h\"\r\n\r\nnamespace ofxKinectForWindows2 {\r\n\tnamespace Data {\r\n\t\t//----------\r\n\t\ts"
},
{
"path": "src/ofxKinectForWindows2/Data/Body.h",
"chars": 710,
"preview": "#pragma once\r\n\r\n#include \"Joint.h\"\r\n\r\n#include <map>\r\n#include <Kinect.h>\r\n#include <vector>\r\n\r\nnamespace ofxKinectForWi"
},
{
"path": "src/ofxKinectForWindows2/Data/Joint.cpp",
"chars": 3076,
"preview": "#include \"Joint.h\"\r\n\r\nnamespace ofxKinectForWindows2 {\r\n\tnamespace Data {\r\n\t\t//----------\r\n\t\tJoint::Joint(const _Joint& "
},
{
"path": "src/ofxKinectForWindows2/Data/Joint.h",
"chars": 1767,
"preview": "#pragma once\r\n#define _HAS_STD_BYTE 0\r\n\r\n#include \"ofVectorMath.h\"\r\n\r\n// If your compiler is complaining that it can't f"
},
{
"path": "src/ofxKinectForWindows2/Device.cpp",
"chars": 10341,
"preview": "#include \"Device.h\"\r\n\r\n#include \"of3dUtils.h\"\r\n#include \"ofConstants.h\"\r\n#include \"ofGraphics.h\"\r\n#if OF_VERSION_MAJOR >"
},
{
"path": "src/ofxKinectForWindows2/Device.h",
"chars": 2495,
"preview": "#pragma once\r\n\r\n#include \"Utils.h\"\r\n#include \"Source/Depth.h\"\r\n#include \"Source/Color.h\"\r\n#include \"Source/Infrared.h\"\r\n"
},
{
"path": "src/ofxKinectForWindows2/Source/Base.h",
"chars": 412,
"preview": "#pragma once\r\n\r\n#include <string>\r\n#include <Kinect.h>\r\n\r\nnamespace ofxKinectForWindows2 {\r\n\tnamespace Source {\r\n\t\tclass"
},
{
"path": "src/ofxKinectForWindows2/Source/BaseImage.cpp",
"chars": 8753,
"preview": "#include \"BaseImage.h\"\r\n\r\n#include \"ofGraphics.h\"\r\n#include \"ofMesh.h\"\r\n\r\n#define CHECK_OPEN if(!this->reader) { OFXKINE"
},
{
"path": "src/ofxKinectForWindows2/Source/BaseImage.h",
"chars": 2258,
"preview": "#pragma once\r\n\r\n#include \"../Utils.h\"\r\n\r\n#include \"ofBaseTypes.h\"\r\n#include \"ofTexture.h\"\r\n#include \"ofPixels.h\"\r\n\r\n#inc"
},
{
"path": "src/ofxKinectForWindows2/Source/Body.cpp",
"chars": 8504,
"preview": "#include \"Body.h\"\r\n\r\n#include \"ofGraphics.h\"\r\n#include \"ofNode.h\"\r\n\r\nnamespace ofxKinectForWindows2 {\r\n\tnamespace Source"
},
{
"path": "src/ofxKinectForWindows2/Source/Body.h",
"chars": 1308,
"preview": "#pragma once\n\n#include \"ofVectorMath.h\"\n\n#include \"BaseImage.h\"\n#include \"../Utils.h\"\n\n#include \"../Data/Body.h\"\n#includ"
},
{
"path": "src/ofxKinectForWindows2/Source/BodyIndex.cpp",
"chars": 1395,
"preview": "#include \"BodyIndex.h\"\r\n\r\nnamespace ofxKinectForWindows2 {\r\n\tnamespace Source {\r\n\t\t//----------\r\n\t\tstd::string BodyIndex"
},
{
"path": "src/ofxKinectForWindows2/Source/BodyIndex.h",
"chars": 374,
"preview": "#pragma once\r\n\r\n#include \"BaseImage.h\"\r\n\r\nnamespace ofxKinectForWindows2 {\r\n\tnamespace Source {\r\n\t\tclass BodyIndex : pub"
},
{
"path": "src/ofxKinectForWindows2/Source/Color.cpp",
"chars": 4842,
"preview": "#include \"Color.h\"\r\n\r\nnamespace ofxKinectForWindows2 {\r\n\tnamespace Source {\r\n\t\t//----------\r\n\t\tColor::Color() {\r\n\r\n\t\t}\r\n"
},
{
"path": "src/ofxKinectForWindows2/Source/Color.h",
"chars": 1068,
"preview": "#pragma once\r\n\r\n#include \"BaseImage.h\"\r\n#include \"../Utils.h\"\r\n\r\n#include \"ofBaseTypes.h\"\r\n#include \"ofPixels.h\"\r\n#inclu"
},
{
"path": "src/ofxKinectForWindows2/Source/Depth.cpp",
"chars": 8684,
"preview": "#include \"Depth.h\"\r\n\r\nnamespace ofxKinectForWindows2 {\r\n\tnamespace Source {\r\n\t\t//----------\r\n\t\tDepth::PointCloudOptions:"
},
{
"path": "src/ofxKinectForWindows2/Source/Depth.h",
"chars": 1678,
"preview": "#pragma once\r\n\r\n#include \"ofMesh.h\"\r\n#include \"ofPixels.h\"\r\n#include \"ofVbo.h\"\r\n\r\n#include \"BaseImage.h\"\r\n\r\nnamespace of"
},
{
"path": "src/ofxKinectForWindows2/Source/Infrared.cpp",
"chars": 1381,
"preview": "#include \"Infrared.h\"\r\n\r\nnamespace ofxKinectForWindows2 {\r\n\tnamespace Source {\r\n\t\t//----------\r\n\t\tstd::string Infrared::"
},
{
"path": "src/ofxKinectForWindows2/Source/Infrared.h",
"chars": 374,
"preview": "#pragma once\r\n\r\n#include \"BaseImage.h\"\r\n\r\nnamespace ofxKinectForWindows2 {\r\n\tnamespace Source {\r\n\t\tclass Infrared : publ"
},
{
"path": "src/ofxKinectForWindows2/Source/LongExposureInfraRed.cpp",
"chars": 1528,
"preview": "#include \"LongExposureInfrared.h\"\r\n\r\nnamespace ofxKinectForWindows2 {\r\n\tnamespace Source {\r\n\t\t//----------\r\n\t\tstd::strin"
},
{
"path": "src/ofxKinectForWindows2/Source/LongExposureInfrared.h",
"chars": 410,
"preview": "#pragma once\r\n\r\n#include \"BaseImage.h\"\r\n\r\nnamespace ofxKinectForWindows2 {\r\n\tnamespace Source {\r\n\t\tclass LongExposureInf"
},
{
"path": "src/ofxKinectForWindows2/Utils.cpp",
"chars": 1549,
"preview": "#include \"Utils.h\"\r\n\r\nusing namespace std;\r\n\r\nnamespace ofxKinectForWindows2 {\r\n\t//----------\r\n\tException::Exception(con"
},
{
"path": "src/ofxKinectForWindows2/Utils.h",
"chars": 990,
"preview": "#pragma once\r\n\r\n// Fix for C++17\r\n#define _HAS_STD_BYTE 0\r\n\r\n#ifndef __func__\r\n#define __func__ __FUNCTION__\r\n#endif\r\n\r\n"
},
{
"path": "src/ofxKinectForWindows2.h",
"chars": 96,
"preview": "#pragma once\r\n\r\n#include \"ofxKinectForWindows2/Device.h\"\r\n\r\n#define ofxKFW2 ofxKinectForWindows2"
}
]
About this extraction
This page contains the full source code of the elliotwoods/ofxKinectForWindows2 GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 81 files (223.1 KB), approximately 63.9k tokens, and a symbol index with 74 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.