From e05f137eeec4b6e8e127f164cf695a76a58c16ff Mon Sep 17 00:00:00 2001 From: doomertheboomer Date: Fri, 28 Jul 2023 14:51:42 +0700 Subject: [PATCH] create configuration program --- .gitignore | 6 +- depthrush.sln | 10 ++ depthrushConfig/calibration.cpp | 52 +++++++ depthrushConfig/calibration.h | 2 + depthrushConfig/depthrushConfig.cpp | 23 +++ depthrushConfig/depthrushConfig.vcxproj | 145 ++++++++++++++++++ .../depthrushConfig.vcxproj.filters | 33 ++++ depthrushConfig/includes.h | 7 + 8 files changed, 276 insertions(+), 2 deletions(-) create mode 100644 depthrushConfig/calibration.cpp create mode 100644 depthrushConfig/calibration.h create mode 100644 depthrushConfig/depthrushConfig.cpp create mode 100644 depthrushConfig/depthrushConfig.vcxproj create mode 100644 depthrushConfig/depthrushConfig.vcxproj.filters create mode 100644 depthrushConfig/includes.h diff --git a/.gitignore b/.gitignore index 33de78e..ee08d32 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ .vs/ x64/ -depthrush/x64/ Release/ -depthrush/Release/ \ No newline at end of file +depthrush/x64/ +depthrush/Release/ +depthrushConfig/x64/ +depthrushConfig/Release/ \ No newline at end of file diff --git a/depthrush.sln b/depthrush.sln index 9cbc62f..10a9a64 100644 --- a/depthrush.sln +++ b/depthrush.sln @@ -5,6 +5,8 @@ VisualStudioVersion = 17.2.32616.157 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "depthrush", "depthrush\depthrush.vcxproj", "{04B17470-CB82-4724-904B-25445926AB86}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "depthrushConfig", "depthrushConfig\depthrushConfig.vcxproj", "{AF89F70A-7F60-4B1C-9532-CE7BBD02EA56}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x64 = Debug|x64 @@ -21,6 +23,14 @@ Global {04B17470-CB82-4724-904B-25445926AB86}.Release|x64.Build.0 = Release|x64 {04B17470-CB82-4724-904B-25445926AB86}.Release|x86.ActiveCfg = Release|Win32 {04B17470-CB82-4724-904B-25445926AB86}.Release|x86.Build.0 = Release|Win32 + {AF89F70A-7F60-4B1C-9532-CE7BBD02EA56}.Debug|x64.ActiveCfg = Debug|x64 + {AF89F70A-7F60-4B1C-9532-CE7BBD02EA56}.Debug|x64.Build.0 = Debug|x64 + {AF89F70A-7F60-4B1C-9532-CE7BBD02EA56}.Debug|x86.ActiveCfg = Debug|Win32 + {AF89F70A-7F60-4B1C-9532-CE7BBD02EA56}.Debug|x86.Build.0 = Debug|Win32 + {AF89F70A-7F60-4B1C-9532-CE7BBD02EA56}.Release|x64.ActiveCfg = Release|x64 + {AF89F70A-7F60-4B1C-9532-CE7BBD02EA56}.Release|x64.Build.0 = Release|x64 + {AF89F70A-7F60-4B1C-9532-CE7BBD02EA56}.Release|x86.ActiveCfg = Release|Win32 + {AF89F70A-7F60-4B1C-9532-CE7BBD02EA56}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/depthrushConfig/calibration.cpp b/depthrushConfig/calibration.cpp new file mode 100644 index 0000000..3b53f59 --- /dev/null +++ b/depthrushConfig/calibration.cpp @@ -0,0 +1,52 @@ +#include "includes.h" +Vector4 leftLegPos = { 1.5F, 1.5F, 1.5F, 1.5F }; +Vector4 rightLegPos = { 1.5F, 1.5F, 1.5F, 1.5F }; + +int calibration() { + + // initialize Kinect + HRESULT hr = NuiInitialize(NUI_INITIALIZE_FLAG_USES_SKELETON); + if (FAILED(hr)) { + std::cout << "Failed to initialize Kinect." << std::endl; + return 1; + } + + // open the skeleton stream + HANDLE skeletonStream = nullptr; + hr = NuiSkeletonTrackingEnable(nullptr, 0); + if (FAILED(hr)) { + std::cout << "Failed to open the skeleton stream." << std::endl; + NuiShutdown(); + return 1; + } + + // start calibration application + std::thread calibrateMenu([] { + std::cout << std::to_string(leftLegPos.x); + }); + calibrateMenu.detach(); + + // main loop to read and process skeleton data + NUI_SKELETON_FRAME skeletonFrame = { 0 }; + while (true) { + // get the latest skeleton frame + hr = NuiSkeletonGetNextFrame(0, &skeletonFrame); + if (FAILED(hr)) { + continue; + } + + // Process each tracked skeleton + for (int i = 0; i < NUI_SKELETON_COUNT; ++i) { + if (skeletonFrame.SkeletonData[i].eTrackingState == NUI_SKELETON_TRACKED) { + // get the position of both legs + leftLegPos = skeletonFrame.SkeletonData[i].SkeletonPositions[NUI_SKELETON_POSITION_ANKLE_LEFT]; + rightLegPos = skeletonFrame.SkeletonData[i].SkeletonPositions[NUI_SKELETON_POSITION_ANKLE_RIGHT]; + } + } + } + + // Clean up and exit + NuiSkeletonTrackingDisable(); + NuiShutdown(); + return 0; +} \ No newline at end of file diff --git a/depthrushConfig/calibration.h b/depthrushConfig/calibration.h new file mode 100644 index 0000000..31423ba --- /dev/null +++ b/depthrushConfig/calibration.h @@ -0,0 +1,2 @@ +#pragma once +int calibration(); \ No newline at end of file diff --git a/depthrushConfig/depthrushConfig.cpp b/depthrushConfig/depthrushConfig.cpp new file mode 100644 index 0000000..d61cd54 --- /dev/null +++ b/depthrushConfig/depthrushConfig.cpp @@ -0,0 +1,23 @@ +#include "includes.h" + +int main() +{ + int choice = 0; + std::cout << "Depthrush test application\n"; + std::cout << "1. Calibrate Kinect\n"; + std::cout << "2. Preview Kinect\n"; + std::cout << "Enter a choice (1,2): "; + std::cin >> choice; + if (choice == 1) { + calibration(); + return 0; + } + else if (choice == 2) { + std::cout << "okay 2"; + return 0; + } + else { + std::cout << "Invalid option!"; + } + return 0; +} \ No newline at end of file diff --git a/depthrushConfig/depthrushConfig.vcxproj b/depthrushConfig/depthrushConfig.vcxproj new file mode 100644 index 0000000..bca088f --- /dev/null +++ b/depthrushConfig/depthrushConfig.vcxproj @@ -0,0 +1,145 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 16.0 + Win32Proj + {af89f70a-7f60-4b1c-9532-ce7bbd02ea56} + depthrushConfig + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + C:\Program Files\Microsoft SDKs\Kinect\v1.7\inc;$(IncludePath) + C:\Program Files\Microsoft SDKs\Kinect\v1.7\lib\amd64;$(LibraryPath) + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + Kinect10.lib;%(AdditionalDependencies) + + + + + + + + + + + + + + \ No newline at end of file diff --git a/depthrushConfig/depthrushConfig.vcxproj.filters b/depthrushConfig/depthrushConfig.vcxproj.filters new file mode 100644 index 0000000..6a20e07 --- /dev/null +++ b/depthrushConfig/depthrushConfig.vcxproj.filters @@ -0,0 +1,33 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + \ No newline at end of file diff --git a/depthrushConfig/includes.h b/depthrushConfig/includes.h new file mode 100644 index 0000000..7b5daaf --- /dev/null +++ b/depthrushConfig/includes.h @@ -0,0 +1,7 @@ +#pragma once +#include +#include +#include +#include +#include +#include "calibration.h" \ No newline at end of file