Camera USB External

This function block provides a flexible way to use external USB cameras by accepting camera index and configuration inputs. It is suited for setups where camera selection, resolution and exposure are controlled from the flow itself (for example when cameras are switched or adjusted automatically).

πŸ“₯ Inputs

  • Activate Signal Used to activate frame grabbing and allow the block to output frames.

  • Release Signal Used to stop the camera and free the device so other applications can use it.

  • Camera Index Integer index of the USB camera to open (choose the device number reported by your system).

  • Resolution Width Desired width for the camera capture (optional).

  • Resolution Height Desired height for the camera capture (optional).

  • Scan Cameras Trigger to refresh the list of available cameras (useful when plugging in new devices).

  • Set Exposure Numeric exposure value to apply to the camera (optional).

  • Set Auto Exposure Numeric value to set camera auto-exposure mode or parameter (optional).

πŸ“€ Outputs

  • Camera Frame Live frame captured from the selected USB camera.

πŸ•ΉοΈ Controls

  • Camera Index Choose which physical camera to use by providing its index.

  • Resolution Width / Resolution Height Provide the desired capture resolution. If not supported, the camera will use the closest available resolution.

  • Scan Cameras Use this to update available camera devices when you connect or disconnect USB cameras.

  • Set Exposure Adjust exposure value when supported by the camera.

  • Set Auto Exposure Enable/adjust auto exposure behavior when supported.

  • Activate Signal / Release Signal Use these signals to start and stop frame streaming in a controlled way.

  • Info (status label) Displays current source and resolution to help confirm which camera and size are active.

βš™οΈ Running mechanism

  • The block waits for an Activate Signal to start delivering frames. When active it opens the camera specified by Camera Index and returns the latest frame on the Camera Frame output.

  • If Release Signal is triggered the block closes the camera and stops outputting live frames.

  • Changing Camera Index while running will switch the input device; changing resolution or exposure inputs will attempt to apply the new settings while the camera is running.

  • If the block cannot obtain a valid frame (device error, temporary failure, corrupted frame), it will attempt to recover automatically and will report status messages through the Info area.

  • When not active the block keeps the last captured frame available so the visual flow does not suddenly go empty.

✨ Features

  • Controlled camera selection using a numeric Camera Index input, useful for automated or multi-camera setups.

  • Runtime resolution and exposure adjustments via inputs, enabling on-the-fly tuning.

  • Scan capability to discover newly attached USB cameras without restarting the application.

  • Resilient behavior: the block detects invalid/blank frames and reports status while attempting recovery.

  • Optional background frame streaming/upload support (when available in your environment) for remote monitoring or offloading.

πŸ“ Usage instructions

  1. Provide a camera index to Camera Index (check your system to find device numbers).

  2. Optionally set Resolution Width and Resolution Height to request a specific capture size.

  3. Optionally set Set Exposure or Set Auto Exposure to tune image brightness/auto-exposure.

  4. Send a true signal to Activate Signal to begin receiving frames on Camera Frame.

  5. When finished, send a true signal to Release Signal to close the camera and free the device.

πŸ’‘ Tips and Tricks

  • To preview the live feed visually, connect the Camera Frame output to the Show Image block.

  • Save frames for later analysis by connecting Camera Frame to Image Logger or use Record Video to create a continuous recording.

  • If you need to reduce processing load before heavy AI blocks, add Image Resize to shrink frames before sending them to Object Detection (D-FINE) or Object Detection.

  • Use Image ROI Select or Image ROI to crop the area of interest and reduce false detections when feeding into Find Object or Mask Detection.

  • For OCR or barcode tasks, feed the frame into OCR / OCR (EasyOCR) or Barcode Reader respectively; consider adding Contrast Optimization or Denoising first.

  • If background or lighting causes false positives in detectors, try Background Removal (RMBG-1.4) or apply Blur and Image Adaptive Threshold as preprocessing steps.

πŸ› οΈ Troubleshooting

  • No frames or blank frames: ensure the correct Camera Index is provided and the device is not used by another application. Try toggling Release Signal then Activate Signal.

  • Camera not listed after plugging in: use Scan Cameras to refresh available devices and try again.

  • Resolution or exposure changes not applied: not all cameras support every requested resolution or exposure control. Try commonly supported sizes (e.g., 640x480, 1280x720) and check the camera documentation.

  • Intermittent corrupted frames: reduce USB hub load, try a different port, or lower requested frame size to reduce bandwidth.

  • Permission errors on some systems: ensure the application has permission to access camera devices (OS/device driver settings).

If you need a simple preview-only setup, pair this block with Show Image and Image Resize for a low-latency monitoring pipeline.

Last updated

Was this helpful?