Nodes/comfyui_cv/CV Roll (FFT Shift)
ComfyUI Node

CV Roll (FFT Shift)

Cyclically shifts an array: pixels pushed off one edge re-enter on the opposite edge (numpy.roll on the spatial axes; channels are never mixed). The fftshift mode swaps quadrants so cv2.dft's zero-frequency term moves from the top-left corner to the center - the layout every spectrum figure uses and the one to build centered frequency masks in; ifftshift undoes it exactly (they differ on odd sizes). Custom mode rolls by an explicit (shift_x, shift_y).

By bmad4ever·Created 3 months ago·Updated 2 days ago· 0
CV Roll (FFT Shift)
  • array
  • array
modefftshift (center the zero frequency)
shift_x0
shift_y0
Categoryimage/CV/low-level

Inputs (4)

NameTypeDefaultDescription
arrayCOMFY_MATCHTYPE_V3Array to roll (any dtype; a DFT spectrum, an image, a mask...). The output echoes this input's format. A LATENT link is processed in latent space: frame 0 becomes a float32 [H,W,C] array (any channel count), values untouched. Arithmetic ops (add, multiply, etc.) also accept a full LATENT batch ({samples: [B,C,H,W]}) — the whole batch flows through when both inputs have the same batch size. Accepts a ComfyUI IMAGE/MASK directly (frame 0 of a batch) or an NPARRAY. Arithmetic ops (add, multiply, etc.) process the full IMAGE batch when both inputs have the same batch size.
modeCOMBOfftshift (center the zero frequency)fftshift/ifftshift compute the half-size shifts from the array itself; custom uses shift_x/shift_y.
shift_xINT0-2147483648–2147483647Custom mode only: columns to roll right (negative = left). Ignored by fftshift/ifftshift.
shift_yINT0-2147483648–2147483647Custom mode only: rows to roll down (negative = up). Ignored by fftshift/ifftshift.

Outputs (1)

NameTypeDescription
arrayCOMFY_MATCHTYPE_V3The rolled array, in the same format the input arrived in.