lagrange.image¶
Classes¶
Image channel |
|
Image pixel precision |
|
Image storage class |
Functions¶
|
Split a grid image into |
Module Contents¶
- class lagrange.image.ImageChannel¶
Bases:
enum.EnumImage channel
- four = 4¶
- one = 1¶
- three = 3¶
- unknown = 5¶
- class lagrange.image.ImagePrecision¶
Bases:
enum.EnumImage pixel precision
- float16 = 7¶
- float32 = 5¶
- float64 = 6¶
- int32 = 4¶
- int8 = 1¶
- uint32 = 3¶
- uint8 = 0¶
- unknown = 8¶
- class lagrange.image.ImageStorage(width, height, alignment)¶
Image storage class
- Parameters:
width (int)
height (int)
alignment (int)
- property data: Annotated[numpy.typing.NDArray[numpy.uint8], dict(order='C', device='cpu')]¶
Raw image data
- Return type:
Annotated[numpy.typing.NDArray[numpy.uint8], dict(order=’C’, device=’cpu’)]
- property height: int¶
Image height
- Return type:
int
- property stride: int¶
Image stride
- Return type:
int
- property width: int¶
Image width
- Return type:
int
- lagrange.image.split_grid(grid, num_cells, rows=0, cols=0)¶
Split a grid image into
num_cellsrow-major sub-images.The grid is split into
rowsxcolscells. A value of zero on either dimension means auto-detect:rows=0, cols=0: pick the factorization producing cells closest to square.rows=R, cols=0: derivecols = num_cells / R.rows=0, cols=C: deriverows = num_cells / C.rows=R, cols=C: validateR * C == num_cells.
Returned views share memory with the input grid (no copy).
- Parameters:
grid (Annotated[numpy.typing.NDArray[numpy.float32], dict(shape=(None, None, None), order='C', device='cpu')]) – HxWxC grid image as a numpy array.
num_cells (int) – Number of cells to split the grid into.
rows (int) – Number of cell rows in the grid (0 = auto).
cols (int) – Number of cell columns in the grid (0 = auto).
- Returns:
List of
num_cellsnumpy views into the grid, in row-major order.- Return type:
list[object]