摄像头组件,支持novif和http协议

This commit is contained in:
zqm
2026-03-24 10:37:54 +08:00
parent ed54296f62
commit 484c357586
23 changed files with 1734 additions and 0 deletions

View File

@@ -0,0 +1,72 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Camera;
namespace Test
{
public partial class Form1 : Form
{
private Camera.Camera _camera;
public Form1()
{
InitializeComponent();
_camera = new Camera.Camera();
_camera.ImageCaptured += Camera_ImageCaptured;
}
private void Camera_ImageCaptured(object sender, ImageEventArgs e)
{
if (InvokeRequired)
{
Invoke(new Action<Image>(UpdatePictureBox), e.Image);
}
else
{
UpdatePictureBox(e.Image);
}
}
private void UpdatePictureBox(Image image)
{
if (pictureBox1.Image != null)
{
pictureBox1.Image.Dispose();
}
pictureBox1.Image = image;
}
private void button1_Click(object sender, EventArgs e)
{
if (button1.Text == "获取摄像头图像")
{
button1.Text = "停止获取";
_camera.Start();
}
else
{
button1.Text = "获取摄像头图像";
_camera.Stop();
}
}
private void button2_Click(object sender, EventArgs e)
{
Camera.Setting settingForm = new Camera.Setting();
settingForm.ShowDialog();
}
protected override void OnFormClosing(FormClosingEventArgs e)
{
_camera.Stop();
base.OnFormClosing(e);
}
}
}