我已經使用AForge庫來製作這個小程序,它顯示了從網絡攝像頭到PictureBox的實時饋送。如何將IP攝像機流導入C#?
private FilterInfoCollection VideoCaptureDevices;
private VideoCaptureDevice FinalVideoDevice;
private void Form1_Load(object sender, EventArgs e)
{
VideoCaptureDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
try
{
foreach (FilterInfo VidCapDev in VideoCaptureDevices)
{
comboBox1.Items.Add(VidCapDev.Name);
comboBox1.SelectedIndex = 0;
}
FinalVideoDevice = new VideoCaptureDevice(VideoCaptureDevices[comboBox1.SelectedIndex].MonikerString);
FinalVideoDevice.NewFrame += new NewFrameEventHandler(FinalVideoDevice_NewFrame);
FinalVideoDevice.Start();
}
catch
{
MessageBox.Show("No camera found. Please connect your camera and click RESET.");
}
}
//////////////////////////////////////////////////////////////////////////////////////////
void FinalVideoDevice_NewFrame(object sender, NewFrameEventArgs e)
{
try
{
pictureBox1.Image = (Bitmap)e.Frame.Clone();
}
catch { }
}
但我還需要從IP攝像頭獲取流。任何想法什麼是最好的方式來獲得它?
+1的,因爲我在處理各種採集設備的商業軟件使用它 - 網絡攝像頭在他們之中。 –