### VmbNET API Entry Point and Camera Initialization (C#) Source: https://docs.alliedvision.com/Vimba_X/Vimba_X_DeveloperGuide/dotNetAPIManual Illustrates the entry point of the VmbNET API, the `VmbSystem` singleton. It shows how to start Vimba X, get a list of cameras, select the first available camera, and open it for feature access and image acquisition. The `IOpenCamera` is disposed to automatically close the camera. ```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 } // Closes the camera } // Shuts down Vimba X ``` -------------------------------- ### CMake: Build Vimba C and C++ Examples on Unix Source: https://docs.alliedvision.com/Vimba_X/Vimba_X_DeveloperGuide/sdkManual This CMake configuration uses Unix Makefiles to build the Vimba C and C++ example projects. It assumes Vimba X is installed in the user's home directory and specifies the API directory to locate the examples. ```cmake # 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 ``` -------------------------------- ### Building VmbNET Examples via Command Line (Bash) Source: https://docs.alliedvision.com/Vimba_X/Vimba_X_DeveloperGuide/dotNetAPIManual Provides the command-line instruction to build VmbNET examples. It requires a .NET SDK and the VmbNET NuGet package. The command specifies the example name, NuGet source, and the path to the local VmbNET package. ```bash // Building the VmbNET examples with the command line dotnet build --source "https://api.nuget.org/v3/index.json" --source ``` -------------------------------- ### Asynchronous Image Acquisition Example Source: https://docs.alliedvision.com/Vimba_DeveloperGuide/cppAPIManual A minimalistic C++ example demonstrating asynchronous image acquisition using the Vimba API. ```APIDOC ## Asynchronous Image Acquisition Example ### Description This code snippet provides a basic implementation of asynchronous image acquisition using the Vimba C++ API. It demonstrates the setup, capture, and cleanup process. ### Method C++ ### Code ```cpp #include "Vimba.h" namespace AVT { namespace VmbAPI { // 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 ); } void Vimba :: RunExample(void) { VmbInt64_t nPLS; // Payload size value FeaturePtr pFeature; // Generic feature pointer VimbaSystem &sys = VimbaSystem :: GetInstance (); // Create and get Vimba singleton CameraPtrVector cameras; // Holds camera handles CameraPtr camera; FramePtrVector frames (15); // Frame array // Start the API, get and open cameras sys.Startup (); sys.GetCameras(cameras ); camera = cameras [0]; camera ->Open(VmbAccessModeFull ); // Get the image size for the required buffer // Allocate memory for frame buffer // Register frame observer/callback for each frame // Announce frame to the API camera ->GetFeatureByName("PayloadSize", pFeature ); pFeature ->GetValue(nPLS); for(FramePtrVector :: iterator iter=frames.begin (); frames.end ()!= iter; ++iter) { (*iter). reset(new Frame(nPLS )); (*iter)->RegisterObserver(IFrameObserverPtr(new FrameObserver(camera ))); camera ->AnnounceFrame (*iter); } // Start the capture engine (API) camera ->StartCapture (); for(FramePtrVector :: iterator iter=frames.begin (); frames.end ()!= iter; ++iter) { // Put frame into the frame queue camera ->QueueFrame (*iter); } // Start the acquisition engine (camera) camera ->GetFeatureByName("AcquisitionStart", pFeature ); pFeature ->RunCommand (); // Program runtime , e.g., Sleep (2000); // Stop the acquisition engine (camera) camera ->GetFeatureByName("AcquisitionStop", pFeature ); pFeature ->RunCommand (); // Stop the capture engine (API) // Flush the frame queue // Revoke all frames from the API camera ->EndCapture (); camera ->FlushQueue (); camera ->RevokeAllFrames (); for(FramePtrVector :: iterator iter=frames.begin (); frames.end ()!= iter; ++iter) { // Unregister the frame observer/callback (*iter)->UnregisterObserver (); } camera ->Close (); sys.Shutdown (); // Always pair sys.Startup and sys.Shutdown } }} // namespace AVT::VmbAPI ``` ### Notes - The `FrameObserver::FrameReceived` callback should not perform heavy image processing to maintain performance. Frames should be requeued after processing. - `VimbaSystem::Shutdown` blocks until all callbacks have finished execution. - Certain functions, like `Feature::SetValue` and camera control functions, must not be called within a feature observer callback. ``` -------------------------------- ### Building VmbNET Examples Source: https://docs.alliedvision.com/Vimba_X/Vimba_X_DeveloperGuide/dotNetAPIManual Instructions for building VmbNET examples using the command line with .NET SDK and Visual Studio. ```APIDOC ## Building VmbNET Examples ### Description Instructions on how to build the VmbNET examples using either the command line with the .NET SDK or through Visual Studio. ### Method Command Line Build ### Endpoint N/A ### Parameters #### Command Line Arguments - **``**: The name of the example directory to build. - **`--source "https://api.nuget.org/v3/index.json"`**: Specifies the NuGet API endpoint. - **`--source `**: Specifies the local path to the VmbNET NuGet package file. ### Request Example (Command Line) ```bash dotnet build --source "https://api.nuget.org/v3/index.json" --source ``` ### Visual Studio Setup - **Properties > Application > Target Framework**: Select an installed .NET framework version. ### Visual Studio Code Setup - Install the **C# Dev Kit** extension from Microsoft: https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csdevkit ``` -------------------------------- ### Install Vimba .NET API (32-bit) Source: https://docs.alliedvision.com/Vimba_DeveloperGuide/sdkManual Installs the Vimba .NET API for 32-bit systems using msiexec. This command installs the necessary Visual C++ Redistributables, core Vimba components, the Vimba .NET API core, image transformation functionalities, and the Vimba driver. ```bash msiexec -i Vimba_Win32.msi ADDLOCAL="VCRedist90,VCRedist100, VCRedist100_MFC,Vimba_Core,VimbaNET_Core,VimbaImageTransform_Core,Vimba_DrvInst" ``` -------------------------------- ### Start Frame Capturing with VmbCaptureStart Source: https://docs.alliedvision.com/Vimba_X/VmbC_Function_Reference/cAPIReference Prepares the API for incoming frames by starting the capture process. Ensure VmbStartup() has been called prior to this. This function can return various error codes if called incorrectly or if the handle is invalid. ```c IMEXPORTC VmbError_t VMB_CALL VmbCaptureStart (VmbHandle_t handle) Prepare the API for incoming frames. Parameters: * **handle** – **[in]** Handle for a camera or a stream Return values: * **VmbErrorSuccess** – If no error * **VmbErrorInvalidCall** – If called from a frame callback or a chunk access callback * **VmbErrorApiNotStarted** – VmbStartup() was not called before the current command * **VmbErrorBadHandle** – The given handle is not valid; this includes the camera no longer being open * **VmbErrorInvalidAccess** – Operation is invalid with the current access mode * **VmbErrorMoreData** – The buffer size of the announced frames is insufficient * **VmbErrorInsufficientBufferCount** – The operation requires more buffers to be announced; see the StreamAnnounceBufferMinimum stream feature * **VmbErrorAlready** – Capturing was already started Returns: An error code indicating success or the type of error that occurred. ``` -------------------------------- ### Start and Stop Image Acquisition Stream - C++ Source: https://docs.alliedvision.com/Vimba_X/Vimba_X_DeveloperGuide/cppAPIManual This C++ code snippet demonstrates the setup and teardown of an image acquisition stream using the Vimba X SDK. It covers camera initialization, frame announcement, starting capture, setting acquisition mode to continuous, starting acquisition, stopping acquisition, and finally shutting down the system. Error handling 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(); } ``` -------------------------------- ### C++ Vimba API Image Streaming Example Source: https://docs.alliedvision.com/Vimba_DeveloperGuide/cppAPIManual This C++ code snippet demonstrates a simplified image streaming process using the Vimba API. It includes setting up cameras, announcing and queuing frames, starting capture, and stopping acquisition. Error handling is omitted for brevity. ```cpp VmbErrorType err; // Every Vimba function returns an error code that // should always be checked for VmbErrorSuccess VimbaSystem &sys; // A reference to the VimbaSystem singleton CameraPtrVector cameras; // A list of known cameras FramePtrVector frames( 3 ); // A list of frames for streaming. We chose // to queue 3 frames. IFrameObserverPtr pObserver( new MyFrameObserver () ); // Our implementation // of a frame observer FeaturePtr pFeature; // Any camera feature VmbInt64_t nPLS; // The payload size of one frame sys = VimbaSystem :: GetInstance (); err = sys.Startup (): err = sys.GetCameras( cameras ); err = cameras [0]->Open( VmbAccessModeFull ); err = cameras [0]-> GetFeatureByName( "PayloadSize", pFeature ); (A) err = pFeature ->GetValue( nPLS ) (A) for ( FramePtrVector :: iterator iter = frames.begin (); frames.end() != iter; ++iter ) { ( *iter ). reset( new Frame( nPLS ) ); (B) err = ( *iter )->RegisterObserver( pObserver ) ); (C) err = cameras [0]-> AnnounceFrame( *iter ); (1) } err = cameras [0]-> StartCapture (); (2) for ( FramePtrVector :: iterator iter = frames.begin (); frames.end() != iter; ++iter ) { err = cameras [0]-> QueueFrame( *iter ); (3) } err = GetFeatureByName( "AcquisitionStart", pFeature ); (4) err = pFeature ->RunCommand (); (4) // Program runtime ... // When finished , tear down the acquisition chain , close camera and API err = GetFeatureByName( "AcquisitionStop", pFeature ); err = pFeature ->RunCommand (); err = cameras [0]-> EndCapture (); err = cameras [0]-> FlushQueue (); err = cameras [0]-> RevokeAllFrames (); err = cameras [0]->Close (); err = sys.Shutdown (); ``` -------------------------------- ### Install Vimba C API (32-bit) Source: https://docs.alliedvision.com/Vimba_DeveloperGuide/sdkManual Installs the Vimba C API for 32-bit systems using msiexec. This command installs necessary Visual C++ Redistributables, the core Vimba components, the Vimba C API core, image transformation functionalities, and the Vimba driver. ```bash msiexec -i Vimba_Win32.msi ADDLOCAL="VCRedist90,VCRedist100, VCRedist100_MFC,Vimba_Core,VimbaC_Core,VimbaImageTransform_Core,Vimba_DrvInst" ``` -------------------------------- ### Install Vimba C++ API (32-bit) Source: https://docs.alliedvision.com/Vimba_DeveloperGuide/sdkManual Installs the Vimba C++ API for 32-bit systems using msiexec. This installation includes required Visual C++ Redistributables, core Vimba components, the Vimba C++ API core, image transformation functionalities, and the Vimba driver. ```bash msiexec -i Vimba_Win32.msi ADDLOCAL="VCRedist90,VCRedist100, VCRedist100_MFC,Vimba_Core,VimbaCPP_Core,AvtImageTransform_Core,Vimba_DrvInst" ``` -------------------------------- ### Install Vimba USB Transport Layer (32-bit) Source: https://docs.alliedvision.com/Vimba_DeveloperGuide/sdkManual Installs the Vimba USB Transport Layer module for 32-bit systems using msiexec. This installation includes the Visual C++ Redistributable, registers the GenICam path variable, and installs the core USB Transport Layer components. ```bash msiexec -i VimbaUSBTL_Win32.msi ADDLOCAL="VCRedist100,USBTL_RegisterGenICamPathVariable,USBTL_Core" ``` -------------------------------- ### Full Camera Feature Control Example (C#) Source: https://docs.alliedvision.com/Vimba_X/Vimba_X_DeveloperGuide/dotNetAPIManual A comprehensive example showcasing the initialization of Vimba X, camera selection, opening a camera, and manipulating exposure time using both dynamic and static feature access. This snippet integrates multiple feature control operations. ```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; } } ``` -------------------------------- ### Install Vimba CL Config Transport Layer (32-bit) Source: https://docs.alliedvision.com/Vimba_DeveloperGuide/sdkManual Installs the Vimba Camera Link Configuration Transport Layer module for 32-bit systems using msiexec. This installation includes the Visual C++ Redistributable, registers the GenICam path variable, and installs the core CL Config Transport Layer components. ```bash msiexec -i VimbaCLConfigTL_Win32.msi ADDLOCAL="VCRedist100,CLConfigTL_RegisterGenICamPathVariable,CLConfigTL_Core" ``` -------------------------------- ### Install Vimba 1394 Transport Layer (32-bit) Source: https://docs.alliedvision.com/Vimba_DeveloperGuide/sdkManual Installs the Vimba 1394 (FireWire) Transport Layer module for 32-bit systems using msiexec. This process installs the Visual C++ Redistributable, registers the GenICam path variable, and installs the core FireWire Transport Layer components. ```bash msiexec -i Vimba1394TL_Win32.msi ADDLOCAL="VCRedist100,FireWireTL_RegisterGenICamPathVariable,FireWireTL_Core" ``` -------------------------------- ### VmbSystem Context Management Source: https://docs.alliedvision.com/Vimba_X/VmbPy_Function_Reference/VmbSystem Allows VmbSystem to be used with a 'with' context for automatic setup and teardown. ```APIDOC ## CONTEXT /_vmbpy.VmbSystem ### Description This class allows access to the entire Vimba X System. VmbSystem is meant be used in conjunction with the `with` context. Upon entering the context, all system features, connected cameras and interfaces are detected and can be used. ### Method Context Manager (`with` statement) ### Endpoint N/A (Class-based context) ### Parameters None ### Request Example ```python import vmbpy with vmbpy.VmbSystem() as system: # Access system features here pass ``` ### Response #### Success Response (Context Entry) - System features, cameras, and interfaces are detected and available. #### Response Example ```json { "example": "System initialized and ready for use within the 'with' block." } ``` ``` -------------------------------- ### Asynchronous Image Acquisition Example in C++ Source: https://docs.alliedvision.com/Vimba_X/Vimba_X_DeveloperGuide/cppAPIManual A minimalistic example demonstrating asynchronous image acquisition using the Vimba C++ API. It includes setting up a frame observer to handle incoming frames and managing the acquisition lifecycle. Ensure the Vimba C++ library is linked correctly. ```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(); } ``` -------------------------------- ### CMake: Build Vimba C and C++ Examples on Windows Source: https://docs.alliedvision.com/Vimba_X/Vimba_X_DeveloperGuide/sdkManual This CMake command sequence is used to configure and build the Vimba C and Vimba C++ example projects on a Windows system. It specifies the x64 architecture and the source and build directories for both C and C++ examples. ```cmake # 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 ``` -------------------------------- ### Extract Vimba MSI Files from Executable Source: https://docs.alliedvision.com/Vimba_DeveloperGuide/sdkManual This command extracts all necessary Microsoft Installer (MSI) files from the Vimba setup executable. These MSIs are required for manual installation of Vimba components on a target machine. The extraction process does not install any software. ```bash Vimba.exe /extract. ``` -------------------------------- ### StartCapture API Source: https://docs.alliedvision.com/Vimba_X/VmbCPP_Function_Reference/cppAPIReference Prepares the API for incoming frames from the camera. ```APIDOC ## StartCapture ### Description Prepare the API for incoming frames from this camera. ### Method POST (Conceptual, as this is a C++ interface method) ### Endpoint N/A (This is an interface method, not a REST endpoint) ### Parameters None ### Request Example ```cpp // Example usage in C++ VmbErrorType result = capturingModule.StartCapture(); ``` ### Response #### Success Response (VmbErrorSuccess) - **VmbErrorType** - VmbErrorSuccess: If no error #### Error Responses - **VmbErrorApiNotStarted**: VmbStartup() was not called before the current command - **VmbErrorBadHandle**: The given handle is not valid - **VmbErrorDeviceNotOpen**: Camera was not opened for usage - **VmbErrorInvalidAccess**: Operation is invalid with the current access mode #### Response Example ```cpp // Example response handling in C++ VmbErrorType result = capturingModule.StartCapture(); if (result == VmbErrorSuccess) { // Capture started successfully } else { // Handle error } ``` ``` -------------------------------- ### Get Transport Layer Type (Python) Source: https://docs.alliedvision.com/Vimba_X/VmbPy_Function_Reference/TransportLayer Retrieves the type of the Transport Layer, for example, `TransportLayerType.GEV`. The returned value indicates the protocol or technology used by the layer. ```Python from vmbpy import TransportLayer, TransportLayerType transport_layer: TransportLayer # Assume initialized tl_type = transport_layer.get_type() print(f"Transport Layer Type: {tl_type}") ``` -------------------------------- ### Get Transport Layer Model Name (Python) Source: https://docs.alliedvision.com/Vimba_X/VmbPy_Function_Reference/TransportLayer Returns the model name of the Transport Layer, for example, 'GigETL'. This method is straightforward and does not require special context. ```Python from vmbpy import TransportLayer transport_layer: TransportLayer # Assume initialized model_name = transport_layer.get_model_name() print(f"Transport Layer Model Name: {model_name}") ``` -------------------------------- ### Get and Set Pixel Formats using Camera Class Methods in Python Source: https://docs.alliedvision.com/Vimba_DeveloperGuide/pythonAPIManual Illustrates how to retrieve and modify a camera's pixel format before starting image acquisition. It shows methods for getting supported formats, the current format, and setting a new format. Note that the pixel format cannot be changed during active image acquisition. ```python # Camera class methods for getting and setting pixel formats # Apply these methods before starting image acquisition get_pixel_formats () # returns a tuple of all pixel formats supported by the camera get_pixel_format () # returns the current pixel format set_pixel_format(fmt) # enables you to set a new pixel format ``` -------------------------------- ### Get Camera List using VimbaSystem C++ Source: https://docs.alliedvision.com/Vimba_DeveloperGuide/cppAPIManual This snippet demonstrates how to initialize the Vimba system, retrieve a list of connected cameras, and print their names. It includes error handling for system startup and camera retrieval. Ensure Vimba C++ API is linked. ```cpp std:: string name; CameraPtrVector cameras; VimbaSystem &system = VimbaSystem :: 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; } } } } ``` -------------------------------- ### Get Specific Interface by ID Source: https://docs.alliedvision.com/Vimba_X/VmbCPP_Function_Reference/cppAPIReference Retrieves a specific interface identified by its ID. The ID is typically obtained from the GetInterfaces() function. Handles potential errors like API not started or invalid parameters. ```cpp IMEXPORT VmbErrorType GetInterfaceByID (const char *pID, InterfacePtr &pInterface) Gets a specific interface identified by an ID. An interface known via a GenTL is listed by this command and filled into the pointer provided. Interface can be an adapter card or a frame grabber card, for instance. Parameters: * **pID** – **[in]** The ID of the interface to get (returned by GetInterfaces()) * **pInterface** – **[out]** Shared pointer to Interface object Return values: * **VmbErrorSuccess** – If no error * **VmbErrorApiNotStarted** – VmbStartup() was not called before the current command * **VmbErrorBadParameter** – `pID` is null. * **VmbErrorStructSize** – The given struct size is not valid for this API version * **VmbErrorMoreData** – More data were returned than space was provided Returns: VmbErrorType ``` ```cpp VmbErrorType GetInterfaceByID(std::nullptr_t, InterfacePtr&) = delete null is not allowed as interface id parameter ``` ```cpp template inline std::enable_if::IsCStringLike, VmbErrorType>::type GetInterfaceByID(const T &id, InterfacePtr &pInterface) Convenience function for calling GetInterfaceByID(char const*, InterfacePtr&) with `id` converted to `const char*`. This is a convenience function for calling `GetInterfaceById(CStringLikeTraits::ToString(id), pInterface)`. Types other than std::string may be passed to this function, if CStringLikeTraits is specialized before including this header. Template Parameters: **T** – a type that is considered to be a c string like ``` -------------------------------- ### Image Acquisition (C++) Source: https://docs.alliedvision.com/Vimba_X/Vimba_X_DeveloperGuide/genindex Provides a basic example of acquiring a single image using the Vimba C++ API. This involves setting up image buffers, starting streaming, and retrieving frames. ```cpp #include #include "/path/to/vimba_cpp/include/VimbaCPP/Include/VimbaCPP.h" // Assume pCamera is a valid ICameraPtr object obtained from OpenCamera void acquireImage(const ICameraPtr& pCamera) { VmbErrorType err; // Set up frame generation and caching err = pCamera->StartContinuousImageAcquisition(10); if (err != VmbErrorSuccess) { std::cerr << "Failed to start continuous image acquisition: " << static_cast(err) << std::endl; return; } std::vector frameList; err = pCamera->GetFrameQueue(10, frameList, 1000); // Wait up to 1 second for frames if (err == VmbErrorSuccess && !frameList.empty()) { FramePtr frame = frameList[0]; if (frame->GetImageStatus() == VmbFrameStatus::VmbFrameStatusComplete) { std::cout << "Acquired image with size: " << frame->GetWidth() << "x" << frame->GetHeight() << std::endl; // Process the image data (frame->GetImageBuffer()) } } else { std::cerr << "Failed to get frame or timeout: " << static_cast(err) << std::endl; } pCamera->StopContinuousImageAcquisition(); } ``` -------------------------------- ### Basic Vimba C++ Hello World in Visual Studio Source: https://docs.alliedvision.com/Vimba_DeveloperGuide/sdkManual This C++ code snippet demonstrates a basic 'Hello Vimba' program. It initializes the Vimba system, queries the Vimba version, and prints it to the console. It requires the VimbaCPP header files and links against the Vimba library. ```cpp #include "stdafx.h" #include #include "VimbaCPP/Include/VimbaCPP.h" using namespace AVT:: VmbAPI; int _tmain(int argc , _TCHAR* argv []) { std::cout << "Hello Vimba" << std::endl; VimbaSystem& sys = VimbaSystem :: GetInstance (); VmbVersionInfo_t version; if (VmbErrorSuccess == sys.QueryVersion(version )) { std::cout << "Version:" << version.major << "." << version.minor << std::endl; } getchar (); return 0; } ``` -------------------------------- ### Open All Cameras with Full Access (C++) Source: https://docs.alliedvision.com/Vimba_DeveloperGuide/cppAPIManual This snippet demonstrates how to initialize the Vimba system, retrieve a list of connected cameras, and open each camera with full read and write access. It iterates through the camera list and attempts to open each one. Successful opening is indicated by a console output. Dependencies include the Vimba C++ API. ```cpp CameraPtrVector cameras; VimbaSystem &system = VimbaSystem :: GetInstance (); if ( VmbErrorSuccess == system.Startup () ) { if ( VmbErrorSuccess == system.GetCameras( cameras ) ) { for ( CameraPtrVector :: iterator iter = cameras.begin (); cameras.end() != iter; ++iter ) { if ( VmbErrorSuccess == (*iter)->Open( VmbAccessModeFull ) ) { std::cout << "Camera opened" << std::endl; } } } } ``` -------------------------------- ### Listing Camera Features with VmbNET (C#) Source: https://docs.alliedvision.com/Vimba_X/Vimba_X_DeveloperGuide/dotNetAPIManual Demonstrates how to list all features of a camera and its local device. It starts the VmbSystem, gets the first detected camera, opens it, and then iterates through its features, printing the name of each feature. This requires the camera to be opened using `IOpenCamera`. ```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 Capture Steps Source: https://docs.alliedvision.com/Vimba_DeveloperGuide/cppAPIManual Detailed step-by-step guide for performing asynchronous image capture using the C++ API. ```APIDOC ## Asynchronous Image Capture ### Description Manual steps for asynchronous image capture when highest performance is required. ### Method (Sequence of C++ API calls) ### Endpoint N/A (C++ API steps) ### Parameters - **PayloadSize** (feature) - Query buffer size. - **IFrameObserver** (type) - Observer for completed frames. ### Steps 1. Open the camera. 2. Query buffer size via `PayloadSize` and allocate frames. 3. Announce the frames. 4. Start the capture engine (`Camera::StartCapture`). 5. Queue the frame buffer (`Camera::QueueFrame`). 6. Register a frame observer (`IFrameObserver`). - Within the observer, queue the frame again after processing. 7. Stop the capture engine (`Camera::EndCapture`). 8. Flush the queue (`Camera::FlushQueue`). 9. Revoke frames (`Camera::RevokeAllFrames`). ### Request Example (Illustrative) ```cpp // 1. Open Camera // ... // 2. Allocate Frames // ... uint32_t payloadSize = camera->GetFeature("PayloadSize") // ... FramePtrs frames(numFrames); // ... for (auto& frame : frames) { frame = std::make_shared(); frame->AllocAndInit(payloadSize); } // 3. Announce Frames // ... for (const auto& frame : frames) { camera->AnnounceFrame(frame); } // 4. Start Capture Engine // ... camera->StartCapture(); // 5. Queue Frame // ... camera->QueueFrame(frames[0]); // 6. Register Frame Observer // ... camera->RegisterFrameObserver(myFrameObserver); // ... Acquisition starts and frames are processed via observer ... // 7. Stop Capture Engine // ... camera->EndCapture(); // 8. Flush Queue // ... camera->FlushQueue(); // 9. Revoke Frames // ... camera->RevokeAllFrames(); ``` ### Response - **VmbFrameStatusComplete** (enum) - Status indicating successful frame reception. ``` -------------------------------- ### Camera Pixel Format Management in Python Source: https://docs.alliedvision.com/Vimba_X/Vimba_X_DeveloperGuide/pythonAPIManual Provides an overview of methods for getting and setting pixel formats on a camera before image acquisition starts. It highlights the use of convenience functions over direct feature access and mentions pixel format conversion after acquisition. ```python # Camera class methods for getting and setting pixel formats # Apply these methods before starting image acquisition get_pixel_formats() # returns a tuple of all pixel formats supported by the camera get_pixel_format() # returns the current pixel format set_pixel_format(fmt) # enables you to set a new pixel format ``` -------------------------------- ### Asynchronous Image Acquisition in Python Source: https://docs.alliedvision.com/Vimba_DeveloperGuide/pythonAPIManual Demonstrates asynchronous image acquisition by registering a frame handler callable. This callable is executed for each incoming frame. The example starts streaming, waits for 5 seconds, and then stops streaming. For high performance, keep the handler function concise. ```python # Asynchronous grab import time from vimba import* def frame_handler(cam , frame ): cam.queue_frame(frame) with Vimba.get_instance () as vimba: cams = vimba.get_all_cameras () with cams [0] as cam: cam.start_streaming(frame_handler) time.sleep (5) cam.stop_streaming () ``` -------------------------------- ### Start Camera Capture Source: https://docs.alliedvision.com/Vimba_X/VmbCPP_Function_Reference/cppAPIReference Prepares the API to receive frames from a camera. This function is essential before initiating image acquisition. It works with the first available stream on the camera. Ensure VmbStartup() has been called prior to this. ```c++ virtual IMEXPORT VmbErrorType StartCapture () override ``` -------------------------------- ### Retrieve Camera List using VmbSystem C++ Source: https://docs.alliedvision.com/Vimba_X/Vimba_X_DeveloperGuide/cppAPIManual This C++ code snippet demonstrates how to initialize the VmbSystem, retrieve a list of connected cameras, and print their names. It includes error handling for initialization and camera retrieval. The `VmbSystem::GetInstance()` ensures a singleton instance, and `VmbSystem::Startup()` must be called before accessing cameras. ```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; } } } } ``` -------------------------------- ### Install VimbaPython with Optional Features Source: https://docs.alliedvision.com/Vimba_DeveloperGuide/pythonAPIManual Installs the VimbaPython package. The first command installs the basic package, while the second installs it with optional NumPy and OpenCV export capabilities. These commands are executed in a terminal. ```shell python -m pip install . ``` ```shell python -m pip install .[numpy-export,opencv-export] ``` -------------------------------- ### Set Path Configuration for VmbStartup - Python Source: https://docs.alliedvision.com/Vimba_X/VmbPy_Function_Reference/VmbSystem Configures the search path for GenICam Transport Layer (TL) .cti files and configuration XMLs for VmbStartup. This is optional and can be overridden by environment variables. It allows for setting the configuration while entering the VmbSystem with context. ```python with vmbpy.VmbSytem.get_instance().set_path_configuration('/foo', '/bar'): # do something ``` -------------------------------- ### Manual Synchronous Acquisition C# Source: https://docs.alliedvision.com/Vimba_X/Vimba_X_DeveloperGuide/dotNetAPIManual Provides an example of manual synchronous frame acquisition. It details the sequence of preparing the stream capture, starting acquisition, waiting for and processing frames, releasing frames, stopping acquisition, tearing down the stream capture, and closing the stream. This method requires explicit calls to release resources like frames and tear down capture objects. ```csharp IStream stream = openCamera.Stream; IStreamCapture preparedStream = stream.PrepareCapture(AllocationModeValue.AnnounceFrame, 10); openCamera.Features.AcquisitionStart(); for(int i = 0; i < 10; ++i) { IFrame frame = preparedStream.WaitForFrame(TimeSpan.FromMilliseconds(500)); // Do something with frame frame.Release(); } openCamera.Features.AcquisitionStop(); preparedStream.TearDown(); stream.Close(); ``` -------------------------------- ### Opening a Camera Source: https://docs.alliedvision.com/Vimba_DeveloperGuide/cppAPIManual This section details how to open a camera for control and image capture. It explains the use of `Camera::Open` and `VimbaSystem::OpenCameraByID`, along with different access modes. ```APIDOC ## POST /camera/open ### Description Opens a camera device for control and image acquisition. Supports opening via camera list entry or by camera ID. ### Method POST ### Endpoint `/camera/open` ### Parameters #### Query Parameters - **cameraId** (string) - Required - The ID or list entry of the camera to open. - **accessMode** (string) - Required - The desired access mode for the camera. Accepted values are `VmbAccessModeFull`, `VmbAccessModeConfig`, `VmbAccessModeRead`. ### Request Example ```json { "cameraId": "192.168.0.42", "accessMode": "VmbAccessModeFull" } ``` ### Response #### Success Response (200) - **cameraPtr** (object) - A pointer to the opened camera object. #### Response Example ```json { "cameraPtr": "" } ``` ``` -------------------------------- ### Downgrade Pip for VimbaPython Installation Source: https://docs.alliedvision.com/Vimba_DeveloperGuide/pythonAPIManual Downgrades the pip package installer to a version less than 2.3, which may be necessary for specific VimbaPython installations. This command should be executed in a terminal. ```shell python -m pip install --upgrade pip==21.1.2 ``` -------------------------------- ### FloatFeature: Get and Set Floating Point Values Source: https://docs.alliedvision.com/Vimba_X/VmbPy_Function_Reference/Feature The FloatFeature class manages floating-point number features. The `get()` method retrieves the current float value, and `set()` updates it. It also provides methods to get the increment and range of valid values. ```python from vmbpy import FloatFeature, VmbFeatureError # Assuming 'my_float_feature' is an instance of FloatFeature # Get the current value try: current_value = my_float_feature.get() print(f"Current float value: {current_value}") except VmbFeatureError as e: print(f"Error getting float value: {e}") # Set a new value try: new_value = 3.14 my_float_feature.set(new_value) print(f"Successfully set float value to: {new_value}") except VmbFeatureError as e: print(f"Error setting float value: {e}") # Get increment and range try: increment = my_float_feature.get_increment() value_range = my_float_feature.get_range() print(f"Increment: {increment}") print(f"Range: {value_range}") except VmbFeatureError as e: print(f"Error getting float feature details: {e}") ``` -------------------------------- ### VmbSystem Entry Point Source: https://docs.alliedvision.com/Vimba_X/Vimba_X_DeveloperGuide/dotNetAPIManual Details on how to initialize the VmbNET API by starting the VmbSystem singleton and accessing cameras. ```APIDOC ## VmbSystem Entry Point ### Description Initializes the VmbNET API by starting the `VmbSystem` singleton. This entry point allows access to connected cameras for feature utilization and image acquisition. ### Method API Initialization ### Endpoint N/A (Application startup code) ### Parameters N/A ### Request Example ```csharp using VmbNET; class Program { // Using statement ensures Vimba X is shut down when the scope is left 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 implicitly } // Shuts down Vimba X implicitly ``` ### Response #### Success Response (Initialization) - **`IVmbSystem`**: An instance of the VmbSystem singleton, used to interact with the Vimba X system. - **`IOpenCamera`**: An instance representing an opened camera, allowing access to its features and frame acquisition capabilities. #### Response Example (Code execution result, no direct JSON response) ``` -------------------------------- ### List Interfaces using VimbaSystem (C++) Source: https://docs.alliedvision.com/Vimba_DeveloperGuide/cppAPIManual This code snippet demonstrates how to list all detected interfaces (e.g., frame grabbers, NICs) using the Vimba API. It initializes the Vimba system, retrieves the list of interfaces, and prints the name of each interface to the console. Ensure Vimba is successfully started. ```cpp std:: string name; InterfacePtrVector interfaces; VimbaSystem &system = VimbaSystem :: GetInstance (); if ( VmbErrorSuccess == system.Startup () ) { if ( VmbErrorSuccess == system.GetInterfaces( interfaces ) ) { for ( InterfacePtrVector :: iterator iter = interfaces.begin (); interfaces.end() != iter; ++iter ) { if ( VmbErrorSuccess == (*iter)->GetName( name ) ) { std::cout << name << std::endl; } } } } ``` -------------------------------- ### C++: Initialize Vimba X and Query Version Source: https://docs.alliedvision.com/Vimba_X/Vimba_X_DeveloperGuide/sdkManual This C++ code snippet demonstrates how to initialize the Vimba C++ API, obtain the system instance, query the API version, and print it to the console. It requires the VmbCPP library and includes basic error checking for the version query. ```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; } ``` -------------------------------- ### Install Vimba GigE Transport Layer (32-bit) Source: https://docs.alliedvision.com/Vimba_DeveloperGuide/sdkManual Installs the Vimba GigE Transport Layer module for 32-bit systems using msiexec. It includes the Visual C++ Redistributable, registers the GenICam path variable, and installs the core GigE Transport Layer components. ```bash msiexec -i VimbaGigETL_Win32.msi ADDLOCAL="VCRedist100,GigETL_RegisterGenICamPathVariable,GigETL_Core" ``` -------------------------------- ### VmbC XML Configuration for Logging Source: https://docs.alliedvision.com/Vimba_X/Vimba_X_DeveloperGuide/troubleshooting This example demonstrates how to configure Vimba X logging for VmbC by modifying the VmbC.xml file. It shows how to activate logging by selecting a sink type, such as 'File', and suggests recommended settings for technical support. ```xml Trace ``` -------------------------------- ### Silent Installation/Uninstallation of Vimba X on Windows Source: https://docs.alliedvision.com/Vimba_X/Vimba_X_DeveloperGuide/about This snippet demonstrates how to perform silent installations and uninstalls of Vimba X on Windows using command-line arguments. The `/S` flag is used for silent operations, and `/D` specifies the installation directory for installation. ```batch VimbaX_Install*.exe /S VimbaX_Install*.exe /S /D="C:\Custom\Path" VimbaX_Uninstall.exe /S ```