Table of Contents

Class GenICamCamera

Namespace
VisioForge.Core.GenICam
Assembly
VisioForge.Core.dll

Represents a GenICam-compliant camera device with high-level access to camera information, resolutions, pixel formats, and control features. This class provides a comprehensive wrapper around the Aravis library for industrial camera control.

Typical Usage Workflow:

  1. Create camera instance using VisioForge.Core.GenICam.GenICamCameraManager.GetCamera(System.String)
  2. Call VisioForge.Core.GenICam.GenICamCamera.Connect to establish connection
  3. Call VisioForge.Core.GenICam.GenICamCamera.ReadInfo to populate camera capabilities
  4. Configure camera settings (exposure, gain, ROI, etc.)
  5. Use VisioForge.Core.GenICam.GenICamCamera.StartStreaming for continuous capture or VisioForge.Core.GenICam.GenICamCamera.CaptureFrame(System.Int32) for single shots
  6. Handle VisioForge.Core.GenICam.GenICamCamera.FrameReceived events for frame processing
  7. Call VisioForge.Core.GenICam.GenICamCamera.StopStreaming and VisioForge.Core.GenICam.GenICamCamera.Disconnect when done

Thread Safety: This class is not thread-safe. Access should be synchronized when used from multiple threads, particularly for streaming operations.

Resource Management: The class implements IDisposable. Always dispose of camera instances when done, either explicitly or using 'using' statements. Alternatively, use VisioForge.Core.GenICam.GenICamCamera.Disconnect for temporary disconnection without disposal.

Basic usage example:
using var camera = GenICamCameraManager.CreateCamera("MyCamera");
if (camera.Connect())
{
    camera.ReadInfo();
    camera.SetExposureTime(10000); // 10ms
    camera.SetGain(0.0);
camera.FrameReceived += (s, e) => {
    Console.WriteLine($"Frame: {e.FrameData.Width}x{e.FrameData.Height}");
};

camera.StartStreaming();
Thread.Sleep(5000); // Stream for 5 seconds
camera.StopStreaming();

}

API Update Notes:
  • Fixed acquisition startup sequence: camera acquisition handles device-level streaming automatically
  • Removed redundant arv_stream_start_acquisition calls that could conflict with camera acquisition
  • Updated buffer management to use modern Aravis buffer management APIs
  • Enhanced stream diagnostics with FillingBuffers parameter support
  • Improved error handling and logging throughout streaming operations
  • Added pre-flight checks for camera and stream handles before starting acquisition
public class GenICamCamera : IDisposable

Inheritance

Implements

Inherited Members

Properties

Address

public string Address { get; set; }

Property Value

string

AvailableBooleanFeatures

Gets the array of available boolean-type GenICam features. Call VisioForge.Core.GenICam.GenICamCamera.ReadAvailableFeatures to populate this property.

public string[] AvailableBooleanFeatures { get; set; }

Property Value

string[]

AvailableFloatFeatures

Gets the array of available float-type GenICam features. Call VisioForge.Core.GenICam.GenICamCamera.ReadAvailableFeatures to populate this property.

public string[] AvailableFloatFeatures { get; set; }

Property Value

string[]

AvailableIntegerFeatures

Gets the array of available integer-type GenICam features. Call VisioForge.Core.GenICam.GenICamCamera.ReadAvailableFeatures to populate this property.

public string[] AvailableIntegerFeatures { get; set; }

Property Value

string[]

AvailablePixelFormatDisplayNames

Gets or sets the array of available pixel format display names for user interfaces.

public string[] AvailablePixelFormatDisplayNames { get; set; }

Property Value

string[]

Remarks

These are human-readable names corresponding to VisioForge.Core.GenICam.GenICamCamera.AvailablePixelFormats, suitable for displaying in dropdown lists or configuration interfaces. This array is populated by VisioForge.Core.GenICam.GenICamCamera.ReadInfo.

AvailablePixelFormats

Gets or sets the array of available pixel format names supported by the camera.

public string[] AvailablePixelFormats { get; set; }

Property Value

string[]

Remarks

Common formats include:

  • "Mono8" - 8-bit monochrome
  • "Mono16" - 16-bit monochrome
  • "BayerRG8", "BayerGR8", etc. - Bayer pattern color formats
  • "RGB8Packed" - 8-bit RGB color
  • "YUV422Packed" - YUV color format
This array is populated by VisioForge.Core.GenICam.GenICamCamera.ReadInfo.

AvailableStringFeatures

Gets the array of available string-type GenICam features. Call VisioForge.Core.GenICam.GenICamCamera.ReadAvailableFeatures to populate this property.

public string[] AvailableStringFeatures { get; set; }

Property Value

string[]

AvailableTriggerSources

public string[] AvailableTriggerSources { get; set; }

Property Value

string[]

AvailableTriggers

public string[] AvailableTriggers { get; set; }

Property Value

string[]

BinningAvailable

Gets or sets whether pixel binning is supported by the camera.

public bool BinningAvailable { get; set; }

Property Value

bool

Remarks

Binning combines adjacent pixels to:

  • Increase sensitivity (brightness) by combining pixel values
  • Reduce resolution for higher frame rates
  • Reduce noise in low-light conditions
If true, use VisioForge.Core.GenICam.GenICamCamera.SetBinning(System.Int32,System.Int32) to configure binning factors.

BlackLevelBounds

public (double Min, double Max) BlackLevelBounds { get; set; }

Property Value

(double Min, double Max)

CameraName

Gets or sets the camera name. This is typically the device ID or a user-friendly name.

public string CameraName { get; set; }

Property Value

string

Remarks

This property is populated by VisioForge.Core.GenICam.GenICamCamera.ReadInfo and may be used for display purposes.

CurrentAcquisitionMode

public GenICamAcquisitionMode CurrentAcquisitionMode { get; set; }

Property Value

GenICamAcquisitionMode

CurrentBinning

public (int Horizontal, int Vertical) CurrentBinning { get; set; }

Property Value

(int Horizontal, int Vertical)

CurrentBlackLevel

public double CurrentBlackLevel { get; set; }

Property Value

double

CurrentExposureTime

public double CurrentExposureTime { get; set; }

Property Value

double

CurrentFrameRate

public VideoFrameRate CurrentFrameRate { get; set; }

Property Value

VideoFrameRate

CurrentGain

