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 SignalUsed to activate frame grabbing and allow the block to output frames.Release SignalUsed to stop the camera and free the device so other applications can use it.Camera IndexInteger index of the USB camera to open (choose the device number reported by your system).Resolution WidthDesired width for the camera capture (optional).Resolution HeightDesired height for the camera capture (optional).Scan CamerasTrigger to refresh the list of available cameras (useful when plugging in new devices).Set ExposureNumeric exposure value to apply to the camera (optional).Set Auto ExposureNumeric value to set camera auto-exposure mode or parameter (optional).
π€ Outputs
Camera FrameLive frame captured from the selected USB camera.
πΉοΈ Controls
Camera IndexChoose which physical camera to use by providing its index.Resolution Width/Resolution HeightProvide the desired capture resolution. If not supported, the camera will use the closest available resolution.Scan CamerasUse this to update available camera devices when you connect or disconnect USB cameras.Set ExposureAdjust exposure value when supported by the camera.Set Auto ExposureEnable/adjust auto exposure behavior when supported.Activate Signal/Release SignalUse 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 Signalto start delivering frames. When active it opens the camera specified byCamera Indexand returns the latest frame on theCamera Frameoutput.If
Release Signalis triggered the block closes the camera and stops outputting live frames.Changing
Camera Indexwhile 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
Infoarea.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 Indexinput, 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
Provide a camera index to
Camera Index(check your system to find device numbers).Optionally set
Resolution WidthandResolution Heightto request a specific capture size.Optionally set
Set ExposureorSet Auto Exposureto tune image brightness/auto-exposure.Send a true signal to
Activate Signalto begin receiving frames onCamera Frame.When finished, send a true signal to
Release Signalto close the camera and free the device.
π‘ Tips and Tricks
To preview the live feed visually, connect the
Camera Frameoutput to theShow Imageblock.Save frames for later analysis by connecting
Camera FrametoImage Loggeror useRecord Videoto create a continuous recording.If you need to reduce processing load before heavy AI blocks, add
Image Resizeto shrink frames before sending them toObject Detection (D-FINE)orObject Detection.Use
Image ROI SelectorImage ROIto crop the area of interest and reduce false detections when feeding intoFind ObjectorMask Detection.For OCR or barcode tasks, feed the frame into
OCR/OCR (EasyOCR)orBarcode Readerrespectively; consider addingContrast OptimizationorDenoisingfirst.If background or lighting causes false positives in detectors, try
Background Removal (RMBG-1.4)or applyBlurandImage Adaptive Thresholdas preprocessing steps.
π οΈ Troubleshooting
No frames or blank frames: ensure the correct
Camera Indexis provided and the device is not used by another application. Try togglingRelease SignalthenActivate Signal.Camera not listed after plugging in: use
Scan Camerasto 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?