ConvertToOp
🚧 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
-
ConvertToOp
ConvertToOp scales and offsets each image value, then converts it to the chosen scalar type. It produces a new CUDA tensor while preserving image geometry and capture metadata. Use it, for example, to convert U8 pixels to floating-point values before further processing.
Numeric conversion is separate from layout conversion and channel-wise normalization.
Input arguments
Each result follows alpha × input + beta. Integral destinations use saturating conversion and the selected rounding mode. ConvertToOpParams has these defaults:
| Parameter | Default and Meaning |
|---|---|
output_type
|
kF32. VisionElementType supports U8, S8, U16, S16, S32, F32 and F64.
|
alpha
|
1.0; finite double multiplier.
|
beta
|
0.0; finite double offset.
|
rounding
|
kNearest; RoundingMode also accepts kTruncate toward zero for integral results.
|
All four fields are CompileTime parameters, frozen for an accepted plan. Set the whole aggregate before compilation; changing the authoring handle does not update an existing run. The parameter-field default supplies that rule, and output_type is also a capacity dependency.
Ports and data contract
| Port | Memory | Queue | Trigger | Contract |
|---|---|---|---|---|
input
|
CUDA device | 1 | OnEach
|
HWC or NHWC image, one to four channels, using one of the supported scalar types. |
output
|
CUDA device, contiguous | N/A | Same activation | Same geometry, batch, channel order and metadata as the input, with the configured output type. |
The input must use a supported interleaved HWC or NHWC layout. The output is a new contiguous tensor on the same CUDA device.
Example
In graph composition, with graph already declared, include <holoscan/vision/convert_to_op.hpp> and configure:
auto convert = graph.op<holoscan::vision::ConvertToOp>("to-f32");
convert.set_params(holoscan::vision::ConvertToOpParams{
.output_type = holoscan::vision::VisionElementType::kF32,
.alpha = 1.0 / 255.0,
.beta = 0.0,
.rounding = holoscan::vision::RoundingMode::kNearest,
});
This configuration fragment maps U8 values 0 and 255 to F32 values 0 and 1. Connect a compatible CUDA producer to convert->input and consume convert->output. The complete pipeline linked below supplies those operators and checks, including CUDA copy outcomes and run termination.
Build
Follow Build the SDK on AGX Orin for the SDK build and installation. Link the installed holoscan::vision target in the application.