public double CurrentGain { get; set; }

Property Value

double

CurrentRegion

public (int X, int Y, int Width, int Height) CurrentRegion { get; set; }

Property Value

(int X, int Y, int Width, int Height)

CurrentTriggerSource

public string CurrentTriggerSource { get; set; }

Property Value

string

DeviceId

Gets or sets the device identifier used for camera connection.

public string DeviceId { get; set; }

Property Value

string

Remarks

Format depends on the camera interface:

  • GigE Vision: IP address or MAC address
  • USB3 Vision: Device path or unique identifier
  • Camera Link: Device name

ExposureTimeAvailable

public bool ExposureTimeAvailable { get; set; }

Property Value

bool

ExposureTimeBounds

public (double Min, double Max) ExposureTimeBounds { get; set; }

Property Value

(double Min, double Max)

FrameRateAvailable

public bool FrameRateAvailable { get; set; }

Property Value

bool

FrameRateBounds

public (double Min, double Max) FrameRateBounds { get; set; }

Property Value

(double Min, double Max)

GainAvailable

public bool GainAvailable { get; set; }

Property Value

bool

GainBounds

public (double Min, double Max) GainBounds { get; set; }

Property Value

(double Min, double Max)

Handle

Gets the native camera handle

public nint Handle { get; }

Property Value

nint

HasAdvancedFeatures

Gets whether the camera has advanced features (more than 30 total features). Call VisioForge.Core.GenICam.GenICamCamera.ReadAvailableFeatures to populate this property.

public bool HasAdvancedFeatures { get; set; }

Property Value

bool

HeightBounds

Gets or sets the valid range and increment for image height settings.

public (int Min, int Max, int Increment) HeightBounds { get; set; }

Property Value

(int Min, int Max, int Increment)

Remarks

Defines the constraints for ROI height:

  • Min: Minimum allowed height in pixels
  • Max: Maximum allowed height in pixels (typically sensor height)
  • Increment: Height must be a multiple of this value (often 1 or 2)
Use these bounds when calling VisioForge.Core.GenICam.GenICamCamera.SetRegion(System.Int32,System.Int32,System.Int32,System.Int32).

IsBlackLevelAutoAvailable

public bool IsBlackLevelAutoAvailable { get; set; }

Property Value

bool

IsBlackLevelAvailable

public bool IsBlackLevelAvailable { get; set; }

Property Value

bool

IsChunkDataAvailable

public bool IsChunkDataAvailable { get; set; }

Property Value

bool

IsComponentControlAvailable

public bool IsComponentControlAvailable { get; set; }

Property Value

bool

IsConnected

Gets whether the camera is connected and available

public bool IsConnected { get; }

Property Value

bool

IsExposureAutoAvailable

public bool IsExposureAutoAvailable { get; set; }

Property Value

bool

IsFrameRateControlEnabled

public bool IsFrameRateControlEnabled { get; set; }

Property Value

bool

IsGainAutoAvailable

public bool IsGainAutoAvailable { get; set; }

Property Value

bool

IsRegionOffsetAvailable

public bool IsRegionOffsetAvailable { get; set; }

Property Value

bool

IsStreaming

Gets whether the camera is currently streaming frames

public bool IsStreaming { get; }

Property Value

bool

IsTriggerAvailable

public bool IsTriggerAvailable { get; set; }

Property Value

bool

LastConnected

public DateTime LastConnected { get; set; }

Property Value

DateTime

LastUpdated

public DateTime LastUpdated { get; set; }

Property Value

DateTime

ManufacturerInfo

public string ManufacturerInfo { get; set; }

Property Value

string

ModelName

Gets or sets the camera model name (e.g., "acA1920-40gm", "Blackfly S").

public string ModelName { get; set; }

Property Value

string

Remarks

This property is populated from the camera's GenICam DeviceModelName feature by VisioForge.Core.GenICam.GenICamCamera.ReadInfo.

PhysicalId

public string PhysicalId { get; set; }

Property Value

string

PixelFormat

Gets or sets the current pixel format name (e.g., "Mono8", "BayerRG8", "RGB8Packed").

public string PixelFormat { get; set; }

Property Value

string

Remarks

This property reflects the currently selected pixel format. Use VisioForge.Core.GenICam.GenICamCamera.SetPixelFormat(System.String) to change the format, and VisioForge.Core.GenICam.GenICamCamera.AvailablePixelFormats to see supported formats.

Protocol

public string Protocol { get; set; }

Property Value

string

SensorSize

Gets or sets the maximum sensor size in pixels (full resolution).

public (int Width, int Height) SensorSize { get; set; }

Property Value

(int Width, int Height)

Remarks

This represents the physical sensor dimensions and is the maximum possible resolution. Actual image size may be smaller due to ROI settings. Populated by VisioForge.Core.GenICam.GenICamCamera.ReadInfo.

SerialNumber

Gets or sets the camera serial number for unique identification.

public string SerialNumber { get; set; }

Property Value

string

Remarks

This property is populated from the camera's GenICam DeviceSerialNumber feature by VisioForge.Core.GenICam.GenICamCamera.ReadInfo. Serial numbers are unique per device and useful for identifying specific cameras in multi-camera setups.

SoftwareTriggerSupported

public bool SoftwareTriggerSupported { get; set; }

Property Value

bool

StreamBufferCount

public int StreamBufferCount { get; set; }

Property Value

int

StreamDiagnostics

public AravisStreamDiagnostics StreamDiagnostics { get; set; }

Property Value

AravisStreamDiagnostics

StreamHandle

Gets the current stream handle (if streaming is active)

public nint StreamHandle { get; }

Property Value

nint

URL

public string URL { get; set; }

Property Value

string

VendorName

Gets or sets the camera vendor/manufacturer name (e.g., "Basler", "FLIR", "Allied Vision").

public string VendorName { get; set; }

Property Value

string

Remarks

This property is populated from the camera's GenICam DeviceVendorName feature by VisioForge.Core.GenICam.GenICamCamera.ReadInfo.

WidthBounds

Gets or sets the valid range and increment for image width settings.

public (int Min, int Max, int Increment) WidthBounds { get; set; }

Property Value

(int Min, int Max, int Increment)

Remarks

