Ejemplo n.º 1
0
        private static Mat BitmapToMat(Bitmap bitmap)
        {
            BitmapData bmData = bitmap.LockBits(new Rectangle(0, 0, bitmap.Width, bitmap.Height),
                                                ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb);
            var tmp = new IplImage(new OpenCV.Net.Size(bitmap.Width, bitmap.Height), IplDepth.U8, 3, bmData.Scan0);

            bitmap.UnlockBits(bmData);

            return(tmp.GetMat());
        }
        private static Mat BitmapToMat(Bitmap bitmap)
        {
            BitmapData bmData = bitmap.LockBits(new Rectangle(0, 0, bitmap.Width, bitmap.Height),
                    ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb);
            var tmp = new IplImage(new OpenCV.Net.Size(bitmap.Width, bitmap.Height), IplDepth.U8, 3, bmData.Scan0);
            bitmap.UnlockBits(bmData);

            return tmp.GetMat();
        }