### Build VmbNET Examples with .NET CLI Source: https://docs.alliedvision.com/Vimba_X/Vimba_X_DeveloperGuide/dotNetAPIManual Provides the command-line instruction to build VmbNET examples using the .NET CLI. It requires a .NET SDK and specifies how to reference the VmbNET NuGet package. ```bash // Building the VmbNET examples with the command line dotnet build --source "https://api.nuget.org/v3/index.json" --source ``` -------------------------------- ### Build Vimba X C and C++ Examples with CMake (Unix) Source: https://docs.alliedvision.com/Vimba_X/Vimba_X_DeveloperGuide/sdkManual This command sequence demonstrates building Vimba X C and C++ examples on Unix-like systems using CMake with the Unix Makefiles generator. It assumes Vimba X is installed in the user's home directory. Ensure CMake v3.16 or higher is installed. ```bash # Unix Makefiles # Here, Vimba X is installed in the user's home directory and # version is 2022-1 api_dir=$(realpath ~/VimbaX_2022-1/api) cmake -S "${api-dir}/examples/VmbC" -B VmbC_examples_build cmake -S "${api-dir}/examples/VmbCPP" -B VmbCPP_examples_build cmake --build VmbC_examples_build cmake --build VmbCPP_examples_build ``` -------------------------------- ### Build Vimba X C and C++ Examples with CMake (Windows) Source: https://docs.alliedvision.com/Vimba_X/Vimba_X_DeveloperGuide/sdkManual This command sequence shows how to build the Vimba X C and C++ examples on Windows using CMake. It specifies the x64 platform and the build configuration (Release). Ensure CMake v3.16 or higher is installed. ```bash # Windows, default generator: Visual Studio (default examples installation folder) cmake -A x64 -S "C:/Users/Public/Documents/Allied Vision/VimbaX/Examples/VmbC" -B VmbC_examples_build cmake -A x64 -S "C:/Users/Public/Documents/Allied Vision/VimbaX/Examples/VmbCPP" -B VmbCPP_examples_build cmake --build VmbC_examples_build --config Release cmake --build VmbCPP_examples_build --config Release ``` -------------------------------- ### Full Example: Vimba X Camera Initialization and Feature Control in C# Source: https://docs.alliedvision.com/Vimba_X/Vimba_X_DeveloperGuide/dotNetAPIManual A comprehensive C# example demonstrating the initialization of Vimba X, accessing the first available camera, opening it, and then manipulating the 'ExposureTime' feature using both dynamic and static type approaches. It also shows how to convert between dynamic and static feature types. ```csharp using System.Linq; using VmbNET; class Program { static void Main() { // Start Vimba X using var vmbSystem = IVmbSystem.Startup(); // Get first camera in camera list var camera = vmbSystem.GetCameras().First(); // Open this camera using var openCamera = camera.Open(); // Change exposure time openCamera.Features.ExposureTime = 5000.0; // Increase exposure time openCamera.Features.ExposureTime += 100.0; // Convert exposure time dynamic instance to static type IFloatFeature exposureTimeFeature = openCamera.Features.ExposureTime; // Increase exposure time again exposureTimeFeature.Value += 200.0; } } ``` -------------------------------- ### Listing Cameras Source: https://docs.alliedvision.com/Vimba_X/Vimba_X_DeveloperGuide/dotNetAPIManual Provides an example of how to retrieve a list of all detected cameras connected to the system after the Vimba X API has started up. ```APIDOC ## Listing Cameras ### Description Cameras are detected automatically during API startup. This example shows how to retrieve a list of all detected cameras. Camera objects contain static details like ID and model before being opened. ### Method Camera Discovery ### Endpoint N/A (In-process camera discovery) ### Parameters N/A ### Request Example ```csharp using System; using VmbNET; class Program { static void Main() { using var vmbSystem = IVmbSystem.Startup(); var cameras = vmbSystem.GetCameras(); if(cameras.Count > 0) { Console.WriteLine($"Found {cameras.Count} cameras"); } else { Console.WriteLine($"Found no cameras"); } } } ``` ### Response #### Success Response (Camera List) - **cameras** (List) - A list of `ICamera` objects representing the detected cameras. #### Response Example ``` Found 2 cameras ``` ``` -------------------------------- ### C++ Image Streaming Setup and Acquisition Control Source: https://docs.alliedvision.com/Vimba_X/Vimba_X_DeveloperGuide/cppAPIManual This C++ code demonstrates setting up continuous image acquisition using the Vimba X API. It includes initializing the Vimba system, selecting a camera, announcing and queuing frames, starting acquisition, setting the 'AcquisitionMode' to 'Continuous', starting the acquisition command, and finally stopping acquisition and cleaning up resources. Error checking is omitted for brevity. ```cpp int main() { VmbErrorType err; // Every Vimba X function returns an error code that // should always be checked for VmbErrorSuccess (not done here for brevity) VmbSystem& system = VmbSystem::GetInstance(); err = system.Startup(); // Listing available cameras and selecting the one to use CameraPtrVector cameras; err = system.GetCameras( cameras ); CameraPtr camera = cameras.at( 0 ); // For this example we just use the first listed camera err = camera->Open( VmbAccessModeFull ); FramePtrVector frames( 5 ); // A list of frames for streaming. We chose to queue 5 frames. IFrameObserverPtr observer( new FrameObserver( camera ) ); // Our implementation of a frame observer FeaturePtr feature; // Variable to hold features that need to be used VmbUint32_t payloadSize; // The payload size of one frame err = camera->GetPayloadSize( payloadSize ); for( FramePtrVector::iterator iter = frames.begin(); frames.end() != iter; ++iter ) { ( *iter ).reset( new Frame( payloadSize ) ); err = ( *iter )->RegisterObserver( observer ); err = camera->AnnounceFrame( *iter ); } err = camera->StartCapture(); for( FramePtrVector ::iterator iter = frames.begin(); frames.end() != iter; ++iter ) { err = camera->QueueFrame( *iter ); } err = camera->GetFeatureByName( "AcquisitionMode", feature ); err = feature->SetValue( "Continuous" ); err = camera->GetFeatureByName( "AcquisitionStart", feature ); err = feature->RunCommand(); // Program runtime ... // When finished , tear down the acquisition chain , close camera and API err = camera->GetFeatureByName( "AcquisitionStop", feature ); err = feature->RunCommand(); err = camera->EndCapture(); err = camera->FlushQueue(); err = camera->RevokeAllFrames(); err = camera->Close(); err = system.Shutdown(); } ``` -------------------------------- ### Initialize Vimba System and Get Cameras Source: https://docs.alliedvision.com/Vimba_X/Vimba_X_DeveloperGuide/pythonAPIManual Demonstrates how to initialize the Vimba X system and retrieve a list of all connected cameras using the VmbPy library. It utilizes a context manager for proper API startup and shutdown. ```python from vmbpy import * with VmbSystem.get_instance() as vmb: cams = vmb.get_all_cameras() ``` -------------------------------- ### Example: Transform BayerGR8 to Rgb8 Image Source: https://docs.alliedvision.com/Vimba_X/Vimba_X_DeveloperGuide/imagetransformManual This example demonstrates a complete image transformation process, converting a BayerGR8 image to an Rgb8 image. It includes initializing source and destination image structures, setting image information using helper functions, configuring debayering, and finally calling `VmbImageTransform()`. ```c VmbImage sourceImage; VmbImage destinationImage; VmbTransformInfo info; // Set size member for verification inside API sourceImage.Size = sizeof ( sourceImage ); destinationImage.Size = sizeof ( destinationImage ); // Attach the data buffers sourceImage.Data = pInBuffer; destinationImage.Data = pOutBuffer; // Fill image info from pixel format VmbSetImageInfoFromPixelFormat ( VmbPixelFormatBayerGR8 , 640, 480, &sourceImage ); // Fill destination image info from input image VmbSetImageInfoFromInputImage ( &sourceImage , VmbPixelLayoutRGB , 8, &destinationImage ); // Set the debayering algorithm to 2x2 VmbSetDebayerMode ( VmbDebayerMode2x2 , &info ); // Perform the transformation VmbImageTransform ( &sourceImage , &destinationImage , &info , 1 ); ``` -------------------------------- ### Basic Vimba X Camera Operation with VmbNET API Source: https://docs.alliedvision.com/Vimba_X/Vimba_X_DeveloperGuide/dotNetAPIManual Demonstrates fundamental Vimba X camera operations using the VmbNET API in C#. This includes API startup, camera retrieval, opening a camera, setting exposure time, registering for frame reception, and starting frame acquisition. The code utilizes the dispose pattern for automatic resource management. ```csharp using VmbNET; class Program { static void Main() { using var vmb = VmbSystem.Startup(); // API startup (loads transport layers) var cam = vmb.GetCameras()[0]; // Get the first available camera using var openCam = cam.Open(); // Open the camera openCam.Features.ExposureTime = 5000.0; // Set the exposure time value // Register an event handler for incoming frames openCam.FrameReceived += (s,e) => { using var frame = e.Frame; Console.WriteLine($"Frame Received! ID={frame.Id}"); }; // IDisposable: Frame is automatically requeued // Convenience function to start acquisition using var acquisition = openCam.StartFrameAcquisition(); Thread.Sleep(2000); } // IDisposable: Stops acquisition, closes camera, shuts down Vimba X } ``` -------------------------------- ### Asynchronous Image Acquisition Example (C++) Source: https://docs.alliedvision.com/Vimba_X/Vimba_X_DeveloperGuide/cppAPIManual A C++ example demonstrating asynchronous image acquisition using the Vimba X SDK. It includes setting up a frame observer to handle incoming frames and managing the camera's acquisition process. This code requires the VmbCPP library. ```cpp #include "VmbCPP/VmbCpp.h" using namespace VmbCPP; class FrameObserver : public IFrameObserver { public: FrameObserver( CameraPtr pCamera ); void FrameReceived( const FramePtr pFrame ); }; // Constructor for the FrameObserver class FrameObserver ::FrameObserver( CameraPtr pCamera ) : IFrameObserver( pCamera ) {} // Frame callback notifies about incoming frames void FrameObserver::FrameReceived( const FramePtr pFrame ) { // Send notification to working thread // Do not apply image processing within this callback (performance) // When the frame has been processed, requeue it m_pCamera->QueueFrame( pFrame ); } int main() { VmbErrorType err; // Every Vimba X function returns an error code that // should always be checked for VmbErrorSuccess (not done here for brevity) VmbSystem& system = VmbSystem::GetInstance(); err = system.Startup(); // Listing available cameras and selecting the one to use CameraPtrVector cameras; err = system.GetCameras( cameras ); CameraPtr camera = cameras.at( 0 ); // For this example we just use the first listed camera err = camera->Open( VmbAccessModeFull ); // Starting the acquisition err = camera->StartContinuousImageAcquisition(5, IFrameObserverPtr( new FrameObserver( camera ) ) ); // The camera is now acquiring images and for every recorded frame the // `FrameObserver::FrameReceived` function above is called. // Stopping the acquisition and shutting down the API err = camera->StopContinuousImageAcquisition(); err = system.Shutdown(); } ``` -------------------------------- ### Acquire Images (C) Source: https://docs.alliedvision.com/Vimba_X/Vimba_X_DeveloperGuide/genindex Provides examples for acquiring images from a camera using the Vimba X C API. This involves setting up image acquisition and retrieving image data. ```C // Acquiring images (C) // Image streaming (C) // synchronous image acquisition ``` -------------------------------- ### Manual Asynchronous Acquisition (C#) Source: https://docs.alliedvision.com/Vimba_X/Vimba_X_DeveloperGuide/dotNetAPIManual Illustrates manual asynchronous frame acquisition from a stream. It covers preparing the stream, handling frame reception events, starting and stopping acquisition, and cleaning up resources. ```csharp IStream stream = openCamera.Stream; // Open the first stream stream.FrameReceived += (s, e) => { IFrame frame = e.Frame; // Do something with frame // Requeue the instance of IFrame internally frame.Release(); }; IStreamCapture preparedStream = stream.PrepareCapture(AllocationModeValue.AnnounceFrame, 10); openCamera.Features.AcquisitionStart(); // Do something while acquiring (FrameReceived events can fire) openCamera.Features.AcquisitionStop(); // Reverse all steps involved in preparing a stream preparedStream.TearDown(); // Remove the registered event handler lambda function stream.RemoveAllFrameEventHandlers(); // Close the stream stream.Close(); ``` -------------------------------- ### Listing Features Source: https://docs.alliedvision.com/Vimba_X/Vimba_X_DeveloperGuide/dotNetAPIManual Demonstrates how to list all available features for a given camera after it has been opened, including accessing feature names. ```APIDOC ## Listing Features ### Description This example shows how to list all features available for a camera and its physical interface after the camera has been opened. It iterates through the features and prints their names. ### Method Feature Enumeration ### Endpoint N/A (In-process feature enumeration) ### Parameters N/A ### Request Example ```csharp using System.Linq; using System; using VmbNET; class Program { static void Main() { using var vmbSystem = IVmbSystem.Startup(); var camera = vmbSystem.GetCameras().First(); Console.WriteLine($"Using camera with ID {camera.Id}"); using var openCamera = camera.Open(); Console.WriteLine($"Camera has {openCamera.Features.Count} features"); foreach (var feature in openCamera.Features) { Console.WriteLine($"Camera has feature {feature.Name}"); } } } ``` ### Response #### Success Response (Features List) - **openCamera.Features** (List) - A list of `IFeature` objects representing the camera's features. - **feature.Name** (string) - The name of the feature. #### Response Example ``` Using camera with ID DEV_001 Camera has 50 features Camera has feature Width Camera has feature Height Camera has feature PixelFormat ... ``` ``` -------------------------------- ### Install VmbPy using pip Source: https://docs.alliedvision.com/Vimba_X/Vimba_X_DeveloperGuide/pythonAPIManual Installs the VmbPy Python package using pip. This method is recommended and provides the full Vimba X installation. Ensure pip or pip3 is available on your system. ```bash pip install # or for some Linux/macOS systems: pip3 install ``` -------------------------------- ### List Camera Features in C# Source: https://docs.alliedvision.com/Vimba_X/Vimba_X_DeveloperGuide/dotNetAPIManual Demonstrates how to list all features available for a given camera. It opens a camera, iterates through its features, and prints the name of each feature. ```csharp using System.Linq; using System; using VmbNET; class Program { static void Main() { using var vmbSystem = IVmbSystem.Startup(); var camera = vmbSystem.GetCameras().First(); Console.WriteLine($"Using camera with ID {camera.Id}"); using var openCamera = camera.Open(); Console.WriteLine($"Camera has {openCamera.Features.Count} features"); foreach (var feature in openCamera.Features) { Console.WriteLine($"Camera has feature {feature.Name}"); } } } ``` -------------------------------- ### Asynchronous Image Acquisition in Python Source: https://docs.alliedvision.com/Vimba_X/Vimba_X_DeveloperGuide/pythonAPIManual Demonstrates asynchronous image acquisition by registering a frame handler callback. The handler is executed for each incoming frame, allowing for non-blocking image processing. The example streams for 5 seconds. ```python # Asynchronous grab import time from vmbpy import * def frame_handler(cam: Camera, stream: Stream, frame: Frame): cam.queue_frame(frame) with VmbSystem.get_instance() as vmb: cams = vmb.get_all_cameras() with cams[0] as cam: cam.start_streaming(frame_handler) time.sleep(5) cam.stop_streaming() ``` -------------------------------- ### List Cameras (C) Source: https://docs.alliedvision.com/Vimba_X/Vimba_X_DeveloperGuide/genindex Shows how to list available cameras connected to the system using the Vimba X C API. This is typically the first step before interacting with a camera. ```C // code snippet Camera list notifications (C) // code snippet Getting camera list (C++) // code snippet List cameras (C) // Listing cameras (C) ``` -------------------------------- ### Register Camera and Interface Change Handlers in Python Source: https://docs.alliedvision.com/Vimba_X/Vimba_X_DeveloperGuide/pythonAPIManual Registers callbacks to log messages when cameras or interfaces are connected or disconnected. This example runs for 10 seconds and utilizes Vimba X's event handling system. ```python from time import sleep from vmbpy import * @ScopedLogEnable(LOG_CONFIG_INFO_CONSOLE_ONLY) def print_device_id(dev , state ): msg = 'Device: {}, State: {}'.format(str(dev), str(state )) Log.get_instance(). info(msg) with VmbSystem.get_instance() as vmb: vmb.register_camera_change_handler(print_device_id) vmb.register_interface_change_handler(print_device_id) sleep(10) ``` -------------------------------- ### API Entry Point and Camera Opening Source: https://docs.alliedvision.com/Vimba_X/Vimba_X_DeveloperGuide/dotNetAPIManual Shows how to initialize the Vimba X API using the `VmbSystem` singleton and open a camera for feature access and image acquisition. ```APIDOC ## Entry Point and Camera Opening ### Description The entry point of VmbNET is the `VmbSystem` singleton. Creating an instance of `IVmbSystem` starts up Vimba X. The `ICamera.Open()` method opens a camera, returning a disposable `IOpenCamera` instance for accessing features and acquiring frames. The camera is implicitly closed upon disposal of the `IOpenCamera` object. ### Method Initialization and Camera Opening ### Endpoint N/A (In-process API initialization and camera access) ### Parameters N/A ### Request Example ```csharp using VmbNET; class Program { static void Main() { using IVmbSystem vmbSystem = IVmbSystem.Startup(); ICamera camera = vmbSystem.GetCameras().First(); // Open the camera to use features and to acquire images using (IOpenCamera openCamera = camera.Open()) { // Use features and acquire images } // Closes the camera } // Shuts down Vimba X } ``` ### Response #### Success Response (Camera Opened) - **openCamera** (IOpenCamera) - An instance representing the opened camera, providing access to its features and image acquisition capabilities. #### Response Example (No direct response body, but the `openCamera` object is available for use.) ``` -------------------------------- ### Start Asynchronous Frame Acquisition with Specific Buffer Count (C#) Source: https://docs.alliedvision.com/Vimba_X/Vimba_X_DeveloperGuide/dotNetAPIManual Starts asynchronous frame acquisition from a specific stream, preparing capture with a specified allocation mode and buffer count. Acquisition is started and stopped via feature access. ```csharp using var stream = openCamera.OpenStream(0); stream.FrameReceived += (s, e) => { using var frame = e.Frame; // Do something with frame }; using var streamCapture = stream.PrepareCapture(AllocationModeValue.AllocAndAnnounceFrame, 5); openCamera.Features.AcquisitionStart(); // Do something while acquiring frames openCamera.Features.AcquisitionStop(); ``` -------------------------------- ### Initialize Vimba X and Open a Camera in C# Source: https://docs.alliedvision.com/Vimba_X/Vimba_X_DeveloperGuide/dotNetAPIManual Shows the entry point for VmbNET, initializing the Vimba X system and opening a camera for use. It demonstrates acquiring an ICamera object and opening it for feature access and image acquisition. ```csharp using VmbNET; class Program { using IVmbSystem vmbSystem = IVmbSystem.Startup(); ICamera camera = vmbSystem.GetCameras().First(); // Open the camera to use features and to acquire images using (IOpenCamera openCamera = camera.Open()) { // Use features and acquire images } } ``` -------------------------------- ### Initialize Vimba X with Specific Transport Layers (C++) Source: https://docs.alliedvision.com/Vimba_X/Vimba_X_DeveloperGuide/sdkManual Demonstrates how to initialize the Vimba X SDK using VmbStartup, specifying paths to individual transport layer (TL) .cti files or directories. This allows for custom configuration of which TLs are loaded, overriding the default VmbC.xml settings. It shows examples for loading a USB TL, a directory of GigE TLs, and multiple paths. ```cpp int main() { VmbError_t err = VmbErrorSuccess; const VmbFilePathChar_t* usbTLFilePath = L""; const VmbFilePathChar_t* gigeTLDirectoryPath = L""; const VmbFilePathChar_t* multiplePaths = L"";""; err = VmbStartup(usbTLFilePath) } ``` -------------------------------- ### Start Asynchronous Frame Acquisition with Event Handler (C#) Source: https://docs.alliedvision.com/Vimba_X/Vimba_X_DeveloperGuide/dotNetAPIManual Starts asynchronous frame acquisition using convenience methods and registers an event handler for received frames. The API allocates frame buffers by default. Returns a disposable IAcquisition object to stop acquisition. ```csharp openCamera.FrameReceived += (s, e) => { using var frame = e.Frame; // Do something with frame }; using IAcquisition acquisition = openCamera.StartFrameAcquisition(); // Do something while acquiring ``` -------------------------------- ### Get Frame Pixel Format (C#) Source: https://docs.alliedvision.com/Vimba_X/Vimba_X_DeveloperGuide/dotNetAPIManual Retrieves the pixel format of an acquired frame using the PixelFormat property of type IFrame.PixelFormatValue. ```csharp IFrame.PixelFormatValue framePixelFormat = frame.PixelFormat; ``` -------------------------------- ### Set Camera Pixel Format (C#) Source: https://docs.alliedvision.com/Vimba_X/Vimba_X_DeveloperGuide/dotNetAPIManual Sets the pixel format of the camera using the PixelFormat string feature. Example shown is for setting to RGB8. ```csharp openCamera.Features.PixelFormat = "RGB8"; ``` -------------------------------- ### Create Persistent Network Buffer Configuration (XML/Plist) Source: https://docs.alliedvision.com/Vimba_X/Vimba_X_DeveloperGuide/settings This XML property list (plist) file defines a launch daemon that will apply persistent network buffer settings upon system startup. It configures `kern.ipc.maxsockbuf` and `net.inet.udp.recvspace`. ```xml Label sysctl ProgramArguments /usr/sbin/sysctl -w kern.ipc.maxsockbuf=67108864 net.inet.udp.recvspace=33554432 RunAtLoad ``` -------------------------------- ### Open Camera (C) Source: https://docs.alliedvision.com/Vimba_X/Vimba_X_DeveloperGuide/genindex Provides code examples for opening a camera connection using the Vimba X C API. This function is used to establish communication with a specific camera. ```C // code snippet Open camera (C) // open camera (C) ``` -------------------------------- ### Initialize Vimba X API and Query Version (C++) Source: https://docs.alliedvision.com/Vimba_X/Vimba_X_DeveloperGuide/sdkManual This C++ code snippet demonstrates how to initialize the Vimba X system, query its version, and print it to the console. It requires the VmbCPP header and links against the Vimba X C++ API. ```cpp #include #include "VmbCPP/VmbCPP.h" int main() { std::cout << "Hello Vimba X" << std::endl; VmbCPP::VmbSystem& sys = VmbCPP::VmbSystem::GetInstance(); VmbVersionInfo_t version; if (VmbErrorSuccess == sys.QueryVersion(version )) { std::cout << "Version:" << version.major << "." << version.minor << std::endl; } getchar (); return 0; } ``` -------------------------------- ### Get VmbC API Version in C# Source: https://docs.alliedvision.com/Vimba_X/Vimba_X_DeveloperGuide/dotNetAPIManual Demonstrates how to retrieve the version number of the underlying VmbC API without initializing the VmbNET API. This ensures backward compatibility. ```csharp using VmbNET; class Program { static void Main() { Console.WriteLine($"VmbC version: {IVmbSystem.VmbCVersion}"); } } ``` -------------------------------- ### Initialize Image Information for Transformation Source: https://docs.alliedvision.com/Vimba_X/Vimba_X_DeveloperGuide/imagetransformManual Several helper functions assist in initializing `VmbImage` structs for transformations. These include setting image info from an input image, input parameters, a pixel format string, or directly from a `VmbPixelFormat_t` value. ```c VmbSetImageInfoFromInputImage ( &sourceImage , VmbPixelLayoutRGB , 8, &destinationImage ); ``` ```c VmbSetImageInfoFromPixelFormat ( VmbPixelFormatBayerGR8 , 640, 480, &sourceImage ); ``` -------------------------------- ### Save and Load Camera Settings Source: https://docs.alliedvision.com/Vimba_X/Vimba_X_DeveloperGuide/dotNetAPIManual Provides an example of saving camera feature settings to an XML file and subsequently loading them back. This is useful for configuration management and backup. The `IPersistableFeatureContainer` interface is key for this functionality. ```csharp FeaturePersistSettings featurePersistSettings = new() { LogLevel = FeaturePersistSettings.LogLevelValue.Trace, MaximumIterations = 2, Modules = FeaturePersistSettings.ModuleValues.Camera | FeaturePersistSettings.ModuleValues.TransportLayer, Type = FeaturePersistSettings.TypeValue.NoLUT }; openCamera.SaveSettings("temp.xml", featurePersistSettings); openCamera.LoadSettings("temp.xml", featurePersistSettings); ``` -------------------------------- ### Adding Vimba X NuGet Package Source Source: https://docs.alliedvision.com/Vimba_X/Vimba_X_DeveloperGuide/dotNetAPIManual Provides the command to add the Vimba X SDK's NuGet package source to your project. This is a prerequisite for installing the VmbNET NuGet package, which is necessary for Vimba X development. ```bash dotnet nuget add source ``` -------------------------------- ### Get Camera List using Vimba C++ API Source: https://docs.alliedvision.com/Vimba_X/Vimba_X_DeveloperGuide/cppAPIManual This C++ code snippet demonstrates how to initialize the Vimba system, retrieve a list of connected cameras, and print their names. It handles potential errors during system startup and camera retrieval. The `VmbSystem::GetInstance()` and `VmbSystem::Startup()` functions are used for initialization, followed by `VmbSystem::GetCameras()` to fetch the camera list. ```cpp std::string name; CameraPtrVector cameras; VmbSystem& system = VmbSystem::GetInstance(); if( VmbErrorSuccess == system.Startup() ) { if( VmbErrorSuccess == system.GetCameras( cameras ) ) { for( CameraPtrVector::iterator iter = cameras.begin(); cameras.end() != iter; ++iter ) { if( VmbErrorSuccess == ( *iter )->GetName( name ) ) { std::cout << name << std::endl; } } } } ``` -------------------------------- ### Enable Warning Logging to Console (Python) Source: https://docs.alliedvision.com/Vimba_X/Vimba_X_DeveloperGuide/pythonAPIManual This snippet demonstrates how to enable logging at the WARNING level and direct all messages to the console using the Vimba X Python API. It shows how to instantiate VmbSystem, enable logging, and then log messages at different levels, with only WARNING and above being visible. Finally, it disables logging. ```python from vmbpy import * with VmbSystem.get_instance() as vmb: vmb.enable_log(LOG_CONFIG_WARNING_CONSOLE_ONLY) log = Log.get_instance() log.critical('Critical, visible') log.error('Error, visible') log.warning('Warning , visible') log.info('Info, invisible') log.trace('Trace, invisible') vmb.disable_log() ``` -------------------------------- ### Check Feature Existence and Access Temperature in C# Source: https://docs.alliedvision.com/Vimba_X/Vimba_X_DeveloperGuide/dotNetAPIManual Shows how to safely access camera features by first checking their existence using the 'Exists' property. This example specifically checks for 'DeviceTemperatureSelector' and its 'Mainboard' entry before attempting to read the device's mainboard temperature. ```csharp // Print the mainboard temperature to the console if the device provides the corresponding feature, otherwise print nothing if(openCamera.Features.DeviceTemperatureSelector.Exists && (bool)openCamera.Features.DeviceTemperatureSelector.EnumEntriesByName.ContainsKey("Mainboard")) { openCamera.Features.DeviceTemperatureSelector = "Mainboard"; double mainboardTemperature = openCamera.Features.DeviceTemperature; Console.WriteLine($"The temperature of this device's mainboard temperature is {mainboardTemperature} degrees C"); } ```