Defines the constraints for ROI width:

  • Min: Minimum allowed width in pixels
  • Max: Maximum allowed width in pixels (typically sensor width)
  • Increment: Width must be a multiple of this value (often 1, 2, 4, or 8)
Use these bounds when calling VisioForge.Core.GenICam.GenICamCamera.SetRegion(System.Int32,System.Int32,System.Int32,System.Int32).

XBinningBounds

Gets or sets the valid range and increment for horizontal binning factors.

public (int Min, int Max, int Increment) XBinningBounds { get; set; }

Property Value

(int Min, int Max, int Increment)

Remarks

Only relevant if VisioForge.Core.GenICam.GenICamCamera.BinningAvailable is true. Defines constraints for horizontal binning:

  • Min: Minimum binning factor (usually 1 = no binning)
  • Max: Maximum binning factor (e.g., 4 or 8)
  • Increment: Allowed step size between factors (usually 1)

XOffsetBounds

Gets or sets the valid range and increment for X offset (horizontal position) of the ROI.

public (int Min, int Max, int Increment) XOffsetBounds { get; set; }

Property Value

(int Min, int Max, int Increment)

Remarks

Defines the constraints for ROI X position:

  • Min: Minimum X offset (usually 0)
  • Max: Maximum X offset (sensor width - ROI width)
  • Increment: X offset must be a multiple of this value
Use these bounds when calling VisioForge.Core.GenICam.GenICamCamera.SetRegion(System.Int32,System.Int32,System.Int32,System.Int32).

YBinningBounds

Gets or sets the valid range and increment for vertical binning factors.

public (int Min, int Max, int Increment) YBinningBounds { get; set; }

Property Value

(int Min, int Max, int Increment)

Remarks

Only relevant if VisioForge.Core.GenICam.GenICamCamera.BinningAvailable is true. Defines constraints for vertical binning:

  • Min: Minimum binning factor (usually 1 = no binning)
  • Max: Maximum binning factor (e.g., 4 or 8)
  • Increment: Allowed step size between factors (usually 1)

YOffsetBounds

Gets or sets the valid range and increment for Y offset (vertical position) of the ROI.

public (int Min, int Max, int Increment) YOffsetBounds { get; set; }

Property Value

(int Min, int Max, int Increment)

Remarks

Defines the constraints for ROI Y position:

  • Min: Minimum Y offset (usually 0)
  • Max: Maximum Y offset (sensor height - ROI height)
  • Increment: Y offset must be a multiple of this value
Use these bounds when calling VisioForge.Core.GenICam.GenICamCamera.SetRegion(System.Int32,System.Int32,System.Int32,System.Int32).

Methods

AbortAcquisition()

Aborts acquisition

public void AbortAcquisition()

AreChunksAvailable()

Checks if chunk data features are available

public bool AreChunksAvailable()

Returns

bool

True if chunk data is available

Remarks

Chunk data allows additional metadata to be embedded with each frame, such as:

  • Timestamp information
  • Frame counter
  • Exposure time used for the frame
  • Gain settings
  • Trigger information

Exceptions

ObjectDisposedException

Thrown if the camera instance has been disposed.

AravisException

Thrown if the camera communication fails.

CanReinitialize()

Checks if the camera can be reinitialized

public bool CanReinitialize()

Returns

bool

True if the camera has the necessary information for reinitialization

CaptureFrame(int)

Captures a single frame in one-shot mode with specified timeout.

public GenICamFrameData CaptureFrame(int timeoutMs = 5000)

Parameters

timeoutMs int

Timeout in milliseconds to wait for frame capture (default: 5000). Use larger values for slow cameras or longer exposures.

Returns

GenICamFrameData

Frame data containing image information and pixel data, or null if capture failed or timed out.

Examples

// Capture a single frame with default timeout
var frameData = camera.CaptureFrame();
if (frameData != null)
{
    Console.WriteLine($"Captured frame: {frameData.Width}x{frameData.Height}");
    Console.WriteLine($"Pixel format: {frameData.PixelFormat}");
    Console.WriteLine($"Data size: {frameData.Size} bytes");

    // Process the frame data
    ProcessImageData(frameData.Data);
}
else
{
    Console.WriteLine("Frame capture failed or timed out");
}

// Capture with longer timeout for slow camera
var slowFrameData = camera.CaptureFrame(15000); // 15 second timeout

Remarks

This method performs a synchronous single frame capture:

  1. Ensures camera is connected (connects if necessary)
  2. Creates stream and buffers if they don't exist
  3. Sets acquisition mode to single frame
  4. Starts acquisition and waits for frame
  5. Extracts frame data and stops acquisition

Timeout Considerations: The timeout should be longer than the exposure time plus any camera processing delays. For very long exposures (>1 second), increase the timeout accordingly.

Performance: This method is suitable for infrequent captures. For continuous imaging, use VisioForge.Core.GenICam.GenICamCamera.StartStreaming instead for better performance.

Thread Safety: This method blocks the calling thread until the frame is captured or timeout occurs.

Exceptions

ObjectDisposedException

Thrown if the camera instance has been disposed.

Connect()

Establishes connection to the camera hardware and initializes the camera for operation.

public bool Connect()

Returns

bool

True if connection was successful, false otherwise.

Examples

var camera = new GenICamCamera("192.168.1.100");
if (camera.Connect())
{
    camera.ReadInfo();
    Console.WriteLine($"Connected to: {camera.ModelName}");
}
else
{
    Console.WriteLine("Failed to connect to camera");
}

Remarks

This method performs the following operations:

  1. Validates that the camera instance is not disposed
  2. Checks if already connected (returns true if so)
  3. Attempts to connect using the device ID or handle provided in constructor
  4. Updates connection timestamps on success

Note: After successful connection, call VisioForge.Core.GenICam.GenICamCamera.ReadInfo to populate camera capabilities.

Exceptions

AravisException

Thrown when camera connection fails due to hardware or network issues.

ObjectDisposedException

Thrown if the camera instance has been disposed.

CreateStream(int)

Creates and configures a stream for frame acquisition

public bool CreateStream(int bufferCount = 10)

Parameters

bufferCount int

Number of buffers to allocate (default: 10)

Returns

bool

True if stream was created successfully

DestroyStream()

Destroys the current stream and releases all resources

public void DestroyStream()

Disconnect()

Disconnects from the camera hardware without disposing the object

public bool Disconnect()

Returns

bool

True if disconnection was successful

