Get Extrinsics From Batch
Get Extrinsics From Batch
- extrinsics
- extrinsics
Multi-view reconstruction models don't hand you one camera - they hand you a batch of them. Feed a depth-and-pose model a 12-image panorama split and you get 12 extrinsics poses in a single [12, 4, 4] tensor, and now you want just the one view you care about. Get Extrinsics From Batch slices that batch down to a single pose (or a run of poses), and it mirrors ComfyUI's familiar ImageFromBatch semantics so it feels instantly native.
What it's for
The extrinsics tensor from DA3 and similar models is batched - every view in the reconstruction has its own 4×4 pose. But plenty of downstream consumers want exactly one camera: pick the first view of a reconstruction, isolate a particular panorama face, or feed a single camera to a node that silently chokes on a batch. This node is the "extract and continue" step, and it's the extrinsics half of the pack's GetIntrinsicsFromBatch twin.
How the slicing works
It takes a [N, 4, 4] extrinsics tensor (or a [1, N, 4, 4] - the leading single batch dim is unwrapped automatically) and slices it like a Python list with a couple of conveniences:
batch_index(default 0, range −4096 to 4096) is the starting index. Negative values wrap from the end, so-1grabs the last pose - handy when you don't know the batch size offhand.length(default 1) is how many consecutive poses to return. Default 1 = a single extrinsic. Set it to0and it takes everything frombatch_indexto the end - a "rest of the batch" escape hatch.- Output:
extrinsics(EXTRINSICS). A single-pose slice is squeezed down to a bare[4, 4]; a multi-pose slice stays batched.
The two inputs that matter for beginners are batch_index and length; everything else is copy-paste territory. The node validates its inputs and raises a clear error on an empty slice, so you won't silently get nothing.
A real-world detail worth knowing
The source carries an unusually honest comment about why it calls .clone() instead of just slicing: a sliced view of a bigger tensor still points at the original backing buffer, and the shared-memory serializer some ComfyUI environments use reads that whole buffer - so a "single" [4, 4] extracted from a 12×4×4 tensor could explode when the receiver tries to reshape 192 floats. The clone allocates fresh, view-free storage sized exactly to the slice. It's the kind of bug you'd chase for an afternoon; the node just handles it.
Installing
Part of ComfyUI-CameraPack (PozzettiAndrea). ComfyUI Manager → search "CameraPack", or:
cd ComfyUI/custom_nodes
git clone https://github.com/PozzettiAndrea/ComfyUI-CameraPack.git
Restart ComfyUI. Pure Python, no new dependencies, no model files - the node appears under 3d/camera. All five nodes in the pack share the same single install.
When you'd actually reach for it
Every time a "one camera expected" error appears downstream, honestly. If a consumer node is complaining about a 4D tensor or a batch where it wanted a single pose, drop this in front of it and set batch_index to the view you want. It's a tiny node that saves you from writing your own tensor slicing in a CustomScript node - which, trust me, you don't want to do at 2am.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| extrinsics | EXTRINSICS | Batched w2c [N, 4, 4] (or [1, N, 4, 4]). | |
| batch_index | INT | 0-4096–4096 | Starting index. Negative wraps from the end (e.g. -1 = last extrinsic). |
| length | INT | 10–4096 | Number of consecutive extrinsics to return starting at batch_index. 0 = take everything from batch_index to the end. Default 1 = single extrinsic. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| extrinsics | EXTRINSICS | — |