1. 加入image標籤
2. 加入參考: Emgu.CV, Emgu.CV.UI, Emgu.Util, System.Drawing
3. 加入 [DllImport("gdi32")]
private static extern int DeleteObject(IntPtr o);
public static BitmapSource ToBitmapSource(IImage image)
{ ... }
4. 加入 private void Window_Loaded(object sender, RoutedEventArgs e)
{
capture = new Capture();
this.Dispatcher.Hooks.DispatcherInactive += new EventHandler(Hooks_DispatcherInactive);
}
5. 加入事件方法
Image
{
if (frame != null)
{
webcam.Source = ToBitmapSource(frame);
}
}
6. 結果
7. 下載
沒有留言:
張貼留言