Frame Partitioning

Frame2D provides a quick way to create windows

View As

There are a few methods to split the frames. This is the recommended way as splitting doesn’t use memory referencing.

  • view_windows

  • view_windows_as_frames

  • view_blocks

  • view_blocks_as_frames

Windows vs. Blocks vs. As Frames

Windows can overlap, blocks cannot.

Note that the functions without as_frames returns a np.ndarray.

Module Info

class frmodel.base.D2.frame._frame_partition._Frame2DPartition

Bases: abc.ABC

view_blocks(height: int, width: int)numpy.ndarray

Partitions the image into blocks using striding

Note that the height and width must be a divisor.

The dims are [RowBlock, ColBlock, Row, Col, Channels]

Parameters
  • height – Height of expected block, must be int divisor of original height

  • width – Width of expected block, must be int divisor of original width

view_blocks_as_frames(height: int, width: int)List[List[Frame2D]]

Partitions the image into blocks using striding

Note that the height and width must be a divisor.

Parameters
  • height – Height of expected block, must be int divisor of original height

  • width – Width of expected block, must be int divisor of original width

view_windows(height: int, width: int, height_step: int, width_step: int)numpy.ndarray

Partitions the image into windows using striding

Note that the parameters must cleanly divide the image else it’ll be cropped

E.g. 200 x 200 cannot be 100 Step 3 x 100 Step 7

The dims are [RowBlock, ColBlock, Row, Col, Channels]

Parameters
  • height – Height of expected window

  • width – Width of expected window

  • height_step – Step of height window

  • width_step – Step of width window

view_windows_as_frames(height: int, width: int, height_step: int, width_step: int)List[List[Frame2D]]

Partitions the image into windows using striding

Note that the parameters must cleanly divide the image else it’ll be cropped

E.g. 200 x 200 cannot be 100 Step 3 x 100 Step 7

Parameters
  • height – Height of expected window

  • width – Width of expected window

  • height_step – Step of height window

  • width_step – Step of width window