Acquiring an Image From a Line Scan CameraCognex VisionPro

This topic describes how to create a Visual Studio.NET application that acquires an image from a line scan camera using a Cognex Acquisition FIFO control, and displays the image using the Cognex Display control. By using the Acquisition FIFO control, you can change parameters and observe their affect using the GUI.

Most of the steps you use to set up a line scan acquisition are the same as those for setting up an acquisition from an area scan camera as described in Acquiring Images with a CCD Camera and Frame Grabber. This example also uses semi-automatic triggers. Your application may have different trigger requirements.

The Cognex MVS-8600 frame grabbers support line scan cameras.

Note: VisionPro supports nonlinear calibration of images from linescan cameras.

VisionPro Line Scan Acquisition Process

To acquire line scan images using VisionPro, you must perform the following steps:

  1. Create an object reference to a frame grabber on your system.
  2. Select a video format for the camera connected to the frame grabber.
  3. Create an acquisition FIFO using the video format and frame grabber information.
  4. Start the acquisition by invoking the frame grabber object's Acquire or StartAcquire method.
  5. Complete the acquisition, if necessary, and get a CogImage8Grey object that represents the acquired image.
Get a Frame Grabber Object

Before your application can acquire an image, you must specify what kind of frame grabber your system uses to digitize images. VisionPro defines a collection class, CogFrameGrabbers, that represents the frame grabbers installed on your system. The following statements create a collection of frame grabbers. It then declares an object variable that is set to the default frame grabber.

private CogFrameGrabbers myFrameGrabbers;
myFrameGrabbers = new CogFrameGrabbers();

private ICogFrameGrabber myFrameGrabber;
myFrameGrabber = myFrameGrabbers[0];

Use this frame grabber object in conjunction with a video format to create an acquisition FIFO.

Select a Video Format

Next you must select a video format, which describes the camera connected to your frame grabber and the size of the image to acquire. The video format is specified as a string, and must be one of those returned by the FrameGrabber object's AvailableVideoFormats method. This example code declares a video format:

const string VIDEO_FORMAT = "Basler L103 2048x2048";
Create an Acquisition FIFO

To create a new acquisition FIFO using VisionPro, you use the FrameGrabber object's CreateAcqFifo method, passing in the video format you have selected and an CogAcqFifoPixelFormatConstants. The following code creates an acquisition FIFO suitable for acquiring grey-scale line scan images that are 2048 pixels wide by 2048 pixels high with a Basler L103 camera.

private ICogAcqFifo myAcqFifo;
myAcqFifo = myFrameGrabber.CreateAcqFifo(VIDEO_FORMAT, Cognex.VisionPro.CogAcqFifoPixelFormatConstants.Format8Grey, 0, false);

Once you have created an acquisition FIFO, you can modify its properties (such as brightness and contrast). You can change acquisition FIFO properties at any time.

Create an Acquisition FIFO Tool

To create a new acquisition FIFO tool using VisionPro, you create an AcqFifoTool object and associate it with an AcqFifo edit control. You then set up the trigger and steps per line for the tool.

private CogAcqFifoTool myAcqFifoTool();
if (myAcqTool == null) 
        throw new CogAcqCannotCreateFifoException("Unable to create Acquisition Fifo");
myAcqFifoTool.Operator = myAcqFifo;
Acquire and Display an Image

Acquire an image and display it using a Cognex Display control:

AcqFifo.StartAcquire
Set CogDisplay1.image = AcqFifo.CompleteAcquire(-1)
Sample Application

The VisionPro Samples directory contains a sample LineScan application.