Changing Acquisition Tool PropertiesCognex VisionPro

An Acquisition tool can be created in Visual Studio.NET using either the tool-level API to create a CogAcqFifoTool object or the operator-level API to create an ICogAcqFifo object. See the topic Acquiring Images with a CCD Camera and Frame Grabber for more information on creating an Acquisition tool.

When you create a new Acquisition tool, VisionPro uses default values for many acquisition FIFO properties. For example, the default Brightness property for many acquisition FIFOs is .50, while the default value for the StrobeEnabled property is False.

The ICogAcqFifo interface stores all possible acquisition FIFO properties. The method for changing the value of any property varies based on whether you use a CogAcqFifoTool or an ICogAcqFifo variable.

Using a Tool-Level CogAcqFifoTool

A CogAcqFifoTool object uses the Operator property to set or get a property in its acquisition FIFO, as shown in the following C# statements:

using Cognex.VisionPro;
using Cognex.VisionPro.Exceptions;

private CogAcqFifoTool myAcqTool;
private ICogAcqBrightness brightnessParams;

private void InitializeAcqTool()
{
        // Create a tool
        myAcqTool = new CogAcqFifoTool();
        if (myAcqTool == null) 
                throw new CogAcqCannotCreateFifoException("Unable to create Acquisition Fifo");

        brightnessParams = myAcqTool.Operator.OwnedBrightnessParams;
        if (brightnessParams != null)
                brightnessParams.Brightness = .75;
}

private void button1_Click(object sender, System.EventArgs e)
{
        myAcqTool.Run();
        cogDisplay1.Image = myAcqTool.OutputImage;
}
Using an Operator-Level Acquisition FIFO

An ICogAcqFifo variable can access the properties in the acquisition FIFO directly, as shown in the following C# statements:

using Cognex.VisionPro;

private int tNum;
private CogFrameGrabbers myFrameGrabbers;
private ICogFrameGrabber myFrameGrabber;
private ICogAcqFifo myAcqFifo;
private ICogAcqBrightness brightnessParams;

private void InitializeFifo()
{
        const string VIDEO_FORMAT = "Sony XC75 640x480";

        myFrameGrabbers = new CogFrameGrabbers();
        myFrameGrabber = myFrameGrabbers[0];

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

        brightnessParams = myAcqFifo.OwnedBrightnessParams;
        if (brightnessParams != null)
                brightnessParams.Brightness = .75;
}

private void button1_Click(object sender, System.EventArgs e)
{
        cogDisplay1.Image = myAcqFifo.Acquire(out tNum);
}