Dispose()

Disposes the camera resources

public void Dispose()

Dispose(bool)

Disposes the camera resources

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

Whether disposing from Dispose() method

ExecuteCommand(string)

Executes a command feature on the camera

public bool ExecuteCommand(string commandName)

Parameters

commandName string

Name of the command feature to execute

Returns

bool

True if command was executed successfully

Examples

// Execute software trigger command
if (camera.IsFeatureAvailable("TriggerSoftware"))
{
    bool success = camera.ExecuteCommand("TriggerSoftware");
    Console.WriteLine($"Software trigger: {(success ? "Success" : "Failed")}");
}

// Load user set
if (camera.IsFeatureAvailable("UserSetLoad"))
{
    camera.SetStringFeature("UserSetSelector", "UserSet1");
    camera.ExecuteCommand("UserSetLoad");
}

Remarks

This method can be used to execute GenICam command features such as:

  • "TriggerSoftware" - Send software trigger
  • "AcquisitionStart" - Start acquisition
  • "AcquisitionStop" - Stop acquisition
  • "DeviceReset" - Reset device
  • "UserSetLoad" - Load user settings
  • "UserSetSave" - Save user settings

Use VisioForge.Core.GenICam.GenICamCamera.IsFeatureAvailable(System.String) to check if a command is available before executing.

Exceptions

ObjectDisposedException

Thrown if the camera instance has been disposed.

AravisException

Thrown if the command execution fails.

~GenICamCamera()

Finalizer

protected ~GenICamCamera()

GetAcquisitionMode()

Gets the current acquisition mode

public GenICamAcquisitionMode GetAcquisitionMode()

Returns

GenICamAcquisitionMode

Current acquisition mode

GetAvailablePixelFormatDisplayNames()

Gets the list of available pixel formats with display names

public string[] GetAvailablePixelFormatDisplayNames()

Returns

string[]

Array of pixel format display names

GetAvailablePixelFormats()

Gets the list of available pixel formats as strings

public string[] GetAvailablePixelFormats()

Returns

string[]

Array of available pixel format names

GetBinning()

Gets the current binning settings

public (int Horizontal, int Vertical) GetBinning()

Returns

(int Horizontal, int Vertical)

Binning as horizontal and vertical factors

GetBlackLevel()

Gets the current black level value

public double GetBlackLevel()

Returns

double

Current black level

Exceptions

ObjectDisposedException

Thrown if the camera instance has been disposed.

AravisException

Thrown if the camera communication fails.

GetBlackLevelAuto()

Gets the current black level auto mode

public GenICamAuto GetBlackLevelAuto()

Returns

GenICamAuto

Current black level auto mode

Exceptions

ObjectDisposedException

Thrown if the camera instance has been disposed.

AravisException

Thrown if the camera communication fails.

GetBlackLevelBounds()

Gets the black level bounds (minimum and maximum values)

public (double Min, double Max) GetBlackLevelBounds()

Returns

(double Min, double Max)

Black level bounds as min and max

Exceptions

ObjectDisposedException

Thrown if the camera instance has been disposed.

AravisException

Thrown if the camera communication fails.

GetBooleanFeature(string)

Gets a boolean feature value

public bool GetBooleanFeature(string featureName)

Parameters

featureName string

Feature name

Returns

bool

Feature value

GetCapabilitySummary()

Gets a detailed summary of camera capabilities

public string GetCapabilitySummary()

Returns

string

Detailed capability summary

GetDeviceId()

Gets the device ID from camera

public string GetDeviceId()

Returns

string

GetExposureAuto()

Gets the current exposure auto mode

public GenICamAuto GetExposureAuto()

Returns

GenICamAuto

Current exposure auto mode

Exceptions

ObjectDisposedException

Thrown if the camera instance has been disposed.

AravisException

Thrown if the camera communication fails.

GetExposureTime()

Gets the exposure time in microseconds

public double GetExposureTime()

Returns

double

Exposure time in microseconds

GetExposureTimeBounds()

Gets the exposure time bounds

public (double Min, double Max) GetExposureTimeBounds()

Returns

(double Min, double Max)

Exposure time bounds as min and max in microseconds

GetFloatFeature(string)

Gets a float feature value

public double GetFloatFeature(string featureName)

Parameters

featureName string

Feature name

Returns

double

Feature value

GetFrameCount()

Gets the current frame count setting

public long GetFrameCount()

Returns

long

Current frame count

Exceptions

ObjectDisposedException

Thrown if the camera instance has been disposed.

AravisException

Thrown if the camera communication fails.

GetFrameCountBounds()

Gets the frame count bounds (minimum and maximum values)

public (long Min, long Max) GetFrameCountBounds()

Returns

(long Min, long Max)

Frame count bounds as min and max

Exceptions

ObjectDisposedException

Thrown if the camera instance has been disposed.

AravisException

Thrown if the camera communication fails.

GetFrameRate()

Gets the frame rate

public VideoFrameRate GetFrameRate()

Returns

VideoFrameRate

Frame rate in frames per second

GetFrameRateBounds()

Gets the frame rate bounds

public (double Min, double Max) GetFrameRateBounds()

Returns

(double Min, double Max)

Frame rate bounds as min and max

GetFrameRateControlEnabled()

Checks if frame rate control is enabled

public bool GetFrameRateControlEnabled()

Returns

bool

True if frame rate control is enabled

GetGain()

Gets the gain value

public double GetGain()

Returns

double

Gain value

GetGainAuto()

Gets the current gain auto mode

public GenICamAuto GetGainAuto()

Returns

GenICamAuto

Current gain auto mode

Exceptions

ObjectDisposedException

Thrown if the camera instance has been disposed.

AravisException

Thrown if the camera communication fails.

GetGainBounds()

Gets the gain bounds

public (double Min, double Max) GetGainBounds()

Returns

(double Min, double Max)

Gain bounds as min and max

GetHeightBounds()

Gets the height bounds (min and max values)

public (int Min, int Max) GetHeightBounds()

Returns

(int Min, int Max)

Height bounds as min and max

GetHeightIncrement()

Gets the height increment

public int GetHeightIncrement()

Returns

int

Height increment value

GetIntegerFeature(string)

Gets an integer feature value

public long GetIntegerFeature(string featureName)

Parameters

featureName string

Feature name

Returns

long

Feature value

