CustomCropOp
🚧 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
-
CustomCropOp
CustomCropOp copies a configured rectangular region into a new CUDA tensor, preserving the selected pixel values, scalar type, channel order, and capture metadata. It removes a fixed margin or isolates an area of interest without interpolation.
The result has its own runtime-pool storage. Cropping here does not expose a borrowed view of the input allocation.
Input arguments
CustomCropOpParams describes [x,x+width) × [y,y+height):
| Parameter | Default and Rule |
|---|---|
x, y
|
Each defaults to 0; nonnegative signed 32-bit coordinates. CompileTime fields.
|
width, height
|
Each defaults to 1; positive signed 32-bit dimensions. Recompile-required.
|
max_batch_size
|
1; range 1–65,535. Recompile-required and required on a complete parameter load.
|
The rectangle validator checks containment using widened arithmetic. A crop extending outside the image is rejected; the operator does not pad or clamp. Author the complete aggregate before compilation; changing x or y is not a live update simply because those fields are not marked recompile-required.
The output-span projection is width × height × max_batch_size × 4 channels × 8 bytes, covering the supported maximum element size. It must fit INT32_MAX. This conservative declared bound is distinct from the bytes in a particular cropped image.
Ports and data contract
| Port | Memory | Queue | Trigger | Contract |
|---|---|---|---|---|
input
|
CUDA device | 1 | OnEach
|
Interleaved HWC or NHWC image with one to four channels and a supported scalar type. |
output
|
CUDA device, contiguous | N/A | Same activation | Cropped to the configured width and height. Batch and capture metadata are preserved. |
The crop and batch dimensions must fit the configured bounds.
Example
In graph composition, include <holoscan/vision/custom_crop_op.hpp>. With graph already declared:
auto crop = graph.op<holoscan::vision::CustomCropOp>("crop");
crop.set_params(holoscan::vision::CustomCropOpParams{
.x = 80,
.y = 40,
.width = 640,
.height = 480,
.max_batch_size = 1U,
});
The source image must be at least 720 pixels wide and 520 pixels high. Connect it to crop->input; the result on crop->output contains the 640 × 480 rectangle beginning at (80,40). A three-channel HWC input yields [480,640,3].
Build
Follow Build the SDK on AGX Orin for the SDK build and installation. Link the installed holoscan::vision target in the application.