修改Kinect交互
This commit is contained in:
-14
@@ -1152,22 +1152,8 @@ void UNeoKinectManager::UpdateFrames()
|
|||||||
cv::morphologyEx(processedImage, processedImage, cv::MORPH_OPEN, kernel); // 去噪
|
cv::morphologyEx(processedImage, processedImage, cv::MORPH_OPEN, kernel); // 去噪
|
||||||
cv::morphologyEx(processedImage, processedImage, cv::MORPH_CLOSE, kernel); // 填充
|
cv::morphologyEx(processedImage, processedImage, cv::MORPH_CLOSE, kernel); // 填充
|
||||||
cv::GaussianBlur(processedImage, processedImage, cv::Size(5, 5), 1.0);
|
cv::GaussianBlur(processedImage, processedImage, cv::Size(5, 5), 1.0);
|
||||||
std::vector<std::vector<cv::Point>> contours;
|
|
||||||
cv::findContours(processedImage, contours, cv::RETR_EXTERNAL, cv::CHAIN_APPROX_SIMPLE);
|
|
||||||
std::vector<std::vector<cv::Point>> 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);
|
cv::resize(processedImage, processedImage, cv::Size(FrameData.Width, FrameData.Height), 0, 0, cv::INTER_CUBIC);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
RHIUpdateTexture2D(
|
RHIUpdateTexture2D(
|
||||||
FrameData.Texture->GetRenderTargetResource()->GetRenderTargetTexture(),
|
FrameData.Texture->GetRenderTargetResource()->GetRenderTargetTexture(),
|
||||||
0,
|
0,
|
||||||
|
|||||||
Reference in New Issue
Block a user