Holoscan SDK v4.0.0

Class BayerDemosaicGpuResidentOp

Base Type

class BayerDemosaicGpuResidentOp : public holoscan::GPUResidentOperator

GPU-resident operator class to demosaic the input video stream.

This operator is designed for GPU-resident execution mode where:

  • All setup and configuration are done once during initialization

  • The compute function is launched only once from the CPU

  • Subsequent executions are run entirely on the GPU via CUDA graph capture

The operator performs Bayer pattern demosaicing using NPP (NVIDIA Performance Primitives) to convert a single-channel Bayer pattern image to a 3-channel RGB or 4-channel RGBA image.

==Device Inputs==

  • in : Device memory containing single-channel Bayer pattern data

    • The input must be 8-bit or 16-bit unsigned integer grayscale Bayer pattern data.

    • Memory size must be pre-configured based on image dimensions.

==Device Outputs==

  • out : Device memory containing demosaiced RGB/RGBA data

    • Output is 3-channel RGB if generate_alpha is false, 4-channel RGBA otherwise.

    • Data type matches input (8-bit or 16-bit unsigned integer).

==Configuration Parameters==

  • width: Image width in pixels. Must be an even number.

  • height: Image height in pixels. Must be an even number.

  • pixel_type: Pixel type (0 = uint8, 1 = uint16). Default: 0.

  • interpolation_mode: The interpolation model for demosaicing. Default: 0 (NPPI_INTER_UNDEFINED).

  • bayer_grid_pos: The Bayer grid position. Default: 2 (NPPI_BAYER_GBRG).

    • NPPI_BAYER_BGGR (0): Default registration position BGGR.

    • NPPI_BAYER_RGGB (1): Registration position RGGB.

    • NPPI_BAYER_GBRG (2): Registration position GBRG.

    • NPPI_BAYER_GRBG (3): Registration position GRBG.

  • generate_alpha: Generate alpha channel. Default: false.

  • alpha_value: Alpha value if generate_alpha is true. Default: 255.

Public Functions

HOLOSCAN_OPERATOR_FORWARD_ARGS_SUPER (BayerDemosaicGpuResidentOp, holoscan::GPUResidentOperator) BayerDemosaicGpuResidentOp()=default
virtual void setup(OperatorSpec &spec) override

Define the operator specification.

Parameters

spec – The reference to the operator specification.

virtual void initialize() override

Initialize the operator.

This function is called when the fragment is initialized by Executor::initialize_fragment().

virtual void compute(InputContext &op_input, OutputContext &op_output, ExecutionContext &context) override

Implement the compute method.

This method is called by the runtime multiple times. The runtime calls this method until the operator is stopped.

Parameters
  • op_input – The input context of the operator.

  • op_output – The output context of the operator.

  • context – The execution context of the operator.

Previous Class AsyncPingTxOp
Next Class BayerDemosaicOp
© Copyright 2022-2026, NVIDIA. Last updated on Mar 9, 2026