From ad51ff62748f0bc4563ea40a561d2703e1f234e7 Mon Sep 17 00:00:00 2001 From: liuyunhui Date: Fri, 10 Oct 2025 17:16:08 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=A7=86=E9=A2=91?= =?UTF-8?q?=E6=92=AD=E6=94=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Content/Blueprints/BP_MediaPlayerController.uasset | 4 ++-- .../Content/Blueprints/BP_UDPMessageProcessor.uasset | 4 ++-- SpaceStudioClient/Content/Blueprints/BP_Windows.uasset | 4 ++-- SpaceStudioClient/Content/Blueprints/UI/WB_Wall_A.uasset | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/SpaceStudioClient/Content/Blueprints/BP_MediaPlayerController.uasset b/SpaceStudioClient/Content/Blueprints/BP_MediaPlayerController.uasset index 54d6eed..49eebce 100644 --- a/SpaceStudioClient/Content/Blueprints/BP_MediaPlayerController.uasset +++ b/SpaceStudioClient/Content/Blueprints/BP_MediaPlayerController.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c645fea18c8f3f511f50e5c30eb4742693dc8f22575b551fb5273d7f7b9f0f55 -size 466883 +oid sha256:bb898af0765270dcba35c12281088db2dadf5e1837de2392a8ab8c13849a9ddf +size 466585 diff --git a/SpaceStudioClient/Content/Blueprints/BP_UDPMessageProcessor.uasset b/SpaceStudioClient/Content/Blueprints/BP_UDPMessageProcessor.uasset index 69eae53..87cf284 100644 --- a/SpaceStudioClient/Content/Blueprints/BP_UDPMessageProcessor.uasset +++ b/SpaceStudioClient/Content/Blueprints/BP_UDPMessageProcessor.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f50c907789031f4389bf1bc84991230f740b19d482210af4a1fdd26bf2762c63 -size 514265 +oid sha256:b540b9a1644ec32aa0424abf727f5440153c90b4006f671bf6298de19662e8f3 +size 516390 diff --git a/SpaceStudioClient/Content/Blueprints/BP_Windows.uasset b/SpaceStudioClient/Content/Blueprints/BP_Windows.uasset index c76b055..ee55dff 100644 --- a/SpaceStudioClient/Content/Blueprints/BP_Windows.uasset +++ b/SpaceStudioClient/Content/Blueprints/BP_Windows.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:10e6473ea6523e69260bf18e813be9a6237c8072d37aedec11782d0653f994d8 -size 177033 +oid sha256:1d65031e8134b0c82dc85be622728a2560bf1db386d99b5cdc4edf88c45afc8c +size 177589 diff --git a/SpaceStudioClient/Content/Blueprints/UI/WB_Wall_A.uasset b/SpaceStudioClient/Content/Blueprints/UI/WB_Wall_A.uasset index 0d34175..32cc23b 100644 --- a/SpaceStudioClient/Content/Blueprints/UI/WB_Wall_A.uasset +++ b/SpaceStudioClient/Content/Blueprints/UI/WB_Wall_A.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:792ab48b4eb5dac9d72d04593162b94a29502a4c73d961d8911fbcabc179e594 -size 185827 +oid sha256:80654cf84fdde5ec7aaac9e61b46e8b0a0395168e52af3888949d5856c573272 +size 184808 From 89e7834f114ebc9b78ccfd209f3677293ab4348a Mon Sep 17 00:00:00 2001 From: liuyunhui Date: Fri, 10 Oct 2025 21:29:02 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9Kinect=E4=BA=A4=E4=BA=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Blueprints/UI/M_KinentBodys.uasset | 4 +- .../Content/Blueprints/UI/WB_Wall_A.uasset | 4 +- .../NeoKinectUnreal/NeoKinectUnreal.Build.cs | 14 +++-- .../Private/NeoKinectManager.cpp | 55 ++++++++++++++++--- .../NeoKinectUnreal/Public/NeoKinectManager.h | 1 - 5 files changed, 60 insertions(+), 18 deletions(-) diff --git a/SpaceStudioClient/Content/Blueprints/UI/M_KinentBodys.uasset b/SpaceStudioClient/Content/Blueprints/UI/M_KinentBodys.uasset index 3b737f0..bd06038 100644 --- a/SpaceStudioClient/Content/Blueprints/UI/M_KinentBodys.uasset +++ b/SpaceStudioClient/Content/Blueprints/UI/M_KinentBodys.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a828bacc8a754e9865143d5823ebb0c4f77dc62373805325acfae7e9e9771abd -size 11442 +oid sha256:f8909626f21b120afe8868fb147dcd463af600916bfe016d8ea21634a4b789f4 +size 11410 diff --git a/SpaceStudioClient/Content/Blueprints/UI/WB_Wall_A.uasset b/SpaceStudioClient/Content/Blueprints/UI/WB_Wall_A.uasset index 32cc23b..d87287e 100644 --- a/SpaceStudioClient/Content/Blueprints/UI/WB_Wall_A.uasset +++ b/SpaceStudioClient/Content/Blueprints/UI/WB_Wall_A.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:80654cf84fdde5ec7aaac9e61b46e8b0a0395168e52af3888949d5856c573272 -size 184808 +oid sha256:d418a2e73a02e1574989b6925469099947601f2cf00b2315f09e2ae7755bbe79 +size 185362 diff --git a/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/NeoKinectUnreal/NeoKinectUnreal.Build.cs b/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/NeoKinectUnreal/NeoKinectUnreal.Build.cs index a0fef70..6c8860c 100644 --- a/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/NeoKinectUnreal/NeoKinectUnreal.Build.cs +++ b/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/NeoKinectUnreal/NeoKinectUnreal.Build.cs @@ -19,6 +19,8 @@ public class NeoKinectUnreal : ModuleRules { "Core", "CoreUObject", + "OpenCV", + "OpenCVHelper" // ... add other public dependencies that you statically link with here ... }); @@ -34,13 +36,14 @@ public class NeoKinectUnreal : ModuleRules string neoKinectPath = Path.Combine(thirdPartyPath, "NeoKinect"); string kinectPath = Path.Combine(thirdPartyPath, "Kinect"); + //string openCVPath = Path.Combine(thirdPartyPath, "OpenCV"); - PublicSystemLibraryPaths.Add(Path.Combine(neoKinectPath, "Lib")); + PublicSystemLibraryPaths.Add(Path.Combine(neoKinectPath, "Lib")); PublicIncludePaths.Add(Path.Combine(neoKinectPath, "Inc")); PublicSystemLibraryPaths.Add(Path.Combine(kinectPath, "Lib")); PublicIncludePaths.Add(Path.Combine(kinectPath, "Inc")); - const string FaceLibraryName = "Kinect20.Face"; + const string FaceLibraryName = "Kinect20.Face"; // Add static libraries PublicSystemLibraries.AddRange(new[] @@ -48,14 +51,14 @@ public class NeoKinectUnreal : ModuleRules "NeoKinect.lib", "Kinect20.lib", FaceLibraryName + ".lib" - }); + }); // Add dynamic libraries const string KinectFaceDllName = FaceLibraryName + ".dll"; PublicDelayLoadDLLs.AddRange(new[] { KinectFaceDllName - }); + }); // Define library name for code to be able to check for its presence PrivateDefinitions.Add("KINECT_FACE_DLL_NAME=\"" + KinectFaceDllName + "\""); @@ -64,5 +67,6 @@ public class NeoKinectUnreal : ModuleRules const string ProjectDLLDir = "$(ProjectDir)/Binaries/Win64"; RuntimeDependencies.Add(Path.Combine(ProjectDLLDir, KinectFaceDllName)); RuntimeDependencies.Add(Path.Combine(ProjectDLLDir, "NuiDatabase/..."), StagedFileType.NonUFS); - } + + } } diff --git a/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/NeoKinectUnreal/Private/NeoKinectManager.cpp b/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/NeoKinectUnreal/Private/NeoKinectManager.cpp index adc1ee3..d69a056 100644 --- a/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/NeoKinectUnreal/Private/NeoKinectManager.cpp +++ b/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/NeoKinectUnreal/Private/NeoKinectManager.cpp @@ -12,7 +12,9 @@ #include "Engine/TextureRenderTarget2D.h" #include "HAL/PlatformProcess.h" #include "UObject/Package.h" - +#include "PreOpenCVHeaders.h" +#include "opencv2/opencv.hpp" +#include "PostOpenCVHeaders.h" using namespace NeoKinect; //~ STRUCTS METHODS @@ -74,7 +76,6 @@ FFrameTextureData UNeoKinectManager::FramesData[static_cast(EKinectFrame: UNeoKinectManager* UNeoKinectManager::EventsDispatcher = nullptr; FTSTicker::FDelegateHandle UNeoKinectManager::TickerHandle; - #pragma endregion Statics //~ INITIALIZATION / UNINITIALIZATION @@ -238,6 +239,7 @@ void UNeoKinectManager::InitStatics() fd.UFrameType = static_cast(i); fd.BufferSize = fd.Width * fd.Height * fd.PixelSize; } + } #pragma endregion Initialization_Uninitialization @@ -1140,13 +1142,50 @@ void UNeoKinectManager::UpdateFrames() { ThreadBuffer.Lock(); { - RHIUpdateTexture2D( - FrameData.Texture->GetRenderTargetResource()->GetRenderTargetTexture(), - 0, - FUpdateTextureRegion2D(0, 0, 0, 0, FrameData.Width, FrameData.Height), - FrameData.Width * FrameData.PixelSize, - Buffer + if (FrameData.KFrameType == KinectFrameType::BodyIndex) + { + cv::Mat binaryImage(FrameData.Height, FrameData.Width, CV_8UC4); + memcpy(binaryImage.data, Buffer, FrameData.Height * FrameData.Width * FrameData.PixelSize); + cv::Mat processedImage; + cv::resize(binaryImage, processedImage, cv::Size(FrameData.Width / 2, FrameData.Height / 2), 0, 0, cv::INTER_CUBIC); + cv::Mat kernel = cv::getStructuringElement(cv::MORPH_ELLIPSE, cv::Size(5, 5)); + cv::morphologyEx(processedImage, processedImage, cv::MORPH_OPEN, kernel); // 去噪 + cv::morphologyEx(processedImage, processedImage, cv::MORPH_CLOSE, kernel); // 填充 + cv::GaussianBlur(processedImage, processedImage, cv::Size(5, 5), 1.0); + std::vector> contours; + cv::findContours(processedImage, contours, cv::RETR_EXTERNAL, cv::CHAIN_APPROX_SIMPLE); + std::vector> approxContours(contours.size()); + for (size_t j = 0; j < contours.size(); j++) { + cv::approxPolyDP(contours[j], approxContours[j], 2.0, true); + } + double minArea = 500; // 示例阈值 + for (auto it = approxContours.begin(); it != approxContours.end(); ) { + if (cv::contourArea(*it) < minArea) it = approxContours.erase(it); + else ++it; + } + cv::drawContours(processedImage, approxContours, -1, cv::Scalar(0)); + cv::resize(processedImage, processedImage, cv::Size(FrameData.Width, FrameData.Height), 0, 0, cv::INTER_CUBIC); + + + + RHIUpdateTexture2D( + FrameData.Texture->GetRenderTargetResource()->GetRenderTargetTexture(), + 0, + FUpdateTextureRegion2D(0, 0, 0, 0, FrameData.Width, FrameData.Height), + FrameData.Width * FrameData.PixelSize, + processedImage.data ); + } + else + { + RHIUpdateTexture2D( + FrameData.Texture->GetRenderTargetResource()->GetRenderTargetTexture(), + 0, + FUpdateTextureRegion2D(0, 0, 0, 0, FrameData.Width, FrameData.Height), + FrameData.Width * FrameData.PixelSize, + Buffer + ); + } } ThreadBuffer.Unlock(); } diff --git a/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/NeoKinectUnreal/Public/NeoKinectManager.h b/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/NeoKinectUnreal/Public/NeoKinectManager.h index 2e726bf..b4adc0b 100644 --- a/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/NeoKinectUnreal/Public/NeoKinectManager.h +++ b/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/NeoKinectUnreal/Public/NeoKinectManager.h @@ -7,7 +7,6 @@ #include "NeoKinectEnums.h" #include "PixelFormat.h" #include "Containers/Ticker.h" - #include "NeoKinectManager.generated.h" class FKinectThread; From c5e6e60609fd5c13e1d359980c103314a1d6d28d Mon Sep 17 00:00:00 2001 From: liuyunhui Date: Fri, 10 Oct 2025 21:34:11 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9Kinect=E4=BA=A4=E4=BA=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../NeoKinectUnreal/Private/NeoKinectManager.cpp | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/NeoKinectUnreal/Private/NeoKinectManager.cpp b/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/NeoKinectUnreal/Private/NeoKinectManager.cpp index d69a056..7644a58 100644 --- a/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/NeoKinectUnreal/Private/NeoKinectManager.cpp +++ b/SpaceStudioClient/Plugins/NeoKinectUnreal/Source/NeoKinectUnreal/Private/NeoKinectManager.cpp @@ -1152,22 +1152,8 @@ void UNeoKinectManager::UpdateFrames() cv::morphologyEx(processedImage, processedImage, cv::MORPH_OPEN, kernel); // 去噪 cv::morphologyEx(processedImage, processedImage, cv::MORPH_CLOSE, kernel); // 填充 cv::GaussianBlur(processedImage, processedImage, cv::Size(5, 5), 1.0); - std::vector> contours; - cv::findContours(processedImage, contours, cv::RETR_EXTERNAL, cv::CHAIN_APPROX_SIMPLE); - std::vector> approxContours(contours.size()); - for (size_t j = 0; j < contours.size(); j++) { - cv::approxPolyDP(contours[j], approxContours[j], 2.0, true); - } - double minArea = 500; // 示例阈值 - for (auto it = approxContours.begin(); it != approxContours.end(); ) { - if (cv::contourArea(*it) < minArea) it = approxContours.erase(it); - else ++it; - } - cv::drawContours(processedImage, approxContours, -1, cv::Scalar(0)); cv::resize(processedImage, processedImage, cv::Size(FrameData.Width, FrameData.Height), 0, 0, cv::INTER_CUBIC); - - RHIUpdateTexture2D( FrameData.Texture->GetRenderTargetResource()->GetRenderTargetTexture(), 0,