개발/컴퓨터 관리

In-Sight Vision 카메라 연동

whatever , whoever 2018. 9. 12. 10:37
반응형

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:

  1. Start Visual Studio (I'm using Visual Studio 2012).
  2. Create a new Visual C# Windows Forms Application.
  3. Choose "Add Reference..." from the Project menu.
  4. Add the framework assembly reference 'Cognex.InSight'. Also consider adding 'Cognex.InSight.Controls.Display' if you want to display camera images (not covered here).
  5. Click the OK button to close the Reference Manager.
  6. Add 'Load' and 'FormClosed' event handlers for your main Form.
  7. Edit the code for the form.
  8. Add 'using Cognex.InSight;' and 'using Cognex.InSight.Cell;' to the top of the form code.
  9. Add a CsvInSight object to the form.
  10. 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();
    }
}

 


반응형