VisionPro编程笔记(1):用CDC相机和采集卡抓取图像
来自:blog.sina.com.cn/yangchao168
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;
}
}
}
}