Basically, you need to capture the image from ColorStream and convert it to the EmguCV Image class:
Convert to EmguCV image from Windows BitMap (Kinect ColorStream):
You have a Windows Bitmap variable where the Kinect Frame is stored.
Bitmap bmap = new Bitmap(weightFrame,HeightFrame,System.Drawing.Imaging.PixelFormat.Format32bppRgb); ...
Make a discovery:
Change of size
currentFrame = frameActualKinect.Resize(320, 240, Emgu.CV.CvEnum.INTER.CV_INTER_CUBIC); //Convert it to Grayscale gray = currentFrame.Convert<Gray, Byte>(); //Face Detector MCvAvgComp[][] facesDetected = gray.DetectHaarCascade(face, 1.2, 10, Emgu.CV.CvEnum.HAAR_DETECTION_TYPE.DO_CANNY_PRUNING,new System.Drawing.Size(20, 20));
PD (Helper Method):
public static Image<TColor, TDepth> ToOpenCVImage<TColor, TDepth>(this Bitmap bitmap) where TColor : struct, IColor where TDepth : new() { return new Image<TColor, TDepth>(bitmap); }
source share