C# 调用emguCV3.1播放网络rtsp视频

运用emguCV3.1,调用rtsp网络视频:

.cs:

using Emgu.CV;
using Emgu.CV.Structure;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace WpfApplication45
{
///


/// MainWindow.xaml 的交互逻辑
///

public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
Capture cam;
private void Button_Click(object sender, RoutedEventArgs e)
{
CvInvoke.UseOpenCL = false;
cam = new Capture("xxxx");   //这里是rtsp地址
cam.ImageGrabbed += Cam_ImageGrabbed;
cam.Start();
}
Mat frame = new Mat();
private void Cam_ImageGrabbed(object sender, EventArgs e)
{
cam.Retrieve(frame, 0);
pic.Image = frame.Bitmap;
}
}
}

xaml:

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApplication45"
mc:Ignorable="d"
xmlns:wfi ="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration"
xmlns:xx="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
Title="MainWindow" Height="350" Width="525">





转载于:https://www.cnblogs.com/huangbinC/p/7843908.html

你可能感兴趣的:(C# 调用emguCV3.1播放网络rtsp视频)