Kinect V2 已閱讀深度問題
Kinect V2 read Depth issue
给出了以下C++代码,该代码不断从 Kinect 2 获取最新帧。
#include <Kinect.h>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <Windows.h>
#include <iostream>
using namespace std;
const int width = 512;
const int height = 424;
const int colorwidth = 1920;
const int colorheight = 1080;
IDepthFrameReader* reader; // Kinect depth data source
IKinectSensor* sensor = nullptr;
int main(int argc, char* argv[]) {
if (FAILED(GetDefaultKinectSensor(&sensor))) {
return 19;
}
if (sensor) {
sensor->Open();
IDepthFrameSource* framesource = NULL;
sensor->get_DepthFrameSource(&framesource);
framesource->OpenReader(&reader);
if (framesource) {
framesource->Release();
framesource = NULL;
}
IDepthFrame* frame = NULL;
if (SUCCEEDED(reader->AcquireLatestFrame(&frame))) {
cout << "not bad";
getchar();
return 100;
}
else{
cout << "not found";
getchar();
return 23;
}
}
else {
return -1;
}
}
实际上,如果我是否将Kinect连接到笔记本电脑,输出不会改变,并且是:"未找到"。當我連接 Kinect 並運行程序時,Kinect 的燈會亮起。在某些现成的代码中,Kinect 可以正常工作。问题出在哪里?
您应该查看返回的错误代码以获取AcquireLatestFrame
,也许它可以告诉您问题所在。
这里有一个提示:也许,当你打电话给AcquireLatestFrame
时,框架还不可用。所以把这个调用放进一个循环中,迟早帧会可用。
相关文章:
- C++17复制构造函数,在std::unordereded_map上进行深度复制
- OpenGL在启用深度测试时不会丢弃我的碎片
- C++尝试深度复制唯一指针时出现内存访问冲突
- 试图找到二叉树的深度
- 如何修改代码以打印出数组 v2
- 操纵安卓相机的深度图导致应用程序崩溃
- 深度值没有意义 R200 相机
- 提升精神 V2 Qi 语法线程安全吗?
- 对如何制作双链表的深度副本感到困惑?
- 以C++访问 HoloLens 2 深度图像
- 在 c++ 中使用深度复制的运算符重载
- 如何深度复制链表对象指针
- 提升图:当我的图使用 listS 作为 VertexList 时,如何调用深度优先搜索()?
- 如何在 cpp 中解压缩数字,如果它们是使用 struct.pack(fmt, v1, v2, ..) 打包在 pyth
- 在 OpenCV 中按深度维度排序,C++
- 将Kinect v2帧速率(rgb、深度、骨架)设置为每秒25帧
- 在 UWP 中使用C++录制 Kinect V2.0(颜色和深度)
- Kinect V2 已閱讀深度問題
- 有人使用kinect-v2的openNI获取了深度图像
- C++ Kinect v2 & freenect2:如何将深度数据转换为真实世界的坐标