错误:在NuiSensor.h函数中未定义显示标识符的Intellisense [英] Error : Intellisense showing identifier is undefined in NuiSensor.h function
问题描述
我正在尝试从Kinect获取颜色和深度图像。我使用的是Kinect SDK v-1.8.0和MS Visual Studio 2010,代码是用C ++编写的。
首先,对齐我使用的深度和彩色图像NuiImageGetColorPixelCoordinatesFromDepthPixelAtResolution将深度映射为颜色。但由于它在像素级别工作,结果很慢,而且我正在丢失帧。 Capture得到了几乎
5-fps,没有映射它以30-fps工作。
所以相反,现在我正在使用NuiImageGetColorPixelCoordinateFrameFromDepthPixelFrameAtResolution 它在帧级工作。
但IntelliSense显示"错误:标识符未定义"。我已经包括了两个< NuiApi.h>和< NuiSensor.h>在我的代码中(虽然只包括< NuiApi.h>已经足够了,因为它已经调用了另一个)。
这是一段代码:
I am trying to get color and depth images from Kinect. I am using Kinect SDK v-1.8.0 and MS Visual Studio 2010 and code is in C++.
At first, to align the depth and color images I was using NuiImageGetColorPixelCoordinatesFromDepthPixelAtResolution to map depth into color. But since it works at pixel level, it turned out to be pretty slow and I was losing frames. Capture got down to almost
5-fps, without mapping it was working at 30-fps.
So instead, now I am using NuiImageGetColorPixelCoordinateFrameFromDepthPixelFrameAtResolution which works at frame level.
But IntelliSense is showing "Error: identifier is undefined". I have included both <NuiApi.h> and <NuiSensor.h> in my code (though only including <NuiApi.h> would have sufficed since it calls the other one already).
Here is the piece of code:
long *pMappedBits = new long[COLOR_WIDTH * COLOR_HIGHT * 2];
if (depthLockedRect.Pitch != 0 && colorLockedRect.Pitch != 0)
{
USHORT * depthBuff = (USHORT*) depthLockedRect.pBits;
NuiImageGetColorPixelCoordinateFrameFromDepthPixelFrameAtResolution(NUI_IMAGE_RESOLUTION_640x480, NUI_IMAGE_RESOLUTION_640x480, DEPTH_WIDTH * DEPTH_HIGHT, depthBuff, COLOR_WIDTH * COLOR_HIGHT * 2, pMappedBits);
// code to align depth and color images
}
我还包括< windows.h>当我遇到一个论坛时,但它也没有用。我甚至检查了我的< NuiSensor.h>文件,它包含的功能好了。
I have also included <windows.h> as I came across a forum, but then also it's not working. I even checked my <NuiSensor.h> file, it contains the function alright
#define INuiSensor_NuiImageGetColorPixelCoordinateFrameFromDepthPixelFrameAtResolution(This,eColorResolution,eDepthResolution,cDepthValues,pDepthValues,cColorCoordinates,pColorCoordinates) \
( (This)->lpVtbl -> NuiImageGetColorPixelCoordinateFrameFromDepthPixelFrameAtResolution(This,eColorResolution,eDepthResolution,cDepthValues,pDepthValues,cColorCoordinates,pColorCoordinates) )
对于可能原因的任何帮助将受到高度赞赏。更令我困惑的是NuiImageGetColorPixelCoordinatesFromDepthPixelAtResolution工作得非常好,我得到了正确映射的图像,但这个不是。
提前谢谢。
Any help regarding the probable cause would be highly appreciated. What's confusing me more is that NuiImageGetColorPixelCoordinatesFromDepthPixelAtResolution was working absolutely fine and I was getting the correctly mapped image, but this one isn't.
Thanks in advance.
推荐答案
您还需要在Windows.h之后和Kinect.h之前包含Shlobj.h。样品是否有效?看看提供的代码。另外,这些api被弃用,有利于坐标映射器api。看一下coordinateMappingBasics样本
供其使用。
You need to also include the Shlobj.h after Windows.h and before Kinect.h. Do the samples work? Have a look at the code provided. Also, those api's are deprecated in favor of the coordinate mapper api's. Have a look at the coordinateMappingBasics sample for its use.
这篇关于错误:在NuiSensor.h函数中未定义显示标识符的Intellisense的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!