GetModelName()

Gets the model name from camera

public string GetModelName()

Returns

string

GetPayload()

Gets the payload size directly from the camera

public uint GetPayload()

Returns

uint

Payload size in bytes

Remarks

This method provides direct access to the camera's payload size, which represents the size in bytes of image data that will be transmitted per frame.

This is more reliable than calculating payload size from image dimensions as it accounts for any camera-specific padding or formatting.

Exceptions

ObjectDisposedException

Thrown if the camera instance has been disposed.

AravisException

Thrown if the camera communication fails.

GetPixelFormat()

Gets the current pixel format

public int GetPixelFormat()

Returns

int

Current pixel format as integer

GetPixelFormatString()

Gets the current pixel format as a string

public string GetPixelFormatString()

Returns

string

Current pixel format name

GetRegion()

Gets the current region of interest (ROI)

public (int X, int Y, int Width, int Height) GetRegion()

Returns

(int X, int Y, int Width, int Height)

ROI as x, y, width, height

GetSensorSize()

Gets the sensor size (maximum resolution)

public (int Width, int Height) GetSensorSize()

Returns

(int Width, int Height)

Sensor size as width and height

GetSerialNumber()

Gets the serial number from camera

public string GetSerialNumber()

Returns

string

GetStreamDiagnostics()

Gets comprehensive diagnostic information about the current streaming state and performance.

public AravisStreamDiagnostics GetStreamDiagnostics()

Returns

AravisStreamDiagnostics

Diagnostic information including buffer counts, statistics, and error states.

Examples

// Monitor streaming performance
var diagnostics = camera.GetStreamDiagnostics();

Console.WriteLine($"Streaming Active: {diagnostics.IsStreaming}");
Console.WriteLine($"Completed Frames: {diagnostics.CompletedBuffers}");
Console.WriteLine($"Failed Frames: {diagnostics.FailedBuffers}");
Console.WriteLine($"Underruns: {diagnostics.UnderrunBuffers}");
Console.WriteLine($"Buffer Counts - Input: {diagnostics.InputBuffers}, Output: {diagnostics.OutputBuffers}");

// Check for problems
if (diagnostics.FailedBuffers > diagnostics.CompletedBuffers * 0.1)
{
    Console.WriteLine("Warning: High frame failure rate detected");
}

if (!string.IsNullOrEmpty(diagnostics.ErrorMessage))
{
    Console.WriteLine($"Stream Error: {diagnostics.ErrorMessage}");
}

Remarks

This method provides detailed information about the streaming subsystem:

  • Buffer Information: Input, output, and filling buffer counts
  • Statistics: Completed frames, failed frames, and underrun counts
  • State Information: Whether streaming is active and stream handle validity
  • Error Information: Any error messages from the streaming subsystem

Troubleshooting Guide:

  • High Failed Buffers: Indicates camera producing frames faster than processing - reduce frame rate or increase buffer count
  • High Underruns: Suggests insufficient buffers or slow processing - increase buffer count or optimize frame handling
  • Zero Completed Buffers: Camera may not be producing frames - check exposure settings and triggers
  • No Input Buffers: Stream buffer creation failed - check memory availability

Performance Note: This method queries the stream in real-time, so it reflects current state.

Exceptions

ObjectDisposedException

Thrown if the camera instance has been disposed.

GetStringFeature(string)

Gets a string feature value

public string GetStringFeature(string featureName)

Parameters

featureName string

Feature name

Returns

string

Feature value

GetVendorName()

Gets the vendor name from camera

public string GetVendorName()

Returns

string

GetWidthBounds()

Gets the width bounds (min and max values)

public (int Min, int Max) GetWidthBounds()

Returns

(int Min, int Max)

Width bounds as min and max

GetWidthIncrement()

Gets the width increment

public int GetWidthIncrement()

Returns

int

Width increment value

GetXBinningBounds()

Gets the horizontal binning bounds

public (int Min, int Max) GetXBinningBounds()

Returns

(int Min, int Max)

Horizontal binning bounds as min and max

GetXBinningIncrement()

Gets the X binning increment

public int GetXBinningIncrement()

Returns

int

X binning increment value

GetXOffsetBounds()

Gets the X offset bounds

public (int Min, int Max) GetXOffsetBounds()

Returns

(int Min, int Max)

X offset bounds as min and max

GetXOffsetIncrement()

Gets the X offset increment

public int GetXOffsetIncrement()

Returns

int

X offset increment value

GetYBinningBounds()

Gets the vertical binning bounds

public (int Min, int Max) GetYBinningBounds()

Returns

(int Min, int Max)

Vertical binning bounds as min and max

GetYBinningIncrement()

Gets the Y binning increment

public int GetYBinningIncrement()

Returns

int

Y binning increment value

GetYOffsetBounds()

Gets the Y offset bounds

public (int Min, int Max) GetYOffsetBounds()

Returns

(int Min, int Max)

Y offset bounds as min and max

GetYOffsetIncrement()

Gets the Y offset increment

public int GetYOffsetIncrement()

Returns

int

Y offset increment value

IsBinningAvailable()

Checks if binning is available

public bool IsBinningAvailable()

Returns

bool

True if binning is supported

IsComponentAvailable()

Checks if component control is available

public bool IsComponentAvailable()

Returns

bool

True if component control is available

Remarks

Component control allows selection and configuration of different sensor components or processing pipelines, commonly used in multi-tap or color cameras.

Exceptions

ObjectDisposedException

Thrown if the camera instance has been disposed.

AravisException

Thrown if the camera communication fails.

IsExposureTimeAvailable()

Checks if exposure time control is available

public bool IsExposureTimeAvailable()

Returns

bool

True if exposure time control is available

Exceptions

ObjectDisposedException

Thrown if the camera instance has been disposed.

AravisException

Thrown if the camera communication fails.

IsFeatureAvailable(string)

Checks if a feature is available

public bool IsFeatureAvailable(string featureName)

Parameters

featureName string

Feature name

Returns

bool

True if feature is available

IsRegionOffsetAvailableCheck()

Checks if region offset is available

public bool IsRegionOffsetAvailableCheck()

Returns

bool

True if region offset is available

IsSoftwareTriggerSupported()

Checks if software trigger is supported by the camera

public bool IsSoftwareTriggerSupported()

Returns

bool

True if software trigger is supported

