Kinect人脸跟踪getStatus()

时间:2013-11-18 18:54:50

标签: c++ kinect

我正在开发一个面部跟踪程序,但我的getStatus()调用返回0xcccccccc,我认为这是未初始化的数据?下面是一些代码。我可以在屏幕上显示彩色图像,这样我就可以获得数据了。任何人都可以给我任何指示吗?

  IFTResult* fTrackingResult = NULL;

    bool initialseFaceTracker() {
tracker = FTCreateFaceTracker();
if (!tracker) {
    return false;
}

FT_CAMERA_CONFIG colorConfig = {640, 480, NUI_CAMERA_COLOR_NOMINAL_FOCAL_LENGTH_IN_PIXELS};
FT_CAMERA_CONFIG depthConfig = {320, 240, NUI_CAMERA_DEPTH_NOMINAL_FOCAL_LENGTH_IN_PIXELS};

HRESULT hr = tracker->Initialize(&colorConfig, &depthConfig, NULL, NULL);
if ( FAILED(hr) ) {
    return false;
}

hr = tracker->CreateFTResult( &fTrackingResult );
if (FAILED(hr)) {
    return false;
}



IFTImage* colorFrame = FTCreateImage();
IFTImage* depthFrame = FTCreateImage();

if (!colorFrame || !depthFrame) {
    return false;
}


hr = colorFrame->Attach(640, 480, &colorImageData, FTIMAGEFORMAT_UINT8_R8G8B8, 640*4);

if (FAILED(hr)) {
    return false;
}

hr = depthFrame->Attach(320, 240, &depthData, FTIMAGEFORMAT_UINT16_D13P3, 320*2);
if (FAILED(hr)) {
    return false;
}

sensorData.pVideoFrame = colorFrame;
sensorData.pDepthFrame = depthFrame;

sensorData.ZoomFactor = 1.0f;
sensorData.ViewOffset.x = 0;
sensorData.ViewOffset.y = 0;

return true;
    }

    bool updateFaceTacking() {

if(!gotFaceTracking) {
    HRESULT hr = tracker->StartTracking(&sensorData, NULL, NULL, fTrackingResult);
    if (SUCCEEDED(hr)){ 
        HRESULT hr2 = fTrackingResult -> GetStatus();
        if (SUCCEEDED(hr2)) {
            gotFaceTracking = true;
        }
    }
} else {
    HRESULT hr = tracker->ContinueTracking(&sensorData, NULL, fTrackingResult);
    if( FAILED(fTrackingResult->GetStatus())) 
        gotFaceTracking = false;
    } 


return true;
    }

1 个答案:

答案 0 :(得分:0)

您必须在调试文件夹中放置facetracker.lib和其中一个示例附带的.dlls。如果有帮助,请告诉我