cfa_flatten

dnois.sensor.cfa_flatten(image: Tensor, unit_size: int | tuple[int, int] = 1) Tensor

Flatten the pixels in a channel-wise image with shape \((\cdots,C,H,W)\) into CFA units with size \((h,w)\) to form an image with shape \((\cdots,H\times h,W\times w)\), where \(C=hw\). This is the inverse of cfa_collect().

Note

This function is similar to pixel_shuffle() but removes a dimension of the input and supports unequal unit height and width.

Parameters:
  • image (Tensor) – The image to be flattened, a tensor shape \((\cdots,C,H,W)\).

  • unit_size – Height and width of a pixel group \((h,w)\). Default: (1, 1).

Type:

int or tuple[int, int]

Returns:

Flattened image with shape \((\cdots,H\times h,W\times w)\).

Return type:

Tensor