I am currently trying to save not only the skeletal data, but also the color frame images for post processing reasons. Currently, this is the section of the code that handles the color video, and outputs a color image in the UI. I figure, this is where the saving of the color frame images has to take place.
private void ColorFrameEvent(ColorImageFrameReadyEventArgs colorImageFrame)
{
//Get raw image
using (ColorImageFrame colorVideoFrame = colorImageFrame.OpenColorImageFrame())
{
if (colorVideoFrame != null)
{
//Create array for pixel data and copy it from the image frame
Byte[] pixelData = new Byte[colorVideoFrame.PixelDataLength];
colorVideoFrame.CopyPixelDataTo(pixelData);
//Set alpha to 255
for (int i = 3; i < pixelData.Length; i += 4)
{
pixelData[i] = (byte)255;
}
using (colorImage.GetBitmapContext())
{
colorImage.FromByteArray(pixelData);
}
}
}
}
I have tried reading up on OpenCV, EmguCV, and multithreading; but I am pretty confused. It would be nice to have a solid good explanation in one location. However, I feel like the best way to do this without losing frames per second, would be to save all the images in a List of arrays perhaps, and then when the program finishes do some post processing to convert arrays->images->video in Matlab.
Can someone comment on how I would go about implementing saving the color image stream into a file?