隔离在深度图象的手 [英] Isolating hands in depth image

查看:67
本文介绍了隔离在深度图象的手的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我已经和Kinect玩了几天了,其目的是在手牌打开和关闭时检测到它。我现在有一个解决方案,它似乎有效,但它依赖于站在特定z位置的人;我将再解释一下:

I've been playing with Kinect for a few days, with the goal of detecting a hand when it's open and closed. I have a solution right now, which seems to work, but it relies on the person standing in a specific z-location; I'll explain a bit more:

我采样了我要检测的手周围的深度图像区域;然后我通过一定的灰度值对图像进行阈值处理,以便只显示场景中超出一定距离的元素。从这里开始,我测试图像的像素
,直到我在手上画了一个方框。然后,我根据一些常数对每一帧进行测试,以确定手是打开还是关闭。

I sample an area of the depth image that's around the hand I want to detect; then I threshold that image by a certain grey-scale value, so that only elements in the scene that are beyond a certain distance will be shown. From here, I test the pixels of the image until I've drawn a box around the hand. I then test this every frame against some constants, to decide whether the hand is open or closed.

这有效,但正如我所说,它要求此人站在特定的位置。即使这样,如果他们把手移得太远,它也会断裂。

This works, but as I say, it requires the person to be standing in a specific spot. Even then, if they move their hand too far back, it breaks.

我一直在考虑如何避免这种情况,并解决它以便这个人可以站在任何地方,但是我不确定该去哪里。我尝试将图像分色,从2到15级灰度,但不幸的是,灰色阴影似乎是
彼此太靠近,所以手最终被着色的颜色与例如身体相同。 

I've been thinking about how to avoid this, and solve it so that the person can be standing anywhere, but I'm not really sure where to go with it. I tried posterizing the image, anywhere from 2 to 15 levels of grey, but unfortunately the grey-shades seem to be too close to each other, so the hand ends up being coloured the same as, for example, the body. 

我还想知道是否可以将骨架的深度位置映射到场景中出现的灰色阴影。然后,我可以在任何给定的时间从一个比身体灰色更深的灰色开始阈值,并且它只显示手。 

I also wondered if it'd be possible to map the depth position of the skeleton to the grey-shades that appear in the scene. Then I could threshold from a grey that was just darker than the body's grey, at any given time, and it'd reveal the hand only. 

但我不知道如何去做这些事情,甚至不确定它们是否有用。有没有人有什么建议?我应该说,我使用的是AIR Kinect库,而不是官方的Microsoft SDK,但我认为这不会对任何理论解决方案产生太大的影响

But I'm not sure how to go about these things, and not even sure if they would work. Does anyone have any suggestions? I should say, I'm using the AIR Kinect libraries, not the official Microsoft SDK, but I don't suppose this should make too much difference to any theoretical solutions.

谢谢!

推荐答案

嗨。你的问题很容易解决=)

Hi. Your problem is easy to solve =)

第一步(不确定我们是否在同一页面上)是隔离只包含手的深度图部分。这可以通过使用z值(来自骨架数据),乘以1000(从米到毫米),然后删除
深度图中其值偏离超过阈值的所有像素从你的手深度(+ / 100对我来说效果很好,这意味着,+ / - 10厘米)。

The first step (not sure if we are on the same page here) is to isolate that part of the depth map that contains only the hand. This you can do by using the z-value (from skeleton data), multiply by 1000 (to get from meters to millimeters), and then delete all the pixels in the depth map whose value deviates by more than a threshold from your hand depth (+/100 has worked well for me, which means, +/- 10 cm).

然后,我相信你正在做的是看看有多大手像素区域。打开的手比关闭的手消耗更多的区域(拳头)。但是,您需要考虑深度图中手的外观根据距离改变
。更远的用户的手会显得更小。

Then, I believe what you're doing is to see how large the hand-pixel area is. A hand that is open consumes more area than a hand that is closed (fist). However, you need to take into consideration that the appearance of the hand in the depth map changes depending on the distance. The hand of a user who is further away will appear smaller.

您仍然可以通过手动测量一定距离的像素数/区域数来解决问题,最佳选择是1.0米。然后,您可以使用比例规则,以防用户处于任何不同的距离。例如。如果您确定边界框的
高度(对于640x480深度图)对于张开的手是90像素,如果用户距离是1.0米,如果它是关闭则为50像素。您的门槛值介于两者之间,例如: 70像素x。然后在你的代码中,你会做类似的事情:

You can still solve the problem by manually measuring the number of pixels / area for a certain distance, the best choice is 1.0 meters. Then you can use the rule of proportion in case the user is at any different distance. E.g. if you determined that the height of the bounding box (for the 640x480 depth map) is 90 pixels for an open hand, if the user is 1.0m away, and 50 pixels if it is closed. Your threshold would be something inbetween, e.g. 70 pixelx. Then in your code, you would do something like:

openHandThreshold = 70 / handPosition.z;

openHandThreshold = 70 / handPosition.z;

然后你测试边界的高度违反该门槛的方框。注意"handPosition.z"。是骨架的距离,以米为单位。

and then you test the height of the bounding box against that threshold. Note that "handPosition.z" is the distance from the skeleton, in meters.


这篇关于隔离在深度图象的手的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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