first of all sorry for my English
I´m using Microsoft's Kinect SDK with the face tracking API, and I´m getting the face rect with GetFaceRect
function. What I want to do now is to convert the video Buffer to an OpenCV Mat
and then remove everything but the face with OpenCV.
To convert from video frame to OpenCV mat I use this:
cv::Mat * openCVImg = new cv::Mat(cameraConfig.Height, cameraConfig.Width, CV_8UC4);
memcpy(openCVImg->data, m_KinectSensor.GetVideoBuffer()->GetBuffer(), m_KinectSensor.GetVideoBuffer()->GetBufferSize());
The problem is when I try to draw the face rect again, but this time with the OpenCV Mat
i got the rectangle displaced to the left and is not matching with my face.
I read that the image may come with a stride but with:
m_KinectSensor.GetVideoBuffer()->GetStride() / m_KinectSensor.GetVideoBuffer()->GetBytesPerPixel()
I got almost 640 wich is the width of the frame
Thanks! As Esteban previously suggested, instead of using memcpy
y copy byte per byte from IFTResult
to cv::Mat