RawBayerToYoloTensorOp
🚧 Documentation is under development
The Holoscan SDK guide is currently under active development. Some sections may be incomplete or change without notice.
Questions? Contact RidgeRun or email to support@ridgerun.com.
-
Overview
-
Build, Run, and Validate
-
Core Concepts
-
Operators and Graphs
-
Tensor Data and Memory
-
Interprocess Communication
-
-
Application and Operator Development
- Building an HSDK Application
- Writing a Minimal Operator
- Typed Parameters and Configuration
- Reading, Writing, and Forwarding Data
- Writing Tensor Operators
- Complete Operator Patterns
- Authoring Runtime Behavior
- Runtime Parameter Updates
- Lifecycle Callbacks and Restart Control
- Performance and Debugging
- SDK Source Map
-
Operator Reference
-
Core Operators
-
Holoscan Camera
-
Holoscan RidgeRun
- Overview
- Build and Installation
- ArgusCameraOp
- V4L2SourceOp
- V4L2UserPtrSourceOp
- BgraToPlanarTensorOp
- RawBayerToBgraOp
- RawBayerToYoloTensorOp
- YuyvToBgraOp
- TensorRtInferenceOp
- DrmDisplayOp
- DrmBgraDisplayOp
- X11DisplayOp
- CudaCompositorOp
- DepthColorizerOp
- FakesinkOp
- FrameSkipperOp
- InterprocessSrcOp
- TestPatternOp
-
-
Migration from Holoscan 4.x
-
Examples
-
Core
-
Holoscan Camera
-
Holoscan RidgeRun
-
-
Benchmark and Use Cases
-
Holoscan vs GStreamer
- Overview
-
Capture and Display
-
Capture and Inference
- Compare the workloads
- Implemented Applications
- Framework Selection
- Interprocess
-
RawBayerToYoloTensorOp
RawBayerToYoloTensorOp fuses RG10 Bayer demosaicing, RGB conversion, aspect-ratio-preserving resize, letterbox padding and YOLO normalization. The operator is optimized for the Holoscan 5 RidgeRun YOLO11 pipeline and emits the TensorRT input directly.
Input arguments
| Argument | Default and meaning |
|---|---|
source_width, source_height
|
Positive, even dimensions of the RG10 source tensor. |
network_width, network_height
|
640 × 640 by default; output model dimensions.
|
optical_black
|
0; black-level correction before normalization.
|
bayer_grid
|
1 for RGGB; values 0–3 select the supported Bayer phases.
|
raw_shift
|
6 by default; right shift before the 10-bit mask.
|
input_gain
|
8.0 by default; scales the corrected signal before clamping to [0,1].
|
Ports and data contract
| Port | Memory | Queue | Trigger | Contract |
|---|---|---|---|---|
input
|
CUDA device, contiguous | SDK default | OnEach
|
U16 tensor with shape [source_height, source_width, 1].
|
output
|
CUDA device, runtime pool | N/A | Same activation | New F32 tensor with shape [1, 3, network_height, network_width] in planar RGB order.
|
The operator requires a CUDA stream and forwards the input sample metadata to the output.
Processing behavior
The scale preserves the source aspect ratio. The resized image is centered in the network canvas and the surrounding letterbox pixels are set to zero. For each output pixel, the kernel reads a 3×3 Bayer neighborhood once, estimates RGB values, subtracts the optical-black level, applies input_gain / (1023 - optical_black) and clamps every channel to [0,1].
V4L2UserPtrSourceOp -> RawBayerToYoloTensorOp -> TensorRtInferenceOp -> FakesinkOp
This stage does not decode detections, apply non-maximum suppression, draw boxes or display the image. Those are separate application concerns.
Build
Follow Holoscan RidgeRun Build and Installation for the module build and installation. The operator-specific include, target, and runtime requirements are listed below.
Include raw_bayer_to_yolo_tensor_optimized/raw_bayer_to_yolo_tensor.hpp and link holoscan::raw_bayer_to_yolo_tensor_optimized.
Example
The output device must be bound explicitly when the graph is compiled. The network dimensions should match the TensorRT engine input:
auto preprocess = graph.op<RawBayerToYoloTensorOp>(
"preprocess", 1920, 1080, 640, 640, 0, 1, 6, 8.0F);
auto inference = graph.op<TensorRtInferenceOp>("inference", model_path);
graph.add_flow(preprocess->output, inference->input);
compile_options.deployment.bind_tensor_output_device(
holoscan::TensorOutputDevicePlacement{
.operator_path = "preprocess",
.output_port = "output",
.device = holoscan::DeviceId{0}});
The constructor computes the letterbox geometry once. It chooses the smaller network/source scale, rounds the resized dimensions, and centers the image with padding_left and padding_top. Pixels outside the resized image remain zero. Inside the image, the CUDA kernel samples a Bayer neighborhood, produces RGB values, applies the optical-black correction and input_gain / (1023 - optical_black), and writes planar NCHW float32 values.
The operator validates even source dimensions, Bayer phase, RAW10 shift, optical-black range and positive finite gain. At runtime it requires a contiguous CUDA uint16 tensor with the exact configured [height,width,1] shape and a CUDA stream. It forwards sample metadata to the model input and records the preprocessing stage in the RidgeRun flow trace.