static public IntelImage CreateIntelImageFromBitmap(System.Drawing.Bitmap bm) { var intelImage = new IntelImage(bm.Width, bm.Height, bm.PixelFormat != System.Drawing.Imaging.PixelFormat.Format8bppIndexed); byte[] pixelBuffer = new byte[bm.Height * intelImage.Stride]; CopyPixelsFromBitmap(bm, pixelBuffer); intelImage.CopyPixels(pixelBuffer); return(intelImage); }
static public IntelImage CreateIntelImageFromBitmapSource(BitmapSource bitmapSource) { var intelImage = new IntelImage(bitmapSource.PixelWidth, bitmapSource.PixelHeight, bitmapSource.Format != PixelFormats.Gray8); // int stride = bitmapSource.PixelWidth * ((bitmapSource.Format.BitsPerPixel + 7) / 8); byte[] pixelBuffer = new byte[bitmapSource.PixelHeight * intelImage.Stride]; bitmapSource.CopyPixels(pixelBuffer, intelImage.Stride, 0); intelImage.CopyPixels(pixelBuffer); return(intelImage); }