In-Sight Vision 카메라 연동
In-Sight 비전 관련해서 자료정리
실행 시 참조 에러 발생했을때 봤던 메뉴얼
https://www.cognex.com/support/downloads/ns/215/217/225/In-Sight%20SDK%204%208%201%20Release%20Notes.pdf
샘플 프로젝트 만드는 방법을 간단히 적어놓은 글
http://stackoverflow.com/questions/32499960/c-sharp-extract-cell-information-from-in-sight-explorer-cognex
I am assuming you have already purchased and installed the In-Sight SDK. If not, please contact your local Cognex distributor.
Here's instructions for a very simple demo application:
- Start Visual Studio (I'm using Visual Studio 2012).
- Create a new Visual C# Windows Forms Application.
- Choose "Add Reference..." from the Project menu.
- Add the framework assembly reference 'Cognex.InSight'. Also consider adding 'Cognex.InSight.Controls.Display' if you want to display camera images (not covered here).
- Click the OK button to close the Reference Manager.
- Add 'Load' and 'FormClosed' event handlers for your main Form.
- Edit the code for the form.
- Add 'using Cognex.InSight;' and 'using Cognex.InSight.Cell;' to the top of the form code.
- Add a CsvInSight object to the form.
- Add code to your form similar to that shown below.
public partial class Form1 : Form
{
CvsInSight insight = new CvsInSight();
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
insight.Connect("127.0.0.1", "admin", "", false, false);
insight.ResultsChanged += insight_ResultsChanged;
}
void insight_ResultsChanged(object sender, EventArgs e)
{
// Here: Consider inserting code to check that this event
// has been triggered by an image acquisition
CvsResultSet results = insight.Results;
// Note the reference below to row 10, column 3 (cell D10)
CvsCell cell = results.Cells.GetCell(10, 3);
if (cell == null)
{
MessageBox.Show("Error: Cell D10 is null");
return;
}
if (cell.DataType != CvsCellDataType.FloatingPoint)
{
MessageBox.Show("Error: Unexpected data type at cell D10");
return;
}
CvsCellFloat floatCell = (CvsCellFloat)cell;
MessageBox.Show("Floating point value at cell D10 is: " + floatCell.Value.ToString());
}
private void Form1_FormClosed(object sender, FormClosedEventArgs e)
{
insight.Disconnect();
}
}