用CDC相机和采集卡抓取图像 点击:532 | 回复:1



工控老顽童

    
  • 精华:0帖
  • 求助:0帖
  • 帖子:5帖 | 10回
  • 年度积分:0
  • 历史总积分:27
  • 注册:2004年7月26日
发表于:2015-10-31 12:21:28
楼主

VisionPro编程笔记(1):用CDC相机和采集卡抓取图像

Add a reference to Cognex.VisionPro and Cognex.VisionPro.Core to your Visual Studio.NET application.

Add a using directive for Cognex.VisionPro.

Create an object reference to an MVS-8100D frame grabber on your system.

Locate a camera on the CogLink bus.

Select a video format for the camera connected to the frame grabber.

Create an acquisition FIFO using the video format and frame grabber information.

Select a CDC Camera shutter mode .

Continue acquiring as with a CCD camera.

用8100D采集图像C#实例:

// Create a tool
CogAcqFifoTool myAcqTool = new CogAcqFifoTool();

if (myAcqTool == null)
    throw new CogAcqCannotCreateFifoException("Unable to create Acquisition Fifo");

CogFrameGrabbers frameGrabberList = new CogFrameGrabbers();
ICogLinkChannels mLinkChan = null;
CogLinkCameras LinkCams;
bool found = false;

if (frameGrabberList.Count > 0)
{
    foreach (ICogFrameGrabber fg in frameGrabberList)
    {
        if (fg.Name.IndexOf("8100D") != -1)
        {
            mLinkChan = fg.OwnedCogLinkChannels;
            if (mLinkChan.NumCogLinkChannels > 0)
            {
                LinkCams = mLinkChan.GetCogLinkCameras(true);
                // Create an acquisition FIFO (ICogAcqFifo) and assign it to the tool.
                // The first channel must be free to create an acquisition FIFO.
                // CDC-100 has two video formats, however, we are going to
                // select the first one.
              if (LinkCams.Count > 0)
                    myAcqTool.Operator = LinkCams[0].CreateAcqFifo(LinkCams[0].AvailableVideoFormats[0],
                          CogAcqFifoPixelFormatConstants.Format8Grey,true);
                if (myAcqTool.Operator == null)
                    throw new CogAcqCannotCreateFifoException("Unable to create Acquisition Fifo.");
                found = true;

            }
        }
    }
}

 




wayaj

  • 精华:30帖
  • 求助:95帖
  • 帖子:5269帖 | 8770回
  • 年度积分:0
  • 历史总积分:28783
  • 注册:2020年5月25日
发表于:2015-10-31 16:45:08
1楼

看不懂的程序??????


热门招聘
相关主题

官方公众号

智造工程师