none
Using GetProjectedShape in C++ RRS feed

  • Question

  • Hi all,

    Does anyone have a working example of calling GetProjectedShape() in C++?

    I am interested in obtaining the full 121 tracked points (instead of the 100 that the IFTResult offers), but GetProjectedShape takes too many parameters that I cannot find information about.

    Also, if there is another way to obtain said (2D) points, I would be happy to know about it.

    Thank you,
    -k


    Wednesday, November 28, 2012 1:31 AM

Answers

  • For what is worth, here is the way to do it:

    	res->Get3DPose(&faceScale, faceRot, facePos);		
    	res->Get2DShapePoints(&facePoints, &facePointCount);
    	res->GetAUCoefficients(&animUnits, &animUnitCount);	
    
    	// trying to get the 121 points starts here ****
    	IFTModel* ftModel;
    	faceTracker->GetFaceModel(&ftModel);
    
    	FT_CAMERA_CONFIG videoCameraConfig, depthCameraConfig; 
    	
    	videoCameraConfig.Height = 640;
    	videoCameraConfig.Width = 480;
    	videoCameraConfig.FocalLength = NUI_CAMERA_COLOR_NOMINAL_FOCAL_LENGTH_IN_PIXELS;
    
    	depthCameraConfig.Height = 320;
    	depthCameraConfig.Width = 240;
    	depthCameraConfig.FocalLength = NUI_CAMERA_DEPTH_NOMINAL_FOCAL_LENGTH_IN_PIXELS;
    
    	HRESULT hr;
    
    	FLOAT *shapeUnitCoefficients;
    	UINT shapeUnitCount;
    	BOOL converged;
    
    	hr = faceTracker->GetShapeUnits(&faceScale, &shapeUnitCoefficients, &shapeUnitCount, &converged);	
    
    	UINT vertexCount = ftModel->GetVertexCount();
    	FT_VECTOR2D* pts2D = reinterpret_cast<FT_VECTOR2D*>(_malloca(sizeof(FT_VECTOR2D) * vertexCount));
    
    
    	float zoomFactor = 1.0f;
    	hr = ftModel->GetProjectedShape(&videoCameraConfig, zoomFactor, POINT(), shapeUnitCoefficients, ftModel->GetSUCount(), animUnits, animUnitCount, faceScale, faceRot, facePos, pts2D, vertexCount);
    
    	if (FAILED(hr)) {
    		cout << "ERROR: could not get the 121 projected points (FaceTrackerManager)" << endl;
    	} else {		
    		// success
    	
    
    	}
    

    -k

    • Marked as answer by krahd Wednesday, November 28, 2012 2:05 AM
    Wednesday, November 28, 2012 2:05 AM