ICogAcqSample SampleX Property Cognex VisionPro 9.5
Get or set X sampling.

Namespace: Cognex.VisionPro
Assembly: Cognex.VisionPro.Core (in Cognex.VisionPro.Core.dll) Version: 69.0.0.0
Syntax

int SampleX { get; set; }

Property Value

Type: Int32
Events

Event TypeReason
ICogChangedEvent Changed

Fires when the value changes.

The following state flag may be affected:

Exceptions

ExceptionCondition
ArgumentException

The new value is < 0.

Remarks

Sets or gets x-sampling. You can use subsampling to reduce the image size and may result in faster acquisitions. Subsample values specify the ration of full-frame pixels to sampled pixels. For example, setting SampleX to 8 specifies an 8:1 reduction in the number of pixels along the x-axis.

If SampleValuesLocked is True, changing this value sets SampleY to the same value.

Default Value: 1, no subsampling

Examples

using Cognex.VisionPro;

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

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

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

    sampleParams = myAcqFifo.OwnedSampleParams;
    if (sampleParams != null)
        sampleParams.SampleX = 4;
        sampleParams.SampleY = 4;
}
Imports Cognex.VisionPro

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

Private Sub InitializeFifo()
    Const VIDEO_FORMAT = "Sony XC75 640x480"
    Dim sampleParams As Cognex.VisionPro.ICogAcqSample

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

    sampleParams = myAcqFifo.OwnedSampleParams

    If Not sampleParams Is Nothing Then
        sampleParams.SampleX = 4
        sampleParams.SampleY = 4
    End If
End Sub
See Also