### Build and Install the C++ Library Source: https://github.com/stereolabs/zedx-one-capture/blob/main/README.md Compile and install the library using CMake and standard build tools. ```bash cd zedx-one-capture/lib mkdir build; cd build; cmake .. make sudo make install sudo ldconfig ``` -------------------------------- ### Library Compilation and Installation Source: https://github.com/stereolabs/zedx-one-capture/blob/main/lib/CMakeLists.txt Defines the shared library target, links dependencies, and specifies installation rules. ```cmake ### Add sources for library add_library(${PROJECT_NAME} SHARED ${ARGUS_CAPTURE_SRC} ${ARGUS_CAPTURE_HDR} ${TegraMM_COMMON_SOURCES}) ### Link library with deps target_link_directories(${PROJECT_NAME} PUBLIC ${TegraMM_LIBRARY_DIRS} ${TegraMM_LIBRARY_DIRS_CROSSCPL} ) target_link_libraries(${PROJECT_NAME} ${SPECIAL_OS_LIBS}) set(ARGUSCAPTURE_PUBLIC_INCLUDE_FILES "include/ArgusCapture.hpp") SET(ARGUS_CAPTURE_LIB_DIR /usr/local/lib) SET(ARGUS_CAPTURE_INC_DIR /usr/local/include) set_target_properties(${PROJECT_NAME} PROPERTIES PUBLIC_HEADER "${ARGUSCAPTURE_PUBLIC_INCLUDE_FILES}" ) install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${ARGUS_CAPTURE_LIB_DIR} LIBRARY DESTINATION ${ARGUS_CAPTURE_LIB_DIR} PUBLIC_HEADER DESTINATION ${ARGUS_CAPTURE_INC_DIR}) ``` -------------------------------- ### Configure and open camera Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/types.md Example of setting up camera configuration parameters and initializing the camera. ```cpp oc::ArgusCameraConfig config; config.setDeviceID(0); config.setStreamResolution(1920, 1200); config.setFPS(30); config.setPixelMode(oc::PixelMode::COLOR_RGBA); config.verbose_level = 2; config.mSwapRB = true; // Use BGR instead of RGB camera.openCamera(config); ``` -------------------------------- ### Build the Capture Library Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/QUICKSTART.md Standard sequence of commands to compile and install the library from source. ```bash cd lib mkdir build cd build cmake .. make sudo make install sudo ldconfig ``` -------------------------------- ### Enumerate and inspect Argus devices Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/types.md Example of retrieving and iterating through available camera devices. ```cpp std::vector devices = oc::ArgusBayerCapture::getArgusDevices(); for (const auto& device : devices) { std::cout << "Device " << device.id << ": " << device.name << " (Badge: " << device.badge << ")" << " Available: " << (device.available ? "Yes" : "No") << std::endl; if (device.badge == "zedx_imx678") { std::cout << " 4K camera detected" << std::endl; } } ``` -------------------------------- ### getExposureLimits Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-bayer-capture.md Gets hardware limits from DTS configuration. ```APIDOC ## int getExposureLimits(uint64_t& min_exp, uint64_t& max_exp) ### Description Gets hardware limits from DTS configuration. ### Parameters - **min_exp** (`uint64_t&`) - Required - Output: minimum possible exposure - **max_exp** (`uint64_t&`) - Required - Output: maximum possible exposure ### Return Type `int` - 0 on success. ``` -------------------------------- ### Project Initialization and Tegra Dependency Setup Source: https://github.com/stereolabs/zedx-one-capture/blob/main/lib/CMakeLists.txt Initializes the project, sets C++ standards, and attempts to locate the Tegra Multimedia API. ```cmake cmake_minimum_required(VERSION 3.5) project (arguscapture) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) SET(CMAKE_BUILD_TYPE "Release") set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) set(CMAKE_DEBUG_POSTFIX "d") find_package(TegraMM REQUIRED) if(${TegraMM_FOUND}) message(STATUS "Found Tegra Multimedia API") else() message(STATUS "Could not find Tegra Multimedia API") endif() ``` -------------------------------- ### getVersion Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-virtual-capture.md Gets the library version. ```APIDOC ## static void getVersion(int& major, int& minor, int &patch) ### Description Gets the library version. ### Parameters - **major** (int&) - Required - Output: major version number - **minor** (int&) - Required - Output: minor version number - **patch** (int&) - Required - Output: patch version number ``` -------------------------------- ### Set Manual White Balance Usage Examples Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-virtual-capture.md Demonstrates setting the white balance to specific Kelvin values for different lighting conditions. ```cpp // Daylight (5500K) camera.setManualWhiteBalance(5500); // Tungsten (2800K) camera.setManualWhiteBalance(2800); // Fluorescent (4000K) camera.setManualWhiteBalance(4000); ``` -------------------------------- ### Build Definitions and Target Setup Source: https://github.com/stereolabs/zedx-one-capture/blob/main/stereo_calibration/CMakeLists.txt Sets compiler flags, handles debug information, and defines the executable target with its linked libraries. ```cmake add_definitions(-std=c++17 -O3) IF (BUILD_WITH_DEBUGINFOS) message("!! Building with -g !!") add_definitions(-g) set(ARGUS_LIB arguscaptured) ELSE() set(ARGUS_LIB arguscapture) ENDIF() include_directories(include/) add_executable(zedx_one_stereo_calibration main.cpp) target_link_libraries(zedx_one_stereo_calibration ${ARGUS_LIB} pthread ${OpenCV_LIBRARIES} ${TegraMM_LIBRARIES}) ``` -------------------------------- ### Set AEANTIBANDING mode Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/types.md Example usage of setting the anti-banding mode on a camera instance. ```cpp camera.setAEAntiBanding(oc::AEANTIBANDING::AUTO); // Auto-detect camera.setAEAntiBanding(oc::AEANTIBANDING::HZ60); // Force 60Hz ``` -------------------------------- ### getSharpening Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-bayer-capture.md Gets the current sharpening value. ```APIDOC ## float getSharpening() ### Description Gets current sharpening value. ### Return Type float - [0.0–1.0], or <0 if error ``` -------------------------------- ### getFPS Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-virtual-capture.md Gets the current frame rate. ```APIDOC ## int getFPS() ### Description Gets the current frame rate. ### Return Type `int` (Frames per second) ``` -------------------------------- ### ArgusBayerCapture::openCamera Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-bayer-capture.md Initializes the camera and starts the Argus capture pipeline, including internal producer, consumer, and control threads. ```APIDOC ## ArgusBayerCapture::openCamera ### Description Opens the camera and initializes the Argus capture pipeline. Starts internal producer, consumer, and control threads. ### Signature `ARGUS_STATE openCamera(const ArgusCameraConfig &config, bool recreate_daemon = true);` ### Parameters - **config** (`const ArgusCameraConfig&`) - Required - Camera configuration (device ID, resolution, FPS, pixel mode) - **recreate_daemon** (`bool`) - Optional (Default: true) - If true, recreates the Argus daemon if needed ### Return Type `ARGUS_STATE` - `ARGUS_STATE::OK` - Success - `ARGUS_STATE::ALREADY_OPEN` - Camera already opened - `ARGUS_STATE::NO_CAMERA_AVAILABLE` - No camera at specified device ID ``` -------------------------------- ### Set ROI using Rect Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/types.md Example of configuring a region of interest for AEC/AGC. ```cpp oc::Rect roi; roi.x = 100; roi.y = 100; roi.width = 640; roi.height = 480; camera.setROIforAECAGC(roi); ``` -------------------------------- ### getFrameExposureRange Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-bayer-capture.md Gets the current exposure range. ```APIDOC ## int getFrameExposureRange(uint64_t &exp_low, uint64_t &exp_high) ### Description Gets the current exposure range. ### Parameters - **exp_low** (`uint64_t&`) - Required - Output: min exposure - **exp_high** (`uint64_t&`) - Required - Output: max exposure ### Return Type `int` - 0 on success. ``` -------------------------------- ### getColorSaturation Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-bayer-capture.md Gets the current color saturation level. ```APIDOC ## float getColorSaturation() ### Description Gets current saturation. ### Return Type float - [0.0–2.0] ``` -------------------------------- ### getPixelDepth Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-virtual-capture.md Gets the number of bytes per pixel. ```APIDOC ## int getPixelDepth() ### Description Gets the number of bytes per pixel. ### Return Type `int` (1 for RGB/RGBA, 2 for RAW10/RAW12) ``` -------------------------------- ### Denoising Control Methods Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-v4l2-capture.md Methods for setting or getting denoising values, both of which are unsupported. ```cpp int setDenoisingValue(float value); ``` ```cpp float getDenoisingValue(); ``` -------------------------------- ### Get Manual White Balance Method Definition Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-virtual-capture.md Defines the virtual method signature for retrieving the current white balance color temperature. ```cpp virtual uint32_t getManualWhiteBalance() = 0; ``` -------------------------------- ### Set Manual Analog Gain Real Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-virtual-capture.md Example usage for setting the analog gain to a specific decibel value. ```cpp // Set analog gain to 12 dB camera.setManualAnalogGainReal(12.0f); ``` -------------------------------- ### Get Digital Gain Limits Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-v4l2-capture.md Returns -1 as ISP gain control is unsupported. ```cpp int getDigitalGainLimits(float& min_gain, float& max_gain); ``` -------------------------------- ### getWidth Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-virtual-capture.md Gets the width of captured frames in pixels. ```APIDOC ## int getWidth() ### Description Gets the width of captured frames in pixels. ### Return Type `int` (Width in pixels, or 0 if camera is not opened) ``` -------------------------------- ### getHeight Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-virtual-capture.md Gets the height of captured frames in pixels. ```APIDOC ## int getHeight() ### Description Gets the height of captured frames in pixels. ### Return Type `int` (Height in pixels, or 0 if camera is not opened) ``` -------------------------------- ### Get Denoising Value Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-virtual-capture.md Retrieves the current denoising level. ```cpp virtual float getDenoisingValue() = 0; ``` -------------------------------- ### Get Exposure Compensation Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-virtual-capture.md Retrieves the current exposure compensation value. ```cpp virtual float getExposureCompensation() = 0; ``` -------------------------------- ### Get Analog Gain Limits Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-v4l2-capture.md Returns -1 as analog gain control is unsupported. ```cpp int getAnalogGainLimits(float& min_gain, float& max_gain); ``` -------------------------------- ### getNumberOfChannels Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-virtual-capture.md Gets the number of color channels per pixel. ```APIDOC ## int getNumberOfChannels() ### Description Gets the number of color channels per pixel. ### Return Type `int` (4 for COLOR_RGBA, 3 for COLOR_RGB, 1 for RAW10 and RAW12) ``` -------------------------------- ### Get ROI for AEC/AGC Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-virtual-capture.md Retrieves the current AEC/AGC region of interest. ```cpp virtual int getROIforAECAGC(oc::Rect &roi) = 0; ``` -------------------------------- ### Get Gamma Value Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-virtual-capture.md Retrieves the most recently applied gamma value. ```cpp virtual float getGamma() = 0; ``` -------------------------------- ### Get Digital Frame Gain Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-v4l2-capture.md Returns 0.0 as ISP gain control is unsupported. ```cpp float getDigitalFrameGain(); ``` -------------------------------- ### Get Hardware Exposure Limits in C++ Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-virtual-capture.md Retrieves the hardware-defined exposure limits from the device tree configuration. ```cpp virtual int getExposureLimits(uint64_t& min_exp, uint64_t& max_exp) = 0; ``` ```cpp uint64_t minLimit, maxLimit; camera.getExposureLimits(minLimit, maxLimit); std::cout << "Hardware limits: " << minLimit << " - " << maxLimit << " us" << std::endl; // Now set exposure within hardware limits camera.setFrameExposureRange(minLimit, maxLimit / 2); ``` -------------------------------- ### Configure Analog Frame Gain Range Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-virtual-capture.md Examples for setting an automatic gain range and fixing the gain to a specific value. ```cpp // Auto gain in range 0-6 dB camera.setAnalogFrameGainRange(0.0f, 6.0f); // Fixed gain at 3 dB camera.setAnalogFrameGainRange(3.0f, 3.0f); ``` -------------------------------- ### Compile the Sample Application Source: https://github.com/stereolabs/zedx-one-capture/blob/main/README.md Navigate to the sample directory and build the executable. ```bash cd ../sample_mono/ mkdir build; cd build; cmake .. make ``` -------------------------------- ### Retrieve Analog Frame Gain Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-virtual-capture.md Example usage for retrieving and printing the current analog gain in decibels. ```cpp float gain = camera.getAnalogFrameGain(); std::cout << "Current analog gain: " << gain << " dB" << std::endl; ``` -------------------------------- ### Run the Sample Application Source: https://github.com/stereolabs/zedx-one-capture/blob/main/README.md Execute the compiled sample to verify camera functionality. ```bash ./argus_camera ``` -------------------------------- ### Compile and Run Calibration Tool Source: https://github.com/stereolabs/zedx-one-capture/blob/main/stereo_calibration/README.md Commands to build the application and execute it using either camera IDs or a configuration file. ```bash # Compile the application mkdir build && cd build cmake .. make # Open cameras by id ./zedx_one_stereo_calibration # Open cameras by using the ZED_Media_Server configuration file ./zedx_one_stereo_calibration /usr/local/zed/settings/virtual_xone_config.json ``` -------------------------------- ### Get Sharpening Method Definition Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-virtual-capture.md Defines the virtual method signature for retrieving the current sharpening value. ```cpp virtual float getSharpening() = 0; ``` -------------------------------- ### Get ISP Digital Gain Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-virtual-capture.md Retrieves the current ISP digital gain factor. ```cpp virtual float getDigitalFrameGain() = 0; ``` -------------------------------- ### getGamma Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-bayer-capture.md Gets the last set gamma value. ```APIDOC ## float getGamma() ### Description Gets last set gamma value. ### Return Type float - Gamma [1.5–3.5] ``` -------------------------------- ### Initialize Camera with Fallback Configuration Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/errors.md Attempts to open the camera with high-resolution settings and falls back to a lower resolution if the initial attempt fails. ```cpp oc::ArgusBayerCapture camera; oc::ArgusCameraConfig config; config.mDeviceId = 0; config.mWidth = 3840; config.mHeight = 2160; config.mFPS = 15; oc::ARGUS_STATE state = camera.openCamera(config); if (state != oc::ARGUS_STATE::OK) { std::cerr << "Failed: " << oc::ARGUS_STATE2str(state) << std::endl; // Try with lower resolution config.mWidth = 1920; config.mHeight = 1200; config.mFPS = 30; state = camera.openCamera(config); if (state != oc::ARGUS_STATE::OK) { std::cerr << "Failed again: " << oc::ARGUS_STATE2str(state) << std::endl; return false; } } ``` -------------------------------- ### Get Automatic White Balance Status Method Definition Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-virtual-capture.md Defines the virtual method signature for retrieving the current white balance mode status. ```cpp virtual int getAutomaticWhiteBalanceStatus() = 0; ``` -------------------------------- ### Get Color Saturation Method Definition Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-virtual-capture.md Defines the virtual method signature for retrieving the current saturation value. ```cpp virtual float getColorSaturation() = 0; ``` -------------------------------- ### Retrieve Frame Dimensions Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-virtual-capture.md Gets the current width and height of captured frames in pixels. ```cpp int w = camera.getWidth(); int h = camera.getHeight(); std::cout << "Resolution: " << w << "x" << h << std::endl; ``` -------------------------------- ### getToneMappingCurveSize Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-bayer-capture.md Gets the LUT size for tone mapping. ```APIDOC ## int getToneMappingCurveSize(int channel) ### Description Gets LUT size for tone mapping. ### Parameters - **channel** (int) - Required - 0=Red, 1=Green, 2=Blue ### Return Type int - Number of LUT points ``` -------------------------------- ### Open Camera Connection Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-index.md Initialize the capture object and verify the connection state. ```cpp oc::ArgusBayerCapture camera; oc::ARGUS_STATE state = camera.openCamera(config); if (state != oc::ARGUS_STATE::OK) { std::cerr << "Error: " << oc::ARGUS_STATE2str(state) << std::endl; } ``` -------------------------------- ### Get ISP Digital Gain Hardware Limits Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-virtual-capture.md Retrieves the absolute hardware-supported minimum and maximum ISP gain limits. ```cpp virtual int getDigitalGainLimits(float& min_gain, float& max_gain) = 0; ``` -------------------------------- ### Get Hardware Exposure Limits Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-bayer-capture.md Retrieves the absolute minimum and maximum exposure limits defined in the DTS configuration. ```cpp int getExposureLimits(uint64_t& min_exp, uint64_t& max_exp); ``` ```cpp uint64_t minLimit, maxLimit; camera.getExposureLimits(minLimit, maxLimit); std::cout << "Exposure limits: " << minLimit << "-" << maxLimit << " us" << std::endl; // Use full range camera.setFrameExposureRange(minLimit, maxLimit); ``` -------------------------------- ### Get Frame Exposure Percentage in C++ Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-virtual-capture.md Retrieves the current exposure as a percentage of the valid range. ```cpp virtual int getFrameExposurePercent() = 0; ``` -------------------------------- ### getFrameExposurePercent Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-bayer-capture.md Gets exposure as percentage of the current range. ```APIDOC ## int getFrameExposurePercent() ### Description Gets exposure as percentage of the current range. ### Return Type `int` - Value [0–100]. ``` -------------------------------- ### Get Frame Exposure Range in C++ Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-virtual-capture.md Retrieves the currently configured exposure control range. ```cpp virtual int getFrameExposureRange(uint64_t &exp_low, uint64_t &exp_high) = 0; ``` ```cpp uint64_t minExp, maxExp; camera.getFrameExposureRange(minExp, maxExp); std::cout << "Exposure range: " << minExp << " - " << maxExp << " us" << std::endl; ``` -------------------------------- ### Get Analog Frame Gain Percent Definition Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-virtual-capture.md Definition for the method that retrieves the analog gain as a percentage. ```cpp virtual int getAnalogFrameGainPercent() = 0; ``` -------------------------------- ### Get Analog Gain Limits Definition Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-virtual-capture.md Definition for the method that retrieves the hardware limits for analog gain. ```cpp virtual int getAnalogGainLimits(float& min_gain, float& max_gain) = 0; ``` -------------------------------- ### Open Camera and Capture Frames Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/QUICKSTART.md Configures a camera instance, opens the stream, and captures a sequence of frames with timestamps. ```cpp #include "ArgusCapture.hpp" #include int main() { // Create camera object oc::ArgusBayerCapture camera; // Create configuration oc::ArgusCameraConfig config; config.setDeviceID(0); // First camera config.setStreamResolution(1920, 1200); config.setFPS(30); config.setPixelMode(oc::PixelMode::COLOR_RGBA); // Open camera oc::ARGUS_STATE state = camera.openCamera(config); if (state != oc::ARGUS_STATE::OK) { std::cerr << "Failed: " << oc::ARGUS_STATE2str(state) << std::endl; return 1; } // Capture 100 frames for (int i = 0; i < 100; i++) { if (camera.isNewFrame()) { unsigned char* pixels = camera.getPixels(); uint64_t timestamp = camera.getImageTimestampinUs(); std::cout << "Frame " << i << " at " << timestamp << " µs" << std::endl; } usleep(10000); // Wait 10ms } // Cleanup camera.closeCamera(); return 0; } ``` -------------------------------- ### Get Analog Frame Gain Definition Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-virtual-capture.md Definition for the method that retrieves the current sensor analog gain. ```cpp virtual float getAnalogFrameGain() = 0; ``` -------------------------------- ### Get AWB Gains in C++ Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-bayer-capture.md Reads the current RGGB white balance gains from frame metadata into a provided array. ```cpp void getAwbGains(float gains[4]) const; ``` ```cpp float awb[4]; camera.getAwbGains(awb); std::cout << "AWB gains - R: " << awb[0] << ", G_even: " << awb[1] << ", G_odd: " << awb[2] << ", B: " << awb[3] << std::endl; ``` -------------------------------- ### Project file structure Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/README.md Overview of the repository layout and documentation files. ```text . ├── QUICKSTART.md # Start here ├── api-index.md # Master index ├── api-reference-argus-virtual-capture.md # Base interface ├── api-reference-argus-bayer-capture.md # RAW capture (full control) ├── api-reference-argus-v4l2-capture.md # V4L2 capture (simple) ├── types.md # Data structures ├── configuration.md # Setup and examples ├── errors.md # Error codes └── README.md # This file ``` -------------------------------- ### Initialize ArgusBayerCapture Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-bayer-capture.md Instantiate the camera object to prepare for connection. ```cpp oc::ArgusBayerCapture camera; ``` -------------------------------- ### Build the library Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/README.md Standard CMake build process for the library on Linux systems. ```bash cd lib mkdir build && cd build cmake .. make sudo make install sudo ldconfig ``` -------------------------------- ### Get Frame Exposure Time in C++ Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-virtual-capture.md Retrieves the current sensor exposure time in microseconds. Only supported by ArgusBayerCapture. ```cpp virtual uint64_t getFrameExposureTime() = 0; ``` ```cpp uint64_t exposureUs = camera.getFrameExposureTime(); std::cout << "Current exposure: " << exposureUs / 1000.0 << " ms" << std::endl; ``` -------------------------------- ### Configure Camera Device Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-index.md Select a specific device ID and initialize the camera configuration object. ```cpp oc::ArgusCameraConfig config; config.mDeviceId = devices[0].id; ``` -------------------------------- ### Get ISP Digital Gain Range Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-virtual-capture.md Retrieves the currently configured ISP gain range using reference parameters. ```cpp virtual int getDigitalFrameGainRange(float& dgain_low, float& dgain_high) = 0; ``` -------------------------------- ### Basic 1080p Color Capture Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/configuration.md Demonstrates initializing a camera with standard 1080p settings and displaying the stream using OpenCV. ```cpp oc::ArgusBayerCapture camera; oc::ArgusCameraConfig config; config.setDeviceID(0); config.setStreamResolution(1920, 1080); config.setFPS(30); config.setPixelMode(oc::PixelMode::COLOR_RGBA); config.verbose_level = 1; oc::ARGUS_STATE state = camera.openCamera(config); if (state != oc::ARGUS_STATE::OK) { std::cerr << "Failed to open camera" << std::endl; return; } cv::Mat frame(config.mHeight, config.mWidth, CV_8UC4); while (true) { if (camera.isNewFrame()) { std::memcpy(frame.data, camera.getPixels(), config.mWidth * config.mHeight * 4); cv::imshow("Camera", frame); if (cv::waitKey(1) == 'q') break; } } camera.closeCamera(); ``` -------------------------------- ### Safe Camera Initialization Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-index.md Initializes the camera and checks the returned state against the OK status to handle potential errors. ```cpp bool initializeCamera(oc::ArgusBayerCapture& camera, oc::ArgusCameraConfig& config) { oc::ARGUS_STATE state = camera.openCamera(config); if (state != oc::ARGUS_STATE::OK) { std::cerr << "Failed: " << oc::ARGUS_STATE2str(state) << std::endl; return false; } return true; } ``` -------------------------------- ### Get Analog Frame Gain Range Definition Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-virtual-capture.md Definition for the method that retrieves the current analog gain control range. ```cpp virtual int getAnalogFrameGainRange(float& sgain_low, float& sgain_high) = 0; ``` -------------------------------- ### Get Exposure Percentage Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-bayer-capture.md Returns the current exposure as a percentage of the defined range. ```cpp int getFrameExposurePercent(); ``` -------------------------------- ### Get Tone Mapping Curve Size Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-virtual-capture.md Retrieves the number of points in the tone mapping look-up table for a specific color channel. ```cpp virtual int getToneMappingCurveSize(int channel) = 0; ``` -------------------------------- ### Initialize ArgusV4l2Capture Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-v4l2-capture.md Instantiate the camera object to initialize the V4L2 context. ```cpp oc::ArgusV4l2Capture camera; ``` -------------------------------- ### CMake Project Configuration Source: https://github.com/stereolabs/zedx-one-capture/blob/main/sample/CMakeLists.txt Initializes the project, sets compiler flags, and locates OpenCV dependencies. ```cmake cmake_minimum_required(VERSION 3.5) project(argus_camera) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) find_package(OpenCV REQUIRED) include_directories(${OPENCV_INCLUDE_DIRS}) link_directories(${OpenCV_LIBRARY_DIRS}) ``` -------------------------------- ### CMake Project Configuration Source: https://github.com/stereolabs/zedx-one-capture/blob/main/stereo_calibration/CMakeLists.txt Initializes the project, sets the minimum CMake version, and configures OpenCV dependencies. ```cmake cmake_minimum_required(VERSION 3.5) project(zedx_one_stereo_calibration) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) find_package(OpenCV REQUIRED) include_directories(${OPENCV_INCLUDE_DIRS}) link_directories(${OpenCV_LIBRARY_DIRS}) ``` -------------------------------- ### getFrameExposureTime Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-bayer-capture.md Gets the current sensor exposure time from the last captured frame metadata. ```APIDOC ## uint64_t getFrameExposureTime() ### Description Gets the current sensor exposure time from the last captured frame metadata. ### Return Type `uint64_t` - Exposure time in microseconds (µs). ``` -------------------------------- ### openCamera Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-v4l2-capture.md Opens the camera in V4L2 mode and initializes the YUV capture pipeline. ```APIDOC ## openCamera(const ArgusCameraConfig &config, bool recreate_daemon) ### Description Opens the camera in V4L2 mode and initializes the YUV capture pipeline. ### Parameters - **config** (const ArgusCameraConfig&) - Required - Camera configuration (device ID, resolution, FPS) - **recreate_daemon** (bool) - Optional - Recreate daemon if needed (default: true) ### Return Type `ARGUS_STATE` (OK, ALREADY_OPEN, NO_CAMERA_AVAILABLE, etc.) ``` -------------------------------- ### Handle Connection Timeouts Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/errors.md Methods to reboot the camera and inspect kernel logs for timeout traces. ```cpp camera.reboot(); ``` ```bash dmesg | grep -i timeout ``` -------------------------------- ### Implement Runtime Recovery Loop Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/errors.md Monitors camera state during execution, attempting to reopen the device if connection is lost and handling capture errors. ```cpp while (running) { if (!camera.isOpened()) { std::cout << "Camera not open, attempting to reopen..." << std::endl; oc::ARGUS_STATE state = camera.openCamera(config); if (state != oc::ARGUS_STATE::OK) { std::cerr << "Reopen failed: " << oc::ARGUS_STATE2str(state) << std::endl; sleep(1); continue; } } if (camera.isNewFrame()) { // Process frame } else { if (camera.getLastCaptureState() != oc::ARGUS_STATE::OK) { std::cerr << "Capture error: " << oc::ARGUS_STATE2str(camera.getLastCaptureState()) << std::endl; camera.closeCamera(); } } usleep(10000); } ``` -------------------------------- ### Configure CMake Project and Dependencies Source: https://github.com/stereolabs/zedx-one-capture/blob/main/sample_raw/CMakeLists.txt Initializes the project, enables compile commands, and locates required OpenCV packages. ```cmake cmake_minimum_required(VERSION 3.5) project(raw_camera) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) find_package(OpenCV REQUIRED) include_directories(${OPENCV_INCLUDE_DIRS}) link_directories(${OpenCV_LIBRARY_DIRS}) ``` -------------------------------- ### Get Analog Frame Gain Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-v4l2-capture.md Returns 0.0 as analog gain control is unsupported. ```cpp float getAnalogFrameGain(); ``` -------------------------------- ### Camera Lifecycle Methods Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-index.md Methods for initializing, closing, and managing the state of the camera hardware. ```APIDOC ## ArgusVirtualCapture Lifecycle ### Methods - **openCamera(config, recreate_daemon)**: Initialize the camera. - **closeCamera()**: Shutdown the camera. - **reboot()**: Reset the hardware. - **isOpened()**: Check if the camera is currently open. - **getLastCaptureState()**: Retrieve the last error state. ``` -------------------------------- ### Link the application Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/README.md Compile a C++ application linking against the arguscapture library. ```bash g++ -std=c++14 your_app.cpp -o your_app -larguscapture ``` -------------------------------- ### Clone the ZED X One Capture Repository Source: https://github.com/stereolabs/zedx-one-capture/blob/main/README.md Download the source code from the official GitHub repository. ```bash git clone https://github.com/stereolabs/zedx-one-capture.git ``` -------------------------------- ### setToneMappingFromGamma Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-v4l2-capture.md Attempts to set tone mapping from gamma; always returns -1 as it is unsupported. ```cpp int setToneMappingFromGamma(int channel, float gamma); ``` -------------------------------- ### Manage Argus Daemon Status Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/errors.md Commands to check, start, and debug the nvargus-daemon service. ```bash systemctl status nvargus-daemon ``` ```bash systemctl start nvargus-daemon ``` ```bash journalctl -u nvargus-daemon -n 50 ``` -------------------------------- ### Initialize ArgusV4l2Capture Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/QUICKSTART.md Use this class for standard YUV color frames without manual sensor parameter control. ```cpp oc::ArgusV4l2Capture camera; camera.openCamera(config); // Video controls not supported - just capture frames unsigned char* pixels = camera.getPixels(); ``` -------------------------------- ### ArgusV4l2Capture Constructor Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-v4l2-capture.md Initializes the V4L2 context and capture state. ```APIDOC ## ArgusV4l2Capture() ### Description Default constructor. Initializes V4L2 context and capture state. ### Signature `ArgusV4l2Capture();` ``` -------------------------------- ### oc::ArgusBayerCapture::openCamera Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-index.md Initializes and opens the camera using the provided configuration object. ```APIDOC ## oc::ArgusBayerCapture::openCamera(oc::ArgusCameraConfig config) ### Description Opens the camera device based on the settings defined in the ArgusCameraConfig object. ### Parameters - **config** (oc::ArgusCameraConfig) - Required - Configuration object containing device ID, resolution, FPS, and pixel mode. ### Returns - **oc::ARGUS_STATE** - Returns OK if successful, otherwise returns an error state. ### Example ```cpp oc::ArgusBayerCapture camera; oc::ARGUS_STATE state = camera.openCamera(config); ``` ``` -------------------------------- ### Get ROI for AEC/AGC in C++ Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-bayer-capture.md Retrieves the currently configured ROI rectangle used for AEC/AGC. ```cpp int getROIforAECAGC(oc::Rect &roi); ``` -------------------------------- ### Get Frame Exposure Time Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-bayer-capture.md Retrieves the exposure time in microseconds from the most recent frame metadata. ```cpp uint64_t getFrameExposureTime(); ``` ```cpp uint64_t expTime = camera.getFrameExposureTime(); float expMs = expTime / 1000.0f; std::cout << "Frame exposure: " << expMs << " ms" << std::endl; ``` -------------------------------- ### Adjust Camera Configuration Dynamically Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/errors.md Use this logic to detect the camera model and apply a supported resolution and FPS configuration to avoid INVALID_OUTPUT_STREAM_SETTINGS errors. ```cpp // Detect camera type and set appropriate resolution std::vector devices = oc::ArgusBayerCapture::getArgusDevices(); const auto& device = devices[0]; oc::ArgusCameraConfig config; config.mDeviceId = device.id; if (device.badge == "zedx_imx678") { // 4K camera config.mWidth = 3840; config.mHeight = 2160; config.mFPS = 15; } else if (device.badge == "zedx_ar0234") { // Grayscale camera config.mWidth = 1920; config.mHeight = 1200; config.mFPS = 30; } else { std::cerr << "Unknown camera type: " << device.badge << std::endl; return; } oc::ARGUS_STATE state = camera.openCamera(config); ``` -------------------------------- ### Initialize ArgusBayerCapture Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/QUICKSTART.md Use this class for RAW Bayer data access and manual sensor control. ```cpp oc::ArgusBayerCapture camera; camera.openCamera(config); camera.setManualTimeExposure(5000); // 5ms camera.setManualAnalogGainReal(12.0f); // 12dB uint64_t expTime = camera.getFrameExposureTime(); ``` -------------------------------- ### Get Digital Frame Gain Range Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-v4l2-capture.md Returns -1 as ISP gain control is unsupported. ```cpp int getDigitalFrameGainRange(float& dgain_low, float& dgain_high); ``` -------------------------------- ### Get Analog Frame Gain Range Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-v4l2-capture.md Returns -1 as analog gain control is unsupported. ```cpp int getAnalogFrameGainRange(float& sgain_low, float& sgain_high); ``` -------------------------------- ### isOpened Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-virtual-capture.md Checks if the camera is currently open and ready for capture. ```APIDOC ## bool isOpened() ### Description Checks if the camera is currently open and ready for capture. ### Return Type `bool` ``` -------------------------------- ### Get Analog Frame Gain Percent Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-v4l2-capture.md Returns 0 as analog gain control is unsupported. ```cpp int getAnalogFrameGainPercent(); ``` -------------------------------- ### Error Recovery Workflow Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/README.md Logic for handling camera initialization failures and runtime capture errors. ```text 1. Try to open camera 2. If fails: - Check ARGUS_STATE - Enum devices if NO_CAMERA_AVAILABLE - Try lower resolution if INVALID_OUTPUT_STREAM_SETTINGS - Reboot daemon if INVALID_CAMERA_PROVIDER 3. In capture loop: - Monitor getLastCaptureState() - On CAPTURE_FAILURE/TIMEOUT: reboot camera - Retry opening if CAPTURE_UNSYNC ``` -------------------------------- ### Verify Device Enumeration Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/errors.md Commands to check driver status, device tree configuration, and restart the Argus daemon. ```bash lsmod | grep -i camera lsmod | grep -i tegra ``` ```bash dtc -I fs /proc/device-tree | grep -i camera ``` ```bash systemctl restart nvargus-daemon ``` -------------------------------- ### Verify GPU/EGL Support Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/errors.md Command to verify OpenGL version for EGL stream creation troubleshooting. ```bash glxinfo | grep "OpenGL version" ``` -------------------------------- ### Detect and Configure Camera Automatically Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/QUICKSTART.md Identify available devices and apply configuration settings based on the camera model. ```cpp auto devices = oc::ArgusBayerCapture::getArgusDevices(); if (devices.empty()) { std::cerr << "No cameras found" << std::endl; return 1; } const auto& device = devices[0]; oc::ArgusCameraConfig config; config.mDeviceId = device.id; // Auto-configure based on camera type if (device.badge == "zedx_imx678") { config.setStreamResolution(3840, 2160); // 4K config.setFPS(15); } else if (device.badge == "zedx_ar0234") { config.setStreamResolution(1920, 1200); // GS config.setFPS(30); } else { std::cerr << "Unknown camera type" << std::endl; return 1; } ``` -------------------------------- ### Open Camera for 4K RAW Capture Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-bayer-capture.md Configure and open the camera pipeline for high-resolution capture. ```cpp oc::ArgusBayerCapture camera; oc::ArgusCameraConfig config; config.mDeviceId = 0; config.mWidth = 3840; config.mHeight = 2160; config.mFPS = 15; config.setPixelMode(oc::PixelMode::COLOR_RGBA); config.verbose_level = 3; oc::ARGUS_STATE state = camera.openCamera(config); if (state != oc::ARGUS_STATE::OK) { std::cerr << "Failed to open camera: " << oc::ARGUS_STATE2str(state) << std::endl; return; } while (true) { if (camera.isNewFrame()) { unsigned char* pixels = camera.getPixels(); // Process frame } usleep(100); } camera.closeCamera(); ``` -------------------------------- ### 4K RAW Capture with Manual Control Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/configuration.md Shows how to detect a specific camera model, set 4K resolution, and manually adjust exposure and gain parameters. ```cpp oc::ArgusBayerCapture camera; oc::ArgusCameraConfig config; // Detect camera type auto devices = oc::ArgusBayerCapture::getArgusDevices(); const auto& device = devices[0]; if (device.badge == "zedx_imx678") { config.setDeviceID(device.id); config.setStreamResolution(3840, 2160); config.setFPS(15); config.setPixelMode(oc::PixelMode::RAW10); config.verbose_level = 2; oc::ARGUS_STATE state = camera.openCamera(config); if (state != oc::ARGUS_STATE::OK) { std::cerr << "Failed: " << oc::ARGUS_STATE2str(state) << std::endl; return; } // Manual exposure and gain camera.setManualTimeExposure(10000); // 10ms camera.setManualAnalogGainReal(6.0f); // 6dB camera.setManualDigitalGain(75); // 75% // Capture frames cv::Mat raw(3840, 2160, CV_16UC1); for (int i = 0; i < 100; i++) { if (camera.isNewFrame()) { std::memcpy(raw.data, camera.getPixels(), 3840 * 2160 * 2); cv::imwrite("raw_frame_" + std::to_string(i) + ".png", raw); } } camera.closeCamera(); } ``` -------------------------------- ### Basic Color Capture Workflow Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/README.md Standard sequence for initializing and capturing color frames from a camera device. ```text 1. Enumerate devices (getArgusDevices) 2. Create config (ArgusCameraConfig) 3. Set resolution/FPS 4. Open camera (openCamera) 5. Loop: isNewFrame → getPixels → process 6. Close camera (closeCamera) ``` -------------------------------- ### setSharpening Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-v4l2-capture.md Attempts to set sharpening; always returns -1 as it is unsupported. ```cpp int setSharpening(float value); ``` -------------------------------- ### Set Manual White Balance in C++ Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-bayer-capture.md Configures the white balance to a specific color temperature in Kelvin. ```cpp int setManualWhiteBalance(uint32_t color_temperature); ``` ```cpp // Tungsten indoor lighting camera.setManualWhiteBalance(2800); // Daylight camera.setManualWhiteBalance(5500); // Cloudy camera.setManualWhiteBalance(6500); ``` -------------------------------- ### Validate Device Enumeration Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/errors.md Enumerates available devices and selects a specific hardware model before proceeding with configuration. ```cpp auto devices = oc::ArgusBayerCapture::getArgusDevices(); if (devices.empty()) { std::cerr << "No devices found" << std::endl; return false; } oc::ArgusDevice selectedDevice = devices[0]; for (const auto& dev : devices) { if (dev.badge == "zedx_imx678" && dev.available) { selectedDevice = dev; break; } } if (!selectedDevice.available) { std::cerr << "Selected device not available" << std::endl; return false; } config.mDeviceId = selectedDevice.id; // ... continue with openCamera ``` -------------------------------- ### setColorSaturation Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-v4l2-capture.md Attempts to set color saturation; always returns -1 as it is unsupported. ```cpp int setColorSaturation(float saturation); ``` -------------------------------- ### Handle Camera Initialization Errors Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/QUICKSTART.md Use a switch statement to handle specific ARGUS_STATE return codes during camera opening. ```cpp oc::ArgusBayerCapture camera; oc::ARGUS_STATE state = camera.openCamera(config); switch (state) { case oc::ARGUS_STATE::OK: std::cout << "Camera opened successfully" << std::endl; break; case oc::ARGUS_STATE::NO_CAMERA_AVAILABLE: std::cerr << "No camera at device ID " << config.mDeviceId << std::endl; return 1; case oc::ARGUS_STATE::INVALID_OUTPUT_STREAM_SETTINGS: std::cerr << "Unsupported resolution: " << config.mWidth << "x" << config.mHeight << "@" << config.mFPS << std::endl; return 1; default: std::cerr << "Error: " << oc::ARGUS_STATE2str(state) << std::endl; return 1; } ``` -------------------------------- ### Handle NO_CAMERA_AVAILABLE Error Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/errors.md Recover from a missing camera error by re-enumerating devices and updating the configuration. ```cpp oc::ArgusCameraConfig config; config.mDeviceId = 5; // May not exist oc::ARGUS_STATE state = camera.openCamera(config); if (state == oc::ARGUS_STATE::NO_CAMERA_AVAILABLE) { // List available cameras auto devices = oc::ArgusBayerCapture::getArgusDevices(); if (!devices.empty()) { config.mDeviceId = devices[0].id; // Use first available state = camera.openCamera(config); } } ``` -------------------------------- ### Retrieve Library Version Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-virtual-capture.md Fetches the current version of the ArgusVirtualCapture library. ```cpp int major, minor, patch; oc::ArgusVirtualCapture::getVersion(major, minor, patch); std::cout << "ArgusCapture version: " << major << "." << minor << "." << patch << std::endl; // Output: ArgusCapture version: 1.1.0 ``` -------------------------------- ### setManualWhiteBalance Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-v4l2-capture.md Attempts to set manual white balance; always returns -1 as it is unsupported. ```cpp int setManualWhiteBalance(uint32_t color_temperature); ``` -------------------------------- ### getAnalogGainLimits Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-bayer-capture.md Retrieves the hardware-supported analog gain limits. ```APIDOC ## int getAnalogGainLimits(float& min_gain, float& max_gain) ### Description Gets hardware analog gain limits. ### Parameters - **min_gain** (float&) - Required - Output: minimum possible gain - **max_gain** (float&) - Required - Output: maximum possible gain ### Return Type int - 0 on success ``` -------------------------------- ### Jetson Multimedia API Integration Source: https://github.com/stereolabs/zedx-one-capture/blob/main/sample/CMakeLists.txt Conditionally configures paths and libraries for the Jetson Multimedia API if the directory exists. ```cmake set(TegraMM_ROOT /usr/src/jetson_multimedia_api) set(TegraMM_FOUND FALSE) if(EXISTS ${TegraMM_ROOT}) # set packages set(TegraMM_INCLUDE_DIRS ${TegraMM_ROOT}/include ${TegraMM_ROOT}/include/libjpeg-8b /usr/include/libdrm) set(TegraMM_LIBRARY_DIRS /usr/lib/aarch64-linux-gnu/tegra /usr/lib/aarch64-linux-gnu) set(TegraMM_LIBRARIES nvargus_socketclient nvjpeg drm nvbufsurftransform nvbufsurface nvosd EGL v4l2 GLESv2 X11 pthread vulkan) file(GLOB TegraMM_COMMON_SOURCES ${TegraMM_ROOT}/samples/common/classes/*.cpp) include_directories(${TegraMM_INCLUDE_DIRS}) link_directories(${TegraMM_LIBRARY_DIRS}) set(TegraMM_FOUND TRUE) endif() ``` -------------------------------- ### Configure COLOR_RGBA Pixel Mode Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/configuration.md Sets the camera to 4-channel RGBA mode and demonstrates how to map the pixel buffer to an OpenCV Mat object. ```cpp config.setPixelMode(oc::PixelMode::COLOR_RGBA); // Resulting pixel data: [R0, G0, B0, A0, R1, G1, B1, A1, ...] // Each value is 0–255 (uint8_t) ``` ```cpp int channels = camera.getNumberOfChannels(); // Returns 4 int depth = camera.getPixelDepth(); // Returns 1 unsigned char* pixels = camera.getPixels(); cv::Mat frame(height, width, CV_8UC4, pixels); ``` -------------------------------- ### Enumerate Available Cameras Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/QUICKSTART.md Lists all connected ZED X One cameras and their associated device information. ```cpp #include #include "ArgusCapture.hpp" int main() { // List connected cameras auto devices = oc::ArgusBayerCapture::getArgusDevices(); for (const auto& device : devices) { std::cout << "Camera " << device.id << ": " << device.name << " (" << device.badge << ")" << std::endl; } return 0; } ``` -------------------------------- ### Set Manual White Balance Method Definition Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-reference-argus-virtual-capture.md Defines the virtual method signature for setting the manual white balance color temperature. ```cpp virtual int setManualWhiteBalance(uint32_t color_temperature) = 0; ``` -------------------------------- ### Implement Frame Loop with Timeout Protection Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/QUICKSTART.md Poll for new frames and trigger a reboot if the camera stops responding for a set number of iterations. ```cpp int timeouts = 0; const int max_timeouts = 100; while (timeouts < max_timeouts) { if (camera.isNewFrame()) { // Got a frame unsigned char* pixels = camera.getPixels(); // Process pixels timeouts = 0; } else { timeouts++; usleep(10000); // 10ms wait } } if (timeouts >= max_timeouts) { std::cerr << "Frame timeout - camera may be frozen" << std::endl; camera.reboot(); } ``` -------------------------------- ### Configure BGR Output with Swapped Channels Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/configuration.md Configures the camera to output BGRA format by enabling channel swapping in the configuration object. ```cpp oc::ArgusBayerCapture camera; oc::ArgusCameraConfig config; config.setDeviceID(0); config.setStreamResolution(1920, 1200); config.setFPS(30); config.setPixelMode(oc::PixelMode::COLOR_RGBA); config.mSwapRB = true; // Output BGRA instead of RGBA oc::ARGUS_STATE state = camera.openCamera(config); if (state != oc::ARGUS_STATE::OK) { std::cerr << "Failed to open camera" << std::endl; return; } // Pixel data is now [B, G, R, A] format cv::Mat bgra(1920, 1200, CV_8UC4, camera.getPixels()); cv::Mat bgr; cv::cvtColor(bgra, bgr, cv::COLOR_BGRA2BGR); cv::imshow("BGR Image", bgr); ``` -------------------------------- ### Configure Camera Controls Source: https://github.com/stereolabs/zedx-one-capture/blob/main/_autodocs/api-index.md Apply manual exposure, analog gain, and automatic digital gain settings. ```cpp camera.setManualTimeExposure(10000); // 10ms camera.setManualAnalogGainReal(6.0f); // 6dB camera.setAutomaticDigitalGain(); ```