如何使用缩放图像在Kinect中进行联合跟踪 [英] How to do Joint tracking in Kinect with a scaled Image

查看:63
本文介绍了如何使用缩放图像在Kinect中进行联合跟踪的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用kinect进行一些联合跟踪(只是在我的右手内侧放置一个椭圆形),对于默认的640x480图像,一切正常,我基于

I trying to do some Joint Tracking with kinect (just put a ellipse inside my right hand) everything works fine for a default 640x480 Image, i based myself in this channel9 video. My code, updated to use the new CoordinateMapper classe is here

 ...
CoordinateMapper cm = new CoordinateMapper(this.KinectSensorManager.KinectSensor);
ColorImagePoint handColorPoint = cm.MapSkeletonPointToColorPoint(atualSkeleton.Joints[JointType.HandRight].Position, ColorImageFormat.RgbResolution640x480Fps30);

Canvas.SetLeft(elipseHead, (handColorPoint.X) - (elipseHead.Width / 2)); // center of the ellipse in center of the joint
Canvas.SetTop(elipseHead, (handColorPoint.Y) - (elipseHead.Height / 2));

这有效.问题是:

如何在缩放后的图像(例如540x380)中进行联合跟踪?

推荐答案

解决方案非常简单,我把它弄糊涂了.

The solution for this is pretty simple, i fugured it out.

需要做的是找到一些适用于该职位的因素. 可以找到这种因素,例如Kinect的ColorColorFormat,然后除以所需的大小,例如:

What a need to do is find some factor to apply to the position. This factor can be found takin the atual ColorImageFormat of the Kinect and dividing by the desired size, example:

让我们说我正在使用RgbResolution640x480Fps30格式,并且我的图像(ColorViewer)具有220x240.因此,让我们找到X的因子:

Lets say i am working with the RgbResolution640x480Fps30 format and my Image (ColorViewer) have 220x240. So, lets find the factor for X:

double factorX = (640 / 220); // the factor is 2.90909090...

以及y的因数:

double factorY = (480/ 240); // the factor is 2...

现在,我使用此因子调整椭圆的位置.

Now, i adjust the position of the ellipse using this factor.

Canvas.SetLeft(elipseHead, (handColorPoint.X / (2.909090)) - (elipseHead.Width / 2));
Canvas.SetTop(elipseHead, (handColorPoint.Y / (2)) - (elipseHead.Height / 2));

这篇关于如何使用缩放图像在Kinect中进行联合跟踪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