本文介绍了通过计算机视觉的鲁棒手检测的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在开发一个可靠的手部检测系统。

I am currently working on a system for robust hand detection.

第一步是用手拍摄手部照片放置在一个小矩形以确定肤色。然后我应用阈值滤波器将所有非皮肤像素设置为黑色,将所有皮肤像素设置为白色。

The first step is to take a photo of the hand (in HSV color space) with the hand placed in a small rectangle to determine the skin color. I then apply a thresholding filter to set all non-skin pixels to black and all skin pixels white.

到目前为止,它工作得很好,但我想问,是否有更好的方法来解决这个问题?例如,我发现一些论文提到了白人人的具体颜色空间,但没有一个比较亚洲/非洲/高加索色调。

So far it works quite well, but I wanted to ask if there is a better way to solve this? For example, I found a few papers mentioning concrete color spaces for caucasian people, but none with a comparison for asian/african/caucasian color-tones.

顺便说一句,我正在使用OpenCV通过Python绑定。

By the way, I'm working with OpenCV via Python bindings.

推荐答案

你看看Gary Bradski的camshift纸吗?您可以从

Have you taken a look at the camshift paper by Gary Bradski? You can download it from here

我一年前使用皮肤检测算法来检测手部跟踪的皮肤区域,它是健壮的。

I used the the skin detection algorithm a year ago for detecting skin regions for hand tracking and it is robust. It depends on how you use it.

使用颜色跟踪的第一个问题是,它对于照明变化或像你提到的那样不稳定,当人们有不同的皮肤音调。然而,这可以很容易地解决,如文中所述:

The first problem with using color for tracking is that it is not robust to lighting variations or like you mentioned, when people have different skin tones. However this can be solved easily as mentioned in the paper by:


  1. 将图像转换为HSV颜色空间。

  2. 丢弃V通道,考虑H和S通道,因此照明变化可以获得
    的折扣。

  3. 阈值像素由于不稳定而具有低饱和度。

  4. 将所选的皮肤区域合并为二维直方图。 (OpenCV的
    函数)此

  5. 计算反投影(即使用直方图计算概率
    ,即图像中的每个像素都具有颜色肤色),使用。皮肤
    区域将

  6. 然后,您可以使用查找由backproject生成的2D
    概率映射的模式,或者检测
    高概率的blob。

  1. Convert image to HSV color space.
  2. Throw away the V channel and consider the H and S channel and hencediscount for lighting variations.
  3. Threshold pixels with low saturation due to their instability.
  4. Bin the selected skin region into a 2D histogram. (OpenCV"s calcHistfunction) This histogram now acts as a model for skin.
  5. Compute the "backprojection" (i.e. use the histogram to compute the "probability"that each pixel in your image has the color of skin tone) using calcBackProject. Skinregions will have high values.
  6. You can then either use meanShift to look for the mode of the 2D"probability" map generated by backproject or to detect blobs ofhigh "probability".

抛弃HSV中的V通道,只考虑H和S通道,足以(令人惊讶地)检测不同的肤色并在不同的光照变化下。一个好处是它的计算速度快。

Throwing away the V channel in HSV and only considering H and S channels is really enough (surprisingly) to detect different skin tones and under different lighting variations. A plus side is that its computation is fast.

这些步骤和相应的代码可以在原始的。

These steps and the corresponding code can be found in the original OpenCV book.

另外,我还使用了高斯混合模型(GMM)。如果你只考虑颜色,我会说使用直方图或GMM没有太大的区别。事实上,直方图将表现更好(如果你的GMM不是为了解决照明变化等)。 GMM是好的,如果你的样本向量更复杂(即你考虑其他功能),但速度直方图要快得多,因为使用直方图计算概率图本质上是一个表查找,而GMM需要执行矩阵计算(对于维度>

As a side note, I've also used Gaussian Mixture Models (GMM) before. If you are only considering color then I would say using histograms or GMM makes not much difference. In fact the histogram would perform better (if your GMM is not constructed to account for lighting variations etc.). GMM is good if your sample vectors are more sophisticated (i.e. you consider other features) but speed-wise histogram is much faster because computing the probability map using histogram is essentially a table lookup whereas GMM requires performing a matrix computation (for vector with dimension > 1 in the formula for multi-dimension gaussian distribution) which can be time consuming for real time applications.

因此,总而言之,如果你只是试图检测皮肤区域使用颜色,然后使用直方图方法。你可以调整它考虑局部梯度(即梯度直方图,但可能不会达到Dalal和Trigg的人类检测算法的全部程度),以便它可以区分皮肤和类似颜色的区域(例如纸板或木制家具)使用局部纹理信息。但是这将需要更多的努力。

So in conclusion, if you are only trying to detect skin regions using color, then go with the histogram method. You can adapt it to consider local gradient as well (i.e. histogram of gradients but possibly not going to the full extent of Dalal and Trigg's human detection algo.) so that it can differentiate between skin and regions with similar color (e.g. cardboard or wooden furniture) using the local texture information. But that would require more effort.

有关如何使用直方图进行皮肤检测的示例源代码,您可以看一下OpenCV的页面,但请注意,在该网页上提到他们只使用色调通道和使用色调和饱和度将产生更好的结果。

For sample source code on how to use histogram for skin detection, you can take a look at OpenCV"s page here. But do note that it is mentioned on that webpage that they only use the hue channel and that using both hue and saturation would give better result.

对于更复杂的方法,你可以看看关于检测裸体人的工作Margaret Fleck和David Forsyth,这是早期关于检测皮肤区域的工作之一,它考虑了颜色和纹理,详细信息可以在。

For a more sophisticated approach, you can take a look at the work on "Detecting naked people" by Margaret Fleck and David Forsyth. This was one of the earlier work on detecting skin regions that considers both color and texture. The details can be found here.

与计算机视觉和图像处理相关的源代码的一个很好的资源,其中包括视觉跟踪代码找到。而不是它的OpenCV。

A great resource for source code related to computer vision and image processing, which happens to include code for visual tracking can be found here. And not, its not OpenCV.

希望这有助于。

这篇关于通过计算机视觉的鲁棒手检测的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 14:53