从网络摄像头到图片框获取帧

时间:2014-05-20 03:31:55

标签: wpf winforms zxing aforge

据我了解,

void processor_NewTargetPosition(System.Drawing.Bitmap image)
        {
            IntPtr hBitMap = image.GetHbitmap();
            BitmapSource bmaps = Imaging.CreateBitmapSourceFromHBitmap(hBitMap, IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
            bmaps.Freeze();

            Dispatcher.Invoke((Action)(() =>
            {
                pictureBoxMain.Source = bmaps;
            }), DispatcherPriority.Render, null);



        }

这些代码用于将每个帧从网络摄像头放到图片框中。 此代码在WPF中运行良好。我试图转换它以窗口形式使用,但没有运气,因为我找不到这些线的替代品:

BitmapSource bmaps = Imaging.CreateBitmapSourceFromHBitmap(hBitMap, IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());

            Dispatcher.Invoke((Action)(() =>
            {
                pictureBoxMain.Source = bmaps;
            }), DispatcherPriority.Render, null);

有什么建议吗?谢谢。

0 个答案:

没有答案