private unsafe Rectangle[] DetectFaces(Bitmap frame) { BitmapData data = frame.LockBits(new Rectangle(Point.Empty, frame.Size), ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb); try { return(nat.detectFaces(data.Scan0.ToPointer(), data.Width, data.Height, data.Stride)); } finally { frame.UnlockBits(data); } }