VisionPro相机操作学习

private string path = AppDomain.CurrentDomain.BaseDirectory + “12.vpp”;
private string path1 = AppDomain.CurrentDomain.BaseDirectory + “CCD.vpp”;
private string path2 = AppDomain.CurrentDomain.BaseDirectory + “Tool.vpp”;
private CogToolBlock tb;
private CogToolBlock tb1;
private CogAcqFifoTool acq;
private CogAcqFifoTool acq1;
public Form1()
{
InitializeComponent();
//序列化CogFifoTool 工具
tb = CogSerializer.LoadObjectFromFile(path) as CogToolBlock;
//加载到CogToolBlockEdit控件中
cogToolBlockEditV21.Subject = tb;
// 转换成取像
acq = tb.Tools[0] as CogAcqFifoTool;

}

private void button1_Click(object sender, EventArgs e)
{
acq.Run();
cogRecordDisplay1.Image = acq.OutputImage;
cogRecordDisplay1.Fit();
}

private void button2_Click(object sender, EventArgs e)
{
//初始化相机工具
acq1 = CogSerializer.LoadObjectFromFile(path1) as CogAcqFifoTool;
acq1.Run();
cogRecordDisplay1.Image = acq1.OutputImage;
cogRecordDisplay1.Fit();
}

private void btnLive_Click(object sender, EventArgs e)
{
//相机实时状态
if (cogRecordDisplay1.LiveDisplayRunning)
{

cogRecordDisplay1.StopLiveDisplay();
btnLive.BackColor = Color.Gray;
}
else
{
cogRecordDisplay1.StartLiveDisplay(acq.Operator, true);
btnLive.BackColor = Color.Green;
}
// cogRecordDisplay1.StartLiveDisplay(acq.Operator);
}

private void btnStop_Click(object sender, EventArgs e)
{
//关闭实时状态
cogRecordDisplay1.StopLiveDisplay();
}

private void button3_Click(object sender, EventArgs e)
{
acq.Run();
tb1.Inputs[“InputImage”].Value = acq.OutputImage;
tb1.Run();
cogRecordDisplay1.Record = tb1.CreateLastRunRecord().SubRecords[1];

//显示运行记录
//cogRecordDisplay1.Image = acq.OutputImage;
//cogRecordDisplay1.Record = tb1.CreateLastRunRecord();
}

private void Form1_Load(object sender, EventArgs e)
{
tb1 = CogSerializer.LoadObjectFromFile(path2) as CogToolBlock;
cogToolBlockEditV22.Subject = tb1;
}
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值