VisionPro Programming Reference

ICogAcqFifo.CompleteAcquire Method

Completes the acquisition specified by the given ticket and returns the acquired image. If the ticket is omitted, or set to -1, the uncompleted acquire that was least recently started will be completed.

ICogImage CompleteAcquire(
Int32 requestedTicket,
out Int32& ticket,
out Int32& triggerNumber
);

Parameters

requestedTicket

The ticket of an outstanding acquisition. This is usually a value returned by StartAcquire. If this value is omitted or set to -1, the oldest outstanding acquisition is completed. requestedTicket must be -1 for automatically triggered acquisitions.

ticket

The actual ticket of the completed acquisition. When requestedTicket is not -1, this value is the same as requestedTicket.

triggerNumber

The trigger sequence number of the completed acquisition. You can compare this value with Trigger value returned by Acquire to see if there were missed triggers.

Return Value

The acquired image.

Remarks

Completes the acquisition specified by the given ticket and returns the acquired image. If ticket is omitted, or set to -1, the oldest outstanding acquisition will be completed.

Note If you are completing an automatically triggered acquisition (one for which StartAcquire was not called), then you must either omit the requestedTicket argument or supply a value of -1.

Under some conditions, the VisionPro acquisition system may fire a Complete event when there is no completed acquisition available. If you call CompleteAcquire when this happens, you will receive a timeout error, or possibly some other error. This happens primarily when you disable triggers and Flush the FIFO (to stop acquisitions), and the Complete event for the flushed image fires. To avoid this situation, be sure to call GetFifoState, to determine whether there really is an image pending.

CompleteAcquire can fire Complete, MovePart, and Overrun.

Exceptions

Exception Type Condition
CogAcqTimeoutException

Timeout period expired.

CogAcqBadTicketException

ticket is -1 and there is no outstanding StartAcquire, or if there is no StartAcquire for this ticket.

CogAcqOldTicketException

The image corresponding to ticket has already been collected.

CogAcqOverrunException

A trigger could not be serviced.

CogAcqAbnormalException

The acquisition failed because of a fault in the acquisition hardware or because of some other unusual problem.

CogAcqEncoderOverrunException

Encoder overrun.

CogAcqInvalidROIException

The region of interest is not valid.

CogAcqNoOutstandingStartsException

ticket was -1, but there were no outstanding StartAcquire requests

CogAcqOtherFifoErrorException

There was an error in another FIFO in the same master/slave group.

Example

          [C#]
using Cognex.VisionPro;

private CogFrameGrabbers myFrameGrabbers;
private ICogFrameGrabber myFrameGrabber;
private ICogAcqFifo myAcqFifo;

        private void AcquireDisplay () {
            const string VIDEO_FORMAT = "Sony XC75 640x480";
            int    acqTicket, completeTicket, triggerNumber, numPending, numReady;
            bool busy;

            myFrameGrabbers = new CogFrameGrabbers();
            myFrameGrabber = myFrameGrabbers[0];
            myAcqFifo = myFrameGrabber.CreateAcqFifo(VIDEO_FORMAT, Cognex.VisionPro.CogAcqFifoPixelFormatConstants.Format8Grey, 0, false);

            acqTicket = myAcqFifo.StartAcquire();

            do {
                myAcqFifo.GetFifoState(out numPending, out numReady, out busy);

                if (numReady > 0)
                    cogDisplay1.Image = myAcqFifo.CompleteAcquire(acqTicket, out completeTicket, out triggerNumber);
            } while (numReady <= 0);
        }
          [Visual Basic]
Imports Cognex.VisionPro

Private myFrameGrabbers As CogFrameGrabbers
Private myFrameGrabber As Cognex.VisionPro.ICogFrameGrabber
Private myAcqFifo As Cognex.VisionPro.ICogAcqFifo

Private Sub AcquireDisplay()
    Const VIDEO_FORMAT = "Sony XC75 640x480"
    Dim acqTicket As Integer
    Dim numPending As Integer : Dim numReady As Integer : Dim busy As Boolean
    Dim completeTicket As Integer : Dim triggerNum As Integer

    myFrameGrabbers = New CogFrameGrabbers
    myFrameGrabber = myFrameGrabbers.Item(0)
    myAcqFifo = myFrameGrabber.CreateAcqFifo(VIDEO_FORMAT, CogAcqFifoPixelFormatConstants.Format8Grey, 0, False)

    acqTicket = myAcqFifo.StartAcquire()
    Do
        myAcqFifo.GetFifoState(numPending, numReady, busy)
    Loop Until numReady > 0

    CogDisplay1.Image = myAcqFifo.CompleteAcquire(acqTicket, completeTicket, triggerNum)
End Sub

See Also

ICogAcqFifo Interface | Cognex.VisionPro Namespace