C#显示相机实时画面
标签:设备 tar 序列 bsp form VID eve rgs new
public partial class Form1 : Form
{
ICogAcqFifo mAcqFifo2;//定义一个相机对象
private ICogFrameGrabber mFrameGrabber = null;//
List videoFormat = new List ();//相机信息列表
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 )
{
mFrameGrabber = mframe[i];
MessageBox.Show(mFrameGrabber.Name + mFrameGrabber.SerialNumber + mFrameGrabber.AvailableVideoFormats[0]);
videoFormat.Add(mFrameGrabber.Name + mFrameGrabber.SerialNumber+mFrameGrabber.AvailableVideoFormats[0]);
}
}
}
C#显示相机实时画面
标签:设备 tar 序列 bsp form VID eve rgs new
原文地址:https://www.cnblogs.com/Hooper_he/p/9690965.html
评论