Nodes/ComfyUI-CameraPack/Get Intrinsics From Batch
ComfyUI Node

Get Intrinsics From Batch

Get Intrinsics From Batch

By PozzettiAndrea·Created 7 months ago·Updated 9 days ago· 1
Get Intrinsics From Batch
  • intrinsics
  • intrinsics
batch_index0
length1

Get Intrinsics From Batch is the K-matrix sibling of this pack's GetExtrinsicsFromBatch. Where that node slices camera poses out of a batched tensor, this one slices the lens matrices. If a multi-view model hands you intrinsics as a [N, 3, 3] batch and you want just one camera's focal length, this is the two-click way to get it.

Same idea, mirrored for K matrices

Everything that made the extrinsics slicer useful applies here, just for the 3×3 intrinsics matrices:

  • intrinsics - a batched [N, 3, 3] tensor (a [1, N, 3, 3] leading dim is unwrapped automatically, and a lone unbatched [3, 3] gets wrapped and then sliced, so it never complains).
  • batch_index (default 0, −4096 to 4096) - starting index; negatives wrap from the end, so -1 is the last camera's intrinsics.
  • length (default 1) - how many consecutive matrices to return; 0 means "everything from batch_index to the end."
  • Output: intrinsics (INTRINSICS). A single matrix is squeezed to a bare [3, 3]; longer slices stay batched.

For a beginner, the whole job is: drop your batched K tensor in, set batch_index to the view number you care about, and leave length at 1. The output plugs straight into anything that wants a single camera's intrinsics - including the DA3ToLoad3DCamera converter in this same pack.

Why it's not just a waste of a node

Like its extrinsics twin, it exists for two reasons. First, the shape mismatch: single-camera consumers expect a clean [3, 3], and models often emit [N, 3, 3] or [1, N, 3, 3]. Second, the subtle one - it calls .clone() rather than returning a plain view, because a sliced view still points at the parent tensor's backing storage and some of ComfyUI's shared-memory serialization paths will read that whole buffer and then try to reshape it into one 3×3. The clone gives the receiver storage sized exactly to the slice. That's the kind of bug that shows up as a cryptic shape error two nodes downstream, and this node quietly sidesteps it.

Installing and notes

It's part of ComfyUI-CameraPack (PozzettiAndrea) - the same single install covers all five nodes in the pack. ComfyUI Manager, search "CameraPack":

cd ComfyUI/custom_nodes
git clone https://github.com/PozzettiAndrea/ComfyUI-CameraPack.git

Restart ComfyUI; the node lives under 3d/camera. Pure Python, no extra dependencies, no model downloads.

One honest note: this node and GetExtrinsicsFromBatch are nearly identical in spirit, and if you only ever work single-camera you may never need either - the pack's converter already takes the first item of a batch silently. But the moment you start picking specific views out of a multi-view reconstruction, or a downstream node throws a shape error, you'll be glad they're there. Consider installing the extrinsics and intrinsics slicers as a matched pair; they solve the same class of problem and you'll want both in the same graph.

Category3d/camera

Inputs (3)

NameTypeDefaultDescription
intrinsicsINTRINSICSBatched K [N, 3, 3] (or [1, N, 3, 3]).
batch_indexINT0-4096–4096Starting index. Negative wraps from the end.
lengthINT10–4096Number of consecutive intrinsics to return. 0 = take everything from batch_index to the end. Default 1 = single K matrix.

Outputs (1)

NameTypeDescription
intrinsicsINTRINSICS