### Setup Python Environment Source: https://github.com/dino-lite/dnx64-python-api/blob/main/README.md This snippet shows the commands to set up a Python virtual environment and install project dependencies from a requirements file. It is essential for preparing the project's runtime environment. ```shell python3 -m venv .venv pip3 install -r requirements.txt ``` -------------------------------- ### Initialize DNX64 and Control Camera Source: https://github.com/dino-lite/dnx64-python-api/blob/main/README.md This Python code initializes the DNX64 API, sets the video device index, retrieves the total number of detected video devices, and configures camera settings like auto-exposure target and exposure value. It requires the DNX64.dll to be accessible and demonstrates basic device interaction. ```python import importlib import time try: DNX64 = getattr(importlib.import_module("DNX64"), "DNX64") except ImportError as err: print("Error: ", err) # Initialize the DNX64 class dll_path = "/path/to/DNX64.dll" micro_scope = DNX64(dll_path) # Set Device Index first micro_scope.SetVideoDeviceIndex(0) # Get total number of video devices being detected device_count = micro_scope.GetVideoDeviceCount() print(f"Number of video devices: {device_count}") # NOTE: Buffer time for devices to set up properly time.sleep(0.1) # Set the auto-exposure target value for device 0 micro_scope.SetAETarget(0, 100) # NOTE: Buffer time for devices to set up properly time.sleep(0.1) # Set the exposure value for device 0 micro_scope.SetExposureValue(0, 1000) ``` -------------------------------- ### GetConfig() API Source: https://github.com/dino-lite/dnx64-python-api/wiki/Appendix:-Parameter-Table This section details the parameters and their meanings for the GetConfig() function, which retrieves the current device configuration. ```APIDOC ## GetConfig() ### Description Retrieves the current device configuration, providing information about supported features and modes. ### Method GET ### Endpoint /dino-lite/dnx64-python-api/config ### Parameters #### Query Parameters N/A #### Request Body N/A ### Request Example ```json { "method": "GetConfig" } ``` ### Response #### Success Response (200) - **EDOF** (Read) - 1 = Supported, 0 = Not supported - **AMR** (Read) - 1 = Supported, 0 = Not supported - **eFLC** (Read) - 1 = Supported, 0 = Not supported - **APL** (Read) - 1 = Supported, 0 = Not supported - **LED** (Read) - Indicates LED modes (00 = Not switchable, 01 = 2 Modes, 10 = 3 Modes, 11 = Reserved) - **FLC** (Read) - 1 = Supported, 0 = Not supported - **AXI** (Read) - 1 = Supported, 0 = Not supported #### Response Example ```json { "EDOF": 1, "AMR": 0, "eFLC": 1, "APL": 0, "LED": "01", "FLC": 1, "AXI": 0 } ``` ``` -------------------------------- ### Video Property Index for Get/SetVideoProcAmp() Source: https://github.com/dino-lite/dnx64-python-api/wiki/Appendix:-Parameter-Table Lists the available video processing properties that can be accessed or modified using the GetVideoProcAmp() and SetVideoProcAmp() functions. ```APIDOC ## Get/SetVideoProcAmp() Video Properties ### Description Provides a mapping of integer values to specific video processing parameters that can be controlled via the GetVideoProcAmp() and SetVideoProcAmp() functions. ### Method GET/SET ### Endpoint /dino-lite/dnx64-python-api/video-proc-amp ### Parameters #### Query Parameters - **index** (integer) - Required - The index of the video property to get or set. - **value** (integer) - Optional (for SET) - The value to set for the specified property. #### Request Body N/A ### Request Example (GET) ```json { "method": "GetVideoProcAmp", "index": 0 } ``` ### Request Example (SET) ```json { "method": "SetVideoProcAmp", "index": 0, "value": 100 } ``` ### Response #### Success Response (200) - **parameter** (string) - The name of the video property. - **value** (integer) - The current value of the property (for GET). #### Response Example (GET) ```json { "parameter": "Brightness", "value": 100 } ``` ### Video Property Index Mapping: - **0**: Brightness - **1**: Contrast - **2**: Hue - **3**: Saturation - **4**: Sharpness - **5**: Gamma - **6**: ColorEnable - **7**: WhiteBalance - **8**: BacklightCompensation - **9**: Gain ``` -------------------------------- ### SetLEDState() API Source: https://github.com/dino-lite/dnx64-python-api/wiki/Appendix:-Parameter-Table Details the SetLEDState() function for controlling the state of LEDs, noting the condition for LED2. ```APIDOC ## SetLEDState() ### Description Sets the state of the LEDs (on or off). LED2 is only available on models with two switchable LEDs. ### Method SET ### Endpoint /dino-lite/dnx64-python-api/led-state ### Parameters #### Query Parameters - **state** (integer) - Required - The desired state for the LEDs. #### Request Body N/A ### Request Example ```json { "method": "SetLEDState", "state": 1 } ``` ### Response #### Success Response (200) - **status** (string) - Indicates success or failure of the operation. #### Response Example ```json { "status": "success" } ``` ### LED State Mapping: - **0**: LED off - **1**: LED1 on - **2**: LED2 on (only available on models with 2 switchable LEDs) ``` -------------------------------- ### SetExposure() API Source: https://github.com/dino-lite/dnx64-python-api/wiki/Appendix:-Parameter-Table Details the SetExposure() function, which allows setting the exposure range based on the camera series. ```APIDOC ## SetExposure() ### Description Sets the exposure level for the camera. The valid exposure range depends on the specific camera series. ### Method SET ### Endpoint /dino-lite/dnx64-python-api/exposure ### Parameters #### Query Parameters - **exposure** (integer) - Required - The desired exposure value. #### Request Body N/A ### Request Example ```json { "method": "SetExposure", "exposure": 5000 } ``` ### Response #### Success Response (200) - **status** (string) - Indicates success or failure of the operation. #### Response Example ```json { "status": "success" } ``` ### Exposure Range by Series: - **3011, 3013**: 8 to 30612 - **1.3M Edge**: 1 to 63076 - **5M Edge**: 1 to 30000 - **1.3M Premier**: 1 to 41771 - **5M Premier**: 1 to 30000 ``` -------------------------------- ### SetFLCSwitch() API Source: https://github.com/dino-lite/dnx64-python-api/wiki/Appendix:-Parameter-Table Provides information on the SetFLCSwitch() function, used to configure the switch-on quadrants for FLC (Fluorescent Lamp Control). ```APIDOC ## SetFLCSwitch() ### Description Configures the switch-on quadrants for the Fluorescent Lamp Control (FLC) feature. ### Method SET ### Endpoint /dino-lite/dnx64-python-api/flc-switch ### Parameters #### Query Parameters - **quadrant** (integer) - Required - The value representing the desired switch-on quadrant configuration. #### Request Body N/A ### Request Example ```json { "method": "SetFLCSwitch", "quadrant": 3 } ``` ### Response #### Success Response (200) - **status** (string) - Indicates success or failure of the operation. #### Response Example ```json { "status": "success" } ``` ### Switch-on Quadrant Mapping: - **1**: Quadrant 1 - **2**: Quadrant 2 - **3**: Quadrants 1, 2 - **4**: Quadrant 3 - **5**: Quadrants 1, 3 - **6**: Quadrants 2, 3 - **7**: Quadrants 1, 2, 3 - **8**: Quadrant 4 - **9**: Quadrants 1, 4 - **10**: Quadrants 2, 4 - **11**: Quadrants 1, 2, 4 - **12**: Quadrants 3, 4 - **13**: Quadrants 1, 3, 4 - **14**: Quadrants 2, 3, 4 - **15**: Quadrants 1, 2, 3, 4 - **16**: All LEDs turn off ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.