资源简介
VisionPro ToolBlock的C#编程运用方法,但不含VPP文件
代码片段和文件信息
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 Cognex.VisionPro;
using Cognex.VisionPro.QuickBuild;
using Cognex.VisionPro.ImageFile;
using Cognex.VisionPro.ToolBlock;
using Cognex.VisionPro.Blob;
using Cognex.VisionPro.OCRMax;
using Cognex.VisionPro.CalibFix;
using Cognex.VisionPro.PMAlign;
namespace OCR1
{
public partial class Form1 : Form
{
CogImageFileTool mImageTool;
string filename=“OCR0.bmp“;
int i=0;
int to pa fa;
public int TabControlValue
{
get
{ return tabControl1.SelectedIndex; }
set
{tabControl1.SelectedIndex = value; }
}
public Form1()
{
InitializeComponent();
cogToolBlockEditV21.LocalDisplayVisible = false;
mImageTool = new CogImageFileTool();
mImageTool.Operator.Open(filename CogImageFileModeConstants.Read);
cogToolBlockEditV21.Subject = CogSerializer.LoadobjectFromFile(“ToolBlock.vpp“) as CogToolBlock;
cogToolBlockEditV21.Subject.Ran += new EventHandler(Subject_Ran);
cogToolBlockEditV21.SubjectChanged += new EventHandler(cogToolBlockEditV21_SubjectChanged);
this.timer2.Tick += new System.EventHandler(this.button2_Click);
}
void cogToolBlockEditV21_SubjectChanged(object sender EventArgs e)
{
// The application is meant to be used with the TB.vpp so whenever the user changes the TB
// We disable the run once button
button2.Enabled = false;
}
void Subject_Ran(object sender EventArgs e)
{
// Update the CogDisplayRecord with the image and the lastRunRecord
cogRecordDisplay1.Image = cogToolBlockEditV21.Subject.Inputs[“Input“].Value as CogImage8Grey;
//CogBlobTool mBlobTool = cogToolBlockEditV21.Subject.Tools[“CogBlobTool1“] as CogBlobTool;
//cogRecordDisplay1.Record = mBlobTool.CreateLastRunRecord();
//CogBlobTool mBlobTool = cogToolBlockEditV21.Subject.Tools[“CogFixtureTool1“] as CogBlobTool;
cogRecordDisplay1.Record = cogToolBlockEditV21.Subject.CreateLastRunRecord();//CogFixtureTool1.OutputImage
cogRecordDisplay1.Fit(true);
}
private void Form1_FormClosed(object sender FormClosedEventArgs e)
{
cogToolBlockEditV21.Subject.Ran -= new EventHandler(Subject_Ran);
cogToolBlockEditV21.SubjectChanged -= new EventHandler(cogToolBlockEditV21_SubjectChanged);
}
private void button2_Click(object sender EventArgs e)
{
String t1;
filename = “OCR“ + i.ToString() + “.bmp“;
mImageTool.Operator.Open(filename C
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 144 2014-04-02 16:19 OCR2\OCR1\app.config
文件 1 2014-04-02 16:34 OCR2\OCR1\ClassDiagram1.cd
文件 6039 2014-04-03 17:55 OCR2\OCR1\Form1.cs
文件 16789 2014-04-03 17:46 OCR2\OCR1\Form1.Designer.cs
文件 6907 2014-04-03 17:55 OCR2\OCR1\Form1.resx
文件 995 2014-04-03 18:05 OCR2\OCR1\Form2.cs
文件 3657 2014-04-03 17:46 OCR2\OCR1\Form2.Designer.cs
文件 5817 2014-04-03 17:46 OCR2\OCR1\Form2.resx
文件 116419 2014-04-03 08:31 OCR2\OCR1\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache
文件 13816 2014-04-03 18:01 OCR2\OCR1\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache
文件 236 2014-04-03 17:55 OCR2\OCR1\obj\x86\Debug\GenerateResource.read.1.tlog
文件 1020 2014-04-03 17:55 OCR2\OCR1\obj\x86\Debug\GenerateResource.write.1.tlog
文件 1151 2014-05-22 14:33 OCR2\OCR1\obj\x86\Debug\OCR1.csproj.FileListAbsolute.txt
文件 19968 2014-04-03 18:01 OCR2\OCR1\obj\x86\Debug\OCR1.exe
文件 729 2014-04-03 17:55 OCR2\OCR1\obj\x86\Debug\OCR1.Form1.resources
文件 180 2014-04-03 17:46 OCR2\OCR1\obj\x86\Debug\OCR1.Form2.resources
文件 36352 2014-04-03 18:01 OCR2\OCR1\obj\x86\Debug\OCR1.pdb
文件 180 2014-04-03 17:20 OCR2\OCR1\obj\x86\Debug\OCR1.Properties.Resources.resources
文件 518808 2014-04-03 09:17 OCR2\OCR1\obj\x86\Debug\ResolveAssemblyReference.cache
文件 4608 2014-04-02 16:19 OCR2\OCR1\obj\x86\Debug\TempPE\Properties.Resources.Designer.cs.dll
文件 27825 2014-04-03 17:20 OCR2\OCR1\OCR1.csproj
文件 227 2014-04-02 16:51 OCR2\OCR1\OCR1.csproj.user
文件 485 2014-04-02 16:18 OCR2\OCR1\Program.cs
文件 1348 2014-04-02 16:18 OCR2\OCR1\Properties\AssemblyInfo.cs
文件 2844 2014-04-02 16:19 OCR2\OCR1\Properties\Resources.Designer.cs
文件 5612 2014-04-02 16:18 OCR2\OCR1\Properties\Resources.resx
文件 1100 2014-04-02 16:19 OCR2\OCR1\Properties\Settings.Designer.cs
文件 249 2014-04-02 16:18 OCR2\OCR1\Properties\Settings.settings
文件 854 2014-04-02 16:18 OCR2\OCR1.sln
..A..H. 58880 2014-05-22 14:33 OCR2\OCR1.suo
............此处省略11个文件信息
- 上一篇:razor-converter
- 下一篇:WPF导入导出Excel
评论
共有 条评论