Samples: Add DLPack GPU interop sample and stitching ROI masking - #231
Merged
Conversation
csu-bot-zivid
force-pushed
the
2026-07-26-update-python-samples
branch
5 times, most recently
from
July 28, 2026 20:30
e60d124 to
869c042
Compare
New sample: - capture_and_convert_to_dlpack_tensor_on_cuda: hand a Zivid DeviceArray to PyTorch on the GPU without a CPU round-trip. It shows two paths: torch.as_tensor through the CUDA array interface (the recommended one-liner), and building a DLPack capsule directly from the DeviceArray's device pointer, shape, strides and element type for consumers that expect the __dlpack__ protocol. Both hand-offs are verified zero-copy by comparing data pointers, and both are scoped to the CUDA backend. Requires PyTorch with CUDA support. - The README lists the new sample among the cuda samples. Stitching GUI region of interest: - The stitching verification tab now has an optional Region of Interest box. Enable it and set min/max X, Y and Z in mm to keep background clutter out of the stitched point cloud. - The extents are given in the frame that stays fixed relative to the scanned object: robot base frame for eye-in-hand, robot flange frame for eye-to-hand. The group box title states which frame is in use. - Masking is applied per capture before the hand-eye transform, both for new captures and for captures loaded from disk. - If the box would remove every point of a capture, the unmasked data is shown instead and a warning tells you to adjust the extents.
torbsorb
force-pushed
the
2026-07-26-update-python-samples
branch
from
July 29, 2026 06:06
869c042 to
993e43d
Compare
Jorgen-ha
approved these changes
Jul 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
New sample: DLPack GPU interop
source/applications/advanced/cuda/capture_and_convert_to_dlpack_tensor_on_cuda.pyshows how to hand a Zivid
DeviceArrayto PyTorch on the GPU without aCPU round-trip. Two paths are demonstrated:
torch.as_tensor(device_array, device="cuda"), whichimports the buffer through the CUDA array interface that
DeviceArrayalready implements — no pointer, shape or stride handling needed.
DeviceArray'sdevice pointer, shape, strides (in elements), element data type and
CUDA device, exposed through the standard
__dlpack__/__dlpack_device__protocol and imported withtorch.from_dlpack.Use this when your consumer expects a DLPack capsule directly. The
DeviceArrayis kept alive until the consumer releases the tensor.Both hand-offs are verified zero-copy by comparing data pointers, and
both are scoped to the CUDA backend. The sample requires a CUDA-capable
GPU and PyTorch with CUDA support (
pip install torch); PyTorch is athird-party dependency that Zivid does not provide or support.
The README now lists the sample among the
cudasamples.Stitching GUI: region of interest masking
The stitching verification tab now has an optional Region of Interest
box for keeping background clutter out of the stitched point cloud.
relative to the scanned object: the robot base frame for eye-in-hand
and the robot flange frame for eye-to-hand. The group box title states
which frame is currently in use.
for captures taken in the GUI and for captures loaded from disk.
shown unmasked and a warning asks you to adjust the extents, so you
never end up with a silently empty view.