【问题标题】:simple blob detection with kinect SDK使用 kinect SDK 进行简单的斑点检测
【发布时间】:2012-09-21 21:06:34
【问题描述】:

据我了解官方的 Kinect 1.5 SDK,它带有人脸跟踪和骨骼跟踪。简单的斑点检测怎么样?我想做的就是跟踪一个圆形/椭圆形的物体。我在 SDK 中找不到任何代码,所以我应该使用 opencv 或其他库吗?

(我的代码是c++)

EDIT1 是否可以调整面部跟踪器,使其能够检测一般的圆形(而不是面部)?

EDIT2 这是 SDK 附带的示例中的深度处理代码。如何让 OpenCV 从中提取 blob?

void CDepthBasics::ProcessDepth()
{
    HRESULT hr;
    NUI_IMAGE_FRAME imageFrame;

    // Attempt to get the depth frame
    hr = m_pNuiSensor->NuiImageStreamGetNextFrame(m_pDepthStreamHandle, 0, &imageFrame);
    if (FAILED(hr))
    {
        return;
    }

    INuiFrameTexture * pTexture = imageFrame.pFrameTexture;
    NUI_LOCKED_RECT LockedRect;

    // Lock the frame data so the Kinect knows not to modify it while we're reading it
    pTexture->LockRect(0, &LockedRect, NULL, 0);

    // Make sure we've received valid data
    if (LockedRect.Pitch != 0)
    {
        BYTE * rgbrun = m_depthRGBX;
        const USHORT * pBufferRun = (const USHORT *)LockedRect.pBits;

        // end pixel is start + width*height - 1
        const USHORT * pBufferEnd = pBufferRun + (cDepthWidth * cDepthHeight);

        while ( pBufferRun < pBufferEnd )
        {
            // discard the portion of the depth that contains only the player index
            USHORT depth = NuiDepthPixelToDepth(*pBufferRun);

            // to convert to a byte we're looking at only the lower 8 bits
            // by discarding the most significant rather than least significant data
            // we're preserving detail, although the intensity will "wrap"
            BYTE intensity = static_cast<BYTE>(depth % 256);

            // Write out blue byte
            *(rgbrun++) = intensity

            // Write out green byte
            *(rgbrun++) = intensity;

            // Write out red byte
            *(rgbrun++) = intensity;

            // We're outputting BGR, the last byte in the 32 bits is unused so skip it
            // If we were outputting BGRA, we would write alpha here.
            ++rgbrun;

            // Increment our index into the Kinect's depth buffer
            ++pBufferRun;

        }

        // Draw the data with Direct2D
        m_pDrawDepth->Draw(m_depthRGBX, cDepthWidth * cDepthHeight * cBytesPerPixel);
    }

    // We're done with the texture so unlock it
    pTexture->UnlockRect(0);

    // Release the frame
    m_pNuiSensor->NuiImageStreamReleaseFrame(m_pDepthStreamHandle, &imageFrame);
}

【问题讨论】:

    标签: c++ visual-c++ kinect


    【解决方案1】:

    从 Kinect 获得所需的图像后,您可以随意使用任何图像处理库来处理结果。

    您可以使用 OpenCV 的 Hough Circle Transform 来检测圆圈。您可能需要先将 Kinect 图像格式转换为 cv::Mat。

    我想 OpenCV 并不是唯一具有该功能的库。如果您有兴趣,请在一般情况下查找 Hough 变换。

    我不认为调整面部跟踪器是要走的路。

    【讨论】:

    • 谢谢。我添加了 SDK 附带的示例深度处理代码。我将如何更改代码,让 OpenCV 对其运行霍夫变换?
    • 就我个人而言,我没有过多地使用 Kinect SDK(因为它仅在 Windows 7 上运行),但简单的搜索应该会有所帮助。例如Dennis Ippel's blog post 或此wiki article from Carnegie Mellon University(尽管关注 Unity 集成之前的部分)。 HTH
    【解决方案2】:

    您可以使用它,因为遗憾的是 OpenCV 本身不支持处理 blob:

    http://opencv.willowgarage.com/wiki/cvBlobsLib

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-04-14
      • 1970-01-01
      • 2021-03-05
      • 2012-01-27
      • 2019-01-17
      相关资源
      最近更新 更多