Kinect 如何根据深度图像坐标获取彩色图像像素点

飞天狐213 2014-09-14 09:57:20
在 Kinect 中虽然可以通过相应的 api 把深度图像坐标转换到彩色图像坐标。但是我现在希望用彩色图像显示出某点与深度图像对应的像素。

如果通过api MapDepthToColorImagePoint,只能得到彩色图像的像素坐标。

假如我现在得到了彩色图像的像素坐标了,那我也没办法直接通过该坐标知道该像素的具体信息(RGB值)吧?因为像素的信息是存放在 frame 结构体中的texture 的 rect 中的,而里面是以一维数组的形式存放像素点的。

也就是说彩色图像的坐标与彩色像素点的存放不存在直接对应关系,还要通过转换才能得到。问题是我应该如何转换?

又比如我现在知道一个彩色图像的像素点坐标是:x = 3,y = 4,那么我怎么知道该像素点的 rgb 信息呢?或者说我怎么知道其对应 rect 中数组的那个索引呢?谢谢!
...全文
931 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
赵4老师 2014-09-15
  • 打赏
  • 举报
回复
GetPixel The GetPixel function retrieves the red, green, blue (RGB) color value of the pixel at the specified coordinates. COLORREF GetPixel( HDC hdc, // handle to device context int XPos, // x-coordinate of pixel int nYPos // y-coordinate of pixel ); Parameters hdc Handle to the device context. nXPos Specifies the logical x-coordinate of the pixel to be examined. nYPos Specifies the logical y-coordinate of the pixel to be examined. Return Values The return value is the RGB value of the pixel. If the pixel is outside of the current clipping region, the return value is CLR_INVALID. Remarks The pixel must be within the boundaries of the current clipping region. Not all devices support GetPixel. An application should call GetDeviceCaps to determine whether a specified device supports this function. QuickInfo Windows NT: Requires version 3.1 or later. Windows: Requires Windows 95 or later. Windows CE: Requires version 1.0 or later. Header: Declared in wingdi.h. Import Library: Use gdi32.lib. See Also Bitmaps Overview, Bitmap Functions, GetDeviceCaps, SetPixel

3,881

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 其它技术问题
社区管理员
  • 其它技术问题社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