Exceptions

ObjectDisposedException

Thrown if the camera instance has been disposed.

AravisException

Thrown if the camera communication fails.

ReadAvailableFeatures()

Reads and populates all available GenICam features organized by data type. This method enumerates common GenICam features and categorizes them by type.

public void ReadAvailableFeatures()

Examples

// Connect and read basic info
camera.Connect();
camera.ReadInfo();

// Optionally read detailed feature information
camera.ReadAvailableFeatures();

// Check capabilities
Console.WriteLine($"Advanced camera: {camera.HasAdvancedFeatures}");
Console.WriteLine($"Available features: {camera.AvailableStringFeatures.Length + camera.AvailableIntegerFeatures.Length + camera.AvailableFloatFeatures.Length + camera.AvailableBooleanFeatures.Length}");

// Check for specific feature types
bool hasCounters = camera.AvailableIntegerFeatures.Contains("CounterValue");
bool hasUserSets = camera.AvailableStringFeatures.Contains("UserSetSelector");

Remarks

This method populates the following properties:

  • VisioForge.Core.GenICam.GenICamCamera.HasAdvancedFeatures - Whether camera has advanced capabilities
  • VisioForge.Core.GenICam.GenICamCamera.AvailableStringFeatures - String-type features (enums, device info, etc.)
  • VisioForge.Core.GenICam.GenICamCamera.AvailableIntegerFeatures - Integer-type features (dimensions, counts, etc.)
  • VisioForge.Core.GenICam.GenICamCamera.AvailableFloatFeatures - Float-type features (rates, temperatures, etc.)
  • VisioForge.Core.GenICam.GenICamCamera.AvailableBooleanFeatures - Boolean-type features (enable flags, status, etc.)

Performance Note: This method can take several seconds to complete as it tests many potential features. It's recommended to call this only when feature discovery is needed.

Feature Categories Tested:

  • Device Information (vendor, model, serial number, etc.)
  • Image Format Control (dimensions, pixel formats, binning, etc.)
  • Acquisition Control (exposure, triggers, frame rate, etc.)
  • Analog Control (gain, black level, white balance, etc.)
  • Digital I/O Control (line controls, triggering, etc.)
  • Transport Layer (GigE/USB3 specific features)
  • Advanced Features (counters, timers, chunk data, user sets)

Exceptions

ObjectDisposedException

Thrown if the camera instance has been disposed.

ReadInfo()

Reads and populates all camera information properties from the connected camera device.

public void ReadInfo()

Examples

if (camera.Connect())
{
    camera.ReadInfo();

    Console.WriteLine($"Camera: {camera.VendorName} {camera.ModelName}");
    Console.WriteLine($"Sensor Size: {camera.SensorSize.Width}x{camera.SensorSize.Height}");
    Console.WriteLine($"Pixel Formats: {string.Join(", ", camera.AvailablePixelFormats)}");
    Console.WriteLine($"Frame Rate Range: {camera.FrameRateBounds.Min}-{camera.FrameRateBounds.Max} FPS");
}

Remarks

This method queries the camera for comprehensive information including:

  • Basic device information (vendor, model, serial number)
  • Sensor capabilities (size, resolution bounds)
  • Pixel format support and current settings
  • Exposure and gain capabilities and ranges
  • Frame rate capabilities
  • Binning and ROI capabilities
  • Protocol type (GigE, USB3, etc.)
  • Current camera settings

Performance Note: This method involves multiple queries to the camera and may take several hundred milliseconds to complete, especially over network connections.

Usage: Call this method after VisioForge.Core.GenICam.GenICamCamera.Connect and before attempting to configure camera settings or start streaming.

Exceptions

ObjectDisposedException

Thrown if the camera instance has been disposed.

AravisException

Thrown if the camera is not connected or communication fails.

RefreshBoundsInfo()

Reads and updates all bounds information from the camera

public void RefreshBoundsInfo()

ReinitializeCamera()

Reinitializes the camera connection using the original device parameters. This method can be used to reconnect a camera that was disconnected or disposed.

public bool ReinitializeCamera()

Returns

bool

True if reinitialization was successful, false otherwise.

Examples

// Handle camera disconnection and recovery
try
{
    camera.StartStreaming();
}
catch (AravisException ex)
{
    Console.WriteLine($"Camera error: {ex.Message}");

    // Attempt to reinitialize
    if (camera.ReinitializeCamera())
    {
        Console.WriteLine("Camera reinitialized successfully");
        camera.ReadInfo(); // Refresh capabilities
        camera.StartStreaming(); // Resume streaming
    }
    else
    {
        Console.WriteLine("Failed to reinitialize camera");
    }
}

Remarks

This method performs a complete reinitialization:

  1. Stops any active streaming operations
  2. Cleans up existing camera and stream resources
  3. Resets the disposed state to allow normal operation
  4. Recreates the camera connection using original parameters

Usage Scenarios:

  • Camera was disconnected due to network issues (GigE cameras)
  • USB camera was unplugged and reconnected
  • Camera was manually disconnected using VisioForge.Core.GenICam.GenICamCamera.Disconnect
  • Camera object was disposed but you want to reuse it
  • Recovery from communication errors

Important: After successful reinitialization, you should call VisioForge.Core.GenICam.GenICamCamera.ReadInfo to refresh camera capabilities, as they may have changed.

Alternative: For temporary disconnections without disposal, consider using VisioForge.Core.GenICam.GenICamCamera.Disconnect followed by VisioForge.Core.GenICam.GenICamCamera.Connect instead.

SetAcquisitionMode(GenICamAcquisitionMode)

Sets the acquisition mode

public void SetAcquisitionMode(GenICamAcquisitionMode mode)

Parameters

mode GenICamAcquisitionMode

Acquisition mode

SetBinning(int, int)

Sets the binning

public void SetBinning(int horizontal, int vertical)

Parameters

horizontal int

Horizontal binning factor

vertical int

Vertical binning factor

SetBlackLevel(double)

Sets the black level value

public void SetBlackLevel(double blackLevel)

Parameters

blackLevel double

Black level value

Remarks

Black level represents the minimum signal level that corresponds to black in the image. Adjusting black level can help improve image contrast and correct for sensor dark current.

Use VisioForge.Core.GenICam.GenICamCamera.GetBlackLevelBounds to determine the valid range for your camera.

Exceptions

ObjectDisposedException

Thrown if the camera instance has been disposed.

AravisException

Thrown if the black level is invalid or the camera rejects the setting.

SetBlackLevelAuto(GenICamAuto)

Sets the black level auto mode

public void SetBlackLevelAuto(GenICamAuto autoMode)

Parameters

autoMode GenICamAuto

Auto mode (Off = 0, Once = 1, Continuous = 2)

Remarks

Auto black level modes:

  • Off (0): Manual black level control - use SetBlackLevel() to set specific values
  • Once (1): Single auto-adjustment, then returns to manual mode
  • Continuous (2): Continuous automatic black level adjustment

Availability: Check VisioForge.Core.GenICam.GenICamCamera.IsBlackLevelAutoAvailable before using this method.

Exceptions

ObjectDisposedException

Thrown if the camera instance has been disposed.

AravisException

Thrown if the auto mode is invalid or the camera rejects the setting.

SetBooleanFeature(string, bool)

Sets a boolean feature value

public void SetBooleanFeature(string featureName, bool value)

Parameters

featureName string

Feature name

value bool

Feature value

SetExposureAuto(GenICamAuto)

Sets the exposure auto mode

public void SetExposureAuto(GenICamAuto autoMode)

Parameters

autoMode GenICamAuto

Auto mode (Off = 0, Once = 1, Continuous = 2)

Examples

// Enable continuous auto exposure
if (camera.IsExposureAutoAvailable)
{
    camera.SetExposureAuto(GenICamAuto.Continuous);
}

// Disable auto exposure and set manual value
camera.SetExposureAuto(GenICamAuto.Off);
camera.SetExposureTime(10000); // 10ms

Remarks

Auto exposure modes:

  • Off (0): Manual exposure control - use SetExposureTime() to set specific values
  • Once (1): Single auto-exposure adjustment, then returns to manual mode
  • Continuous (2): Continuous automatic exposure adjustment

Availability: Check VisioForge.Core.GenICam.GenICamCamera.IsExposureAutoAvailable before using this method.

Exceptions

ObjectDisposedException

Thrown if the camera instance has been disposed.

AravisException

Thrown if the auto mode is invalid or the camera rejects the setting.

SetExposureTime(double)

Sets the exposure time in microseconds.

public void SetExposureTime(double exposureTimeUs)

Parameters

exposureTimeUs double

Exposure time in microseconds (must be within VisioForge.Core.GenICam.GenICamCamera.ExposureTimeBounds)

Examples

// Set exposure to 10 milliseconds
camera.SetExposureTime(10000);

// Set exposure within valid bounds
camera.ReadInfo();
double minExposure = camera.ExposureTimeBounds.Min;
double maxExposure = camera.ExposureTimeBounds.Max;
double targetExposure = Math.Min(maxExposure, Math.Max(minExposure, 5000));
camera.SetExposureTime(targetExposure);

Remarks

The exposure time controls how long the sensor is exposed to light for each frame. Longer exposure times result in brighter images but may cause motion blur.

Valid Range: Use VisioForge.Core.GenICam.GenICamCamera.ExposureTimeBounds to determine the valid range for your camera.

Units: Microseconds (µs). Common values:

  • 100 µs (0.1 ms) - Very fast, for high-speed imaging
  • 1,000 µs (1 ms) - Fast, typical for motion capture
  • 10,000 µs (10 ms) - Medium, general purpose
  • 100,000 µs (100 ms) - Long, for low-light conditions

Frame Rate Impact: Longer exposure times may limit the maximum achievable frame rate.

Exceptions

ObjectDisposedException

Thrown if the camera instance has been disposed.

AravisException

Thrown if the exposure time is invalid or the camera rejects the setting.

SetFloatFeature(string, double)

Sets a float feature value

public void SetFloatFeature(string featureName, double value)

Parameters

featureName string

Feature name

value double

Feature value

SetFrameCount(long)

Sets the number of frames to capture in multi-frame acquisition mode

public void SetFrameCount(long frameCount)

Parameters

frameCount long

Number of frames to capture

Remarks

This setting is typically used with VisioForge.Core.Types.X.Sources.GenICamAcquisitionMode.MultiFrame acquisition mode to capture a specific number of frames before stopping automatically.

Use VisioForge.Core.GenICam.GenICamCamera.GetFrameCountBounds to determine the valid range for your camera.

Exceptions

ObjectDisposedException

Thrown if the camera instance has been disposed.

AravisException

Thrown if the frame count is invalid or the camera rejects the setting.

SetFrameRate(VideoFrameRate)

Sets the frame rate

public void SetFrameRate(VideoFrameRate frameRate)

Parameters

frameRate VideoFrameRate

Frame rate in frames per second

SetGain(double)

Sets the gain value

public void SetGain(double gain)

Parameters

gain double

Gain value

SetGainAuto(GenICamAuto)

Sets the gain auto mode

public void SetGainAuto(GenICamAuto autoMode)

Parameters

autoMode GenICamAuto

Auto mode (Off = 0, Once = 1, Continuous = 2)

Examples

// Enable continuous auto gain
if (camera.IsGainAutoAvailable)
{
    camera.SetGainAuto(GenICamAuto.Continuous);
}

// Disable auto gain and set manual value
camera.SetGainAuto(GenICamAuto.Off);
camera.SetGain(0.0); // Minimum gain

Remarks

Auto gain modes:

  • Off (0): Manual gain control - use SetGain() to set specific values
  • Once (1): Single auto-gain adjustment, then returns to manual mode
  • Continuous (2): Continuous automatic gain adjustment

Availability: Check VisioForge.Core.GenICam.GenICamCamera.IsGainAutoAvailable before using this method.

Exceptions

ObjectDisposedException

Thrown if the camera instance has been disposed.

AravisException

Thrown if the auto mode is invalid or the camera rejects the setting.

SetIntegerFeature(string, long)

Sets an integer feature value

public void SetIntegerFeature(string featureName, long value)

Parameters

featureName string

Feature name

value long

Feature value

SetPixelFormat(int)

Sets the pixel format

public void SetPixelFormat(int format)

Parameters

format int

Pixel format as integer

SetPixelFormat(string)

Sets the pixel format from string

public void SetPixelFormat(string format)

Parameters

format string

Pixel format name

SetRegion(int, int, int, int)

Sets the region of interest (ROI) for image acquisition.

public void SetRegion(int x, int y, int width, int height)

Parameters

x int

X offset in pixels from the left edge of the sensor (must be within VisioForge.Core.GenICam.GenICamCamera.XOffsetBounds)

y int

Y offset in pixels from the top edge of the sensor (must be within VisioForge.Core.GenICam.GenICamCamera.YOffsetBounds)

width int

Width in pixels (must be within VisioForge.Core.GenICam.GenICamCamera.WidthBounds and x + width ≤ sensor width)

height int

Height in pixels (must be within VisioForge.Core.GenICam.GenICamCamera.HeightBounds and y + height ≤ sensor height)

Examples

// Set ROI to center 640x480 region
camera.ReadInfo();
int centerX = (camera.SensorSize.Width - 640) / 2;
int centerY = (camera.SensorSize.Height - 480) / 2;
camera.SetRegion(centerX, centerY, 640, 480);

// Verify the actual ROI set
var actualROI = camera.GetRegion();
Console.WriteLine($"Actual ROI: {actualROI.X}, {actualROI.Y}, {actualROI.Width}x{actualROI.Height}");

Remarks

The ROI must satisfy the following constraints:

  • x, y, width, height must be positive
  • x + width must not exceed the sensor width
  • y + height must not exceed the sensor height
  • Values must respect the camera's increment requirements

Performance Impact: Smaller ROIs typically allow higher frame rates due to reduced data transfer.

Note: Some cameras may adjust the ROI to the nearest valid values based on their constraints.

Exceptions

ObjectDisposedException

Thrown if the camera instance has been disposed.

AravisException

Thrown if the ROI parameters are invalid or the camera rejects the settings.

SetStringFeature(string, string)

Sets a string feature value

public void SetStringFeature(string featureName, string value)

Parameters

featureName string

Feature name

value string

Feature value

SoftwareTrigger()

Sends a software trigger command to the camera

public void SoftwareTrigger()

Examples

// Configure for software trigger
if (camera.IsSoftwareTriggerSupported())
{
    camera.SetStringFeature("TriggerMode", "On");
    camera.SetStringFeature("TriggerSource", "Software");

    // Start acquisition
    camera.StartAcquisition();

    // Trigger a frame
    camera.SoftwareTrigger();
}

Remarks

This method sends a software trigger signal to the camera, which can be used to:

  • Capture a single frame when in software trigger mode
  • Start acquisition when trigger mode is enabled
  • Synchronize capture timing in multi-camera setups

Prerequisites: The camera must be configured for software triggering and VisioForge.Core.GenICam.GenICamCamera.IsSoftwareTriggerSupported must return true.

Exceptions

ObjectDisposedException

Thrown if the camera instance has been disposed.

AravisException

Thrown if the camera communication fails or software trigger is not supported.

StartAcquisition()

Starts acquisition

public void StartAcquisition()

StartStreaming()

Starts streaming frames in continuous mode with automatic buffer management.

public bool StartStreaming()

Returns

bool

True if streaming started successfully, false otherwise.

Examples

// Set up frame handling
camera.FrameReceived += (sender, e) => {
    var frame = e.FrameData;
    Console.WriteLine($"Received frame: {frame.Width}x{frame.Height}");
    // Process frame data...
};

camera.FrameError += (sender, e) => {
    Console.WriteLine($"Frame error: {e.ErrorMessage}");
};

// Start streaming
if (camera.StartStreaming())
{
    Console.WriteLine("Streaming started successfully");
    // Let it stream for a while...
    Thread.Sleep(5000);
    camera.StopStreaming();
}

Remarks

This method performs the following operations:

  1. Ensures camera is connected (connects if necessary)
  2. Creates stream and buffers if they don't exist
  3. Sets acquisition mode to continuous
  4. Starts camera acquisition
  5. Begins frame polling timer
  6. Fires VisioForge.Core.GenICam.GenICamCamera.StreamingStarted event on success

Event Handling: Subscribe to VisioForge.Core.GenICam.GenICamCamera.FrameReceived before calling this method to receive frame data. Frames are delivered asynchronously via events.

Buffer Management: Buffers are created and managed automatically. The default buffer count is 10, which should be sufficient for most applications.

Thread Safety: This method is not thread-safe with respect to other camera operations.

Exceptions

ObjectDisposedException

Thrown if the camera instance has been disposed.

AravisException

Thrown if streaming cannot be started due to camera or configuration issues.

StopAcquisition()

Stops acquisition

public void StopAcquisition()

StopStreaming()

Stops streaming frames

public bool StopStreaming()

Returns

bool

True if streaming stopped successfully

ToString()

Returns a string representation of the camera

public override string ToString()

Returns

string

String representation

FrameError

Event fired when a frame acquisition error occurs during streaming.

public event EventHandler<GenICamFrameErrorEventArgs> FrameError

Event Type

EventHandler<GenICamFrameErrorEventArgs>

Remarks

Common causes include:

  • Buffer underrun (camera producing frames faster than they can be processed)
  • Network packet loss (GigE cameras)
  • USB bandwidth limitations (USB3 cameras)
  • Insufficient system resources

The streaming will typically continue after an error, but consider reducing frame rate or increasing buffer count.

FrameReceived

Event fired when a new frame is received during streaming operations.

public event EventHandler<GenICamFrameReceivedEventArgs> FrameReceived

Event Type

EventHandler<GenICamFrameReceivedEventArgs>

Examples

camera.FrameReceived += (sender, e) => {
    var frame = e.FrameData;
    Console.WriteLine($"Frame: {frame.Width}x{frame.Height}, Format: {frame.PixelFormat}");
    // Process frame data...
};

Remarks

This event is raised from a background timer thread, so UI updates should be marshaled to the appropriate thread.

Frame processing should be kept minimal to avoid blocking the acquisition pipeline.

The frame data is copied, so it's safe to access after the event handler returns.

StreamingStarted

Event fired when streaming starts successfully.

public event EventHandler StreamingStarted

Event Type

EventHandler

Remarks

This event indicates that the camera acquisition has started and buffers are available for frame capture.

StreamingStopped

Event fired when streaming stops.

public event EventHandler StreamingStopped

Event Type

EventHandler

Remarks

This event is fired both for normal stop operations and when streaming stops due to errors.