当前位置:
首页 >
C#显示相机实时画面
发布时间:2025/7/25
112
豆豆
生活随笔
收集整理的这篇文章主要介绍了
C#显示相机实时画面
小编觉得挺不错的,现在分享给大家,帮大家做个参考.
public partial class Form1 : Form{ICogAcqFifo mAcqFifo2;//定义一个相机对象private ICogFrameGrabber mFrameGrabber = null;//
List<String> videoFormat = new List<String> ();//相机信息列表public Form1 (){InitializeComponent ();}
private void button1_Click ( object sender, EventArgs e ){MessageBox.Show ( videoFormat.Count.ToString () );//已连接相机数量
}private void button2_Click ( object sender, EventArgs e ){CogFrameGrabberGigEs mfr2 = new CogFrameGrabberGigEs ();//取得相机列表ICogFrameGrabber gbm2 = mfr2[0];//取第一个相机,第二个相机依次增加mAcqFifo2 = gbm2.CreateAcqFifo ( gbm2.AvailableVideoFormats[0],CogAcqFifoPixelFormatConstants.Format8Grey, 0, true );//初始化相机cogRecordDisplay1.StartLiveDisplay ( mAcqFifo2, false );//控件绑定相机并显示画面
}private void Form1_Load ( object sender, EventArgs e ){CogFrameGrabberGigEs mframe = new CogFrameGrabberGigEs();if (mframe.Count < 1){MessageBox.Show("没有找到相机设备!");}
//遍历已连接相机信息,并添加进列表里(相机名,序列号,模式)
for (int i = 0; i < mframe.Count; i++){mFrameGrabber = mframe[i];MessageBox.Show(mFrameGrabber.Name + mFrameGrabber.SerialNumber + mFrameGrabber.AvailableVideoFormats[0]);videoFormat.Add(mFrameGrabber.Name + mFrameGrabber.SerialNumber+mFrameGrabber.AvailableVideoFormats[0]);} }}
转载于:https://www.cnblogs.com/Hooper_he/p/9690965.html
总结
以上是生活随笔为你收集整理的C#显示相机实时画面的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: 软工实践第三次作业-原型设计
- 下一篇: C# List分页