我正在使用Kinect传感器,我正在尝试对齐深度和颜色框架,以便我可以将它们保存为彼此"适合"的图像.我花了很多时间浏览msdn论坛和Kinect SDK的适度文档,我完全无处可去.
基于这个答案:Kinect:从RGB坐标转换为深度坐标
我有以下功能,在哪里depthData和colorData从中获取NUI_LOCKED_RECT.pBits并且mappedData是包含新颜色框架的输出,映射到深度坐标:
bool mapColorFrameToDepthFrame(unsigned char *depthData, unsigned char* colorData, unsigned char* mappedData)
{
INuiCoordinateMapper* coordMapper;
// Get coordinate mapper
m_pSensor->NuiGetCoordinateMapper(&coordMapper);
NUI_DEPTH_IMAGE_POINT* depthPoints = new NUI_DEPTH_IMAGE_POINT[640 * 480];
HRESULT result = coordMapper->MapColorFrameToDepthFrame(NUI_IMAGE_TYPE_COLOR, NUI_IMAGE_RESOLUTION_640x480, NUI_IMAGE_RESOLUTION_640x480, 640 * 480, reinterpret_cast<NUI_DEPTH_IMAGE_PIXEL*>(depthData), 640 * 480, depthPoints);
if (FAILED(result))
{
return false;
}
int pos = 0;
int* colorRun = reinterpret_cast<int*>(colorData);
int* mappedRun = reinterpret_cast<int*>(mappedData);
// For each pixel of new color frame
for (int …Run Code Online (Sandbox Code Playgroud) 目前我正在为Kinect for Windows v2开发一个工具(类似于XBOX ONE中的那个).我尝试了一些示例,并有一个工作示例,显示相机图像,深度图像,以及使用opencv将深度映射到rgb的图像.但是我看到它在进行映射时重复了我的手,我认为这是由于坐标映射器部分出了问题.
这是一个例子:

这是创建图像的代码片段(示例中的rgbd图像)
void KinectViewer::create_rgbd(cv::Mat& depth_im, cv::Mat& rgb_im, cv::Mat& rgbd_im){
HRESULT hr = m_pCoordinateMapper->MapDepthFrameToColorSpace(cDepthWidth * cDepthHeight, (UINT16*)depth_im.data, cDepthWidth * cDepthHeight, m_pColorCoordinates);
rgbd_im = cv::Mat::zeros(depth_im.rows, depth_im.cols, CV_8UC3);
double minVal, maxVal;
cv::minMaxLoc(depth_im, &minVal, &maxVal);
for (int i=0; i < cDepthHeight; i++){
for (int j=0; j < cDepthWidth; j++){
if (depth_im.at<UINT16>(i, j) > 0 && depth_im.at<UINT16>(i, j) < maxVal * (max_z / 100) && depth_im.at<UINT16>(i, j) > maxVal * min_z /100){
double a = i * cDepthWidth + j; …Run Code Online (Sandbox Code Playgroud) 我最近开始使用Kinect SDK 2.0,并专注于缩放和平移功能,如Control Basics-WPF示例中所示.
我已经启动并运行了缩放和平移功能.问题是我希望访问由Pinch缩放手势执行的缩放量的值.
这是我的xaml:
<UserControl x:Class="ImageNav.NavigationImage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:k="http://schemas.microsoft.com/kinect/2014"
mc:Ignorable="d"
d:DesignWidth="1200"
d:DesignHeight="700"
>
<Grid Grid.RowSpan="2">
<ScrollViewer Name="scrollViewer" Grid.Row="0"
HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"
k:KinectRegion.IsHorizontalRailEnabled="true" k:KinectRegion.IsVerticalRailEnabled="true"
k:KinectRegion.ZoomMode="Enabled">
<Image Name="navigationImage" RenderTransformOrigin="0.5, 0.5" />
</ScrollViewer>
<TextBox x:Name="ZoomTextBox" Grid.Row="1" TextWrapping="Wrap" Text="Zoom: 100%" IsEnabled="False" Panel.ZIndex="10" BorderThickness="0" HorizontalAlignment="Right" VerticalAlignment="Bottom" FontSize="20"/>
</Grid>
</UserControl>
Run Code Online (Sandbox Code Playgroud)
我本来希望有类似的东西k:KinectRegion.ZoomFactor,但那是不可用的.我也想看看在UI元素,当我执行缩放手势,通过写什么样的变化Height和ActualHeight的性质ScrollViewer scrollViewer和Image navigationImage日志文件,但它们没有显示出任何的变化.
当我执行缩放手势时,我想获得缩放的值,即图像的当前高度和宽度相对于原始高度和宽度.
我用Kinect v2和C#玩了一下,试图得到一个512x424像素大小的图像阵列,其中包含深度数据以及相关的颜色信息(RGBA).
所以我用这个MultiSourceFrameReader班来接收MultiSourceFrame我得到的ColorFrame和DepthFrame.通过这些方法ColorFrame.CopyConvertedFrameDataToArray(),DepthFrame.CopyFrameDataToArray()我收到了包含颜色和深度信息的数组:
// Contains 4*1920*1080 entries of color-info: BGRA|BGRA|BGRA..
byte[] cFrameData = new byte[4 * cWidth * cHeight];
cFrame.CopyConvertedFrameDataToArray(cFrameData, ColorImageFormat.Bgra);
// Has 512*424 entries with depth information
ushort[] dFrameData = new ushort[dWidth* dHeight];
dFrame.CopyFrameDataToArray(dFrameData);
Run Code Online (Sandbox Code Playgroud)
现在,我必须将ColorFrame-data-array中的颜色四倍映射到DepthFrame-data-array cFrameData的每个条目,dFrameData但这就是我被卡住的地方.输出应该是阵列大小的4倍(RGBA/BGRA)的dFrameData数组,并包含深度帧的每个像素的颜色信息:
// Create the array that contains the color information for every depth-pixel
byte[] dColors = new byte[4 * dFrameData.Length];
for (int i = 0, j = …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用Kinect for Xbox 360开发面部识别应用程序.我想知道应该使用哪个SDK和Visual Studio版本来最佳地访问Kinect.
我在使用SDK 2.0安装Kinect for Windows(V1版本)时遇到问题.我假设SDK 2.0还包含v1所需的驱动程序,因为下载细节说明引入了对Kinect for Windows v2传感器的支持.
我遇到的问题是在USB 3.0端口插入kinect后(kinect已插入AC),它安装了驱动程序,但设备管理器有黄色三角形,并且它不断发出插入/拔出的声音.
我错过了一个步骤,还是应该使用不同的SDK版本(如果是,哪一个)?
目前我正在开展一个使用Kinect的项目,这个项目要求我知道那个人在那个时候所看到的地方,我发现我需要找到那个人的视线.
现在,我可以找到人的骨骼的头部但不能跟踪眼球运动.
if (body.TrackingState == SkeletonTrackingState.Tracked)
{
Joint joint = body.Joints[JointType.Head];
SkeletonPoint skeletonPoint = joint.Position;
// 2D coordinates in pixels
System.Drawing.Point point = new System.Drawing.Point();
if (_mode == CameraMode.Color)
{
// Skeleton-to-Color mapping
ColorImagePoint colorPoint = _sensor.CoordinateMapper.MapSkeletonPointToColorPoint(skeletonPoint, ColorImageFormat.RgbResolution640x480Fps30);
point.X = colorPoint.X;
point.Y = colorPoint.Y;
//Console.WriteLine(" X == " + point.X + " Y == " + point.Y);
X = (int)Math.Floor(point.X + 0.5);
Y = (int)Math.Floor(point.Y + 0.5);
}
// DRAWING...
Ellipse ellipse = new Ellipse
{
Fill = System.Windows.Media.Brushes.LightBlue,
Width …Run Code Online (Sandbox Code Playgroud) 要求是在3D空间中围绕每只眼睛定义矩形.应该有一种使用Microsoft Kinect SDK跟踪眼睛的方法.根据这个
Face Tracking SDK使用Kinect坐标系输出其3D跟踪结果.原点位于相机的光学中心(传感器),Z轴指向用户,Y轴指向上方.测量单位是用于平移的米和用于旋转角度的度.
添加
...
Debug3DShape("OuterCornerOfRightEye", faceTrackFrame.Get3DShape()
[FeaturePoint.OuterCornerOfRightEye]);
Debug3DShape("InnerCornerRightEye", faceTrackFrame.Get3DShape()
[FeaturePoint.InnerCornerRightEye]);
Debug3DShape("InnerCornerLeftEye", faceTrackFrame.Get3DShape()
[FeaturePoint.InnerCornerLeftEye]);
Debug3DShape("OuterCornerOfLeftEye", faceTrackFrame.Get3DShape()
[FeaturePoint.OuterCornerOfLeftEye]);
...
private void Debug3DShape(string s, Vector3DF v)
{
Debug.WriteLine(s + " X " + v.X + " Y " + v.Y + " Z " + v.Z);
}
Run Code Online (Sandbox Code Playgroud)
到Microsoft.Kinect.Toolkit.FaceTracking中的CreateResult()打印
OuterCornerOfRightEye X -0.05728126 Y 0.04850625 Z -0.1144406
InnerCornerRightEye X -0.01584376 Y 0.04850625 Z -0.1279687
InnerCornerLeftEye X 0.01584374 Y 0.04850625 Z -0.1279687
OuterCornerOfLeftEye X 0.05728124 Y 0.04850625 Z -0.1144406
Run Code Online (Sandbox Code Playgroud)
当SDK开始跟踪面部时.我应该可以使用这些坐标在每只眼睛周围画一个框,但Z坐标应该更接近1.0,而不是-0.1 ..或-0.2 …
在我的应用程序中,我得到的深度框架类似于从深度基础样本中检索到的深度框架.我不明白的是,为什么图像中存在离散的水平?我不知道我称之为深度值的这些突然变化.很明显,我右手的一半都是黑色的,我的左手似乎分为3个这样的等级.这是什么以及如何删除它?
Kinect Depth Basics示例http://i46.tinypic.com/2hwekxd.jpg
当我运行KinectExplorer示例应用程序时,我获得如下深度.这是我想从原始深度数据生成的深度图像.
Kinect Explorer http://i50.tinypic.com/2rwx1z5.jpg
我正在使用Microsoft Kinect SDK(v1.6)NuiApi和OpenCV.我有以下代码:
BYTE *pBuffer = (BYTE*)depthLockedRect.pBits; //pointer to data having 8-bit jump
USHORT *depthBuffer = (USHORT*) pBuffer; //pointer to data having 16-bit jump
int cn = 4;
this->depthFinal = cv::Mat::zeros(depthHeight,depthWidth,CV_8UC4); //8bit 4 channel
for(int i=0;i<this->depthFinal.rows;i++){
for(int j=0;j<this->depthFinal.cols;j++){
USHORT realdepth = ((*depthBuffer)&0x0fff); //Taking 12LSBs for depth
BYTE intensity = (BYTE)((255*realdepth)/0x0fff); //Scaling to 255 scale grayscale
this->depthFinal.data[i*this->depthFinal.cols*cn + j*cn + 0] = intensity;
this->depthFinal.data[i*this->depthFinal.cols*cn + j*cn + 1] = intensity;
this->depthFinal.data[i*this->depthFinal.cols*cn + j*cn …Run Code Online (Sandbox Code Playgroud) 我正在研究一种扩展方法,将一个骨架移动到kinect字段os视图中的所需位置.
我的代码接收要移动的骨架和命运位置,我计算接收到的骨架髋关节中心和命运位置之间的距离how much to move,然后在应用此因子的关节中进行迭代.我的代码,实际上看起来像这样.
public static Skeleton MoveTo(this Skeleton skToBeMoved, Vector4 destiny)
{
Joint newJoint = new Joint();
///Based on the HipCenter (i dont know if it is reliable, seems it is.)
float howMuchMoveToX = Math.Abs(skToBeMoved.Joints[JointType.HipCenter].Position.X - destiny.X);
float howMuchMoveToY = Math.Abs(skToBeMoved.Joints[JointType.HipCenter].Position.Y - destiny.Y);
float howMuchMoveToZ = Math.Abs(skToBeMoved.Joints[JointType.HipCenter].Position.Z - destiny.Z);
float howMuchToMultiply = 1;
// Iterate in the 20 Joints
foreach (JointType item in Enum.GetValues(typeof(JointType)))
{
newJoint = skToBeMoved.Joints[item];
// This adjust, try to keeps the skToBeMoved …Run Code Online (Sandbox Code Playgroud) kinect-sdk ×10
kinect ×9
c# ×4
c++ ×2
opencv ×2
colors ×1
depth ×1
eye-tracking ×1
kinect-v2 ×1
scrollview ×1
wpf